Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for NewSingleton (0.12 sec)

  1. internal/once/singleton.go

    package once
    
    // Singleton contains a pointer to T that must be set once.
    // Until the value is set all Get() calls will block.
    type Singleton[T any] struct {
    	v   *T
    	set chan struct{}
    }
    
    // NewSingleton creates a new unset singleton.
    func NewSingleton[T any]() *Singleton[T] {
    	return &Singleton[T]{set: make(chan struct{}), v: nil}
    }
    
    // Get will return the singleton value.
    func (s *Singleton[T]) Get() *T {
    	<-s.set
    	return s.v
    }
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Thu Aug 15 12:04:40 UTC 2024
    - 952 bytes
    - Viewed (0)
  2. cmd/bucket-replication.go

    	// ReplicateHealDelete - audit trail of healing of failed/pending delete replications.
    	ReplicateHealDelete = "replicate:heal:delete"
    )
    
    var (
    	globalReplicationPool  = once.NewSingleton[ReplicationPool]()
    	globalReplicationStats atomic.Pointer[ReplicationStats]
    )
    
    // ReplicationPool describes replication pool
    type ReplicationPool struct {
    	// atomic ops:
    	activeWorkers    int32
    Registered: Sun Nov 03 19:28:11 UTC 2024
    - Last Modified: Thu Oct 10 06:49:55 UTC 2024
    - 116.1K bytes
    - Viewed (0)
Back to top