 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
Constants ¶
      View Source
      
  
const ErrNoLock constant.Error = "ErrNoLock"
    Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FactoryFunc ¶
type FactoryFunc[Key comparable] func(Key) Locker
func (FactoryFunc[Key]) LockerFor ¶
func (fn FactoryFunc[Key]) LockerFor(key Key) Locker
type Locker ¶
type Locker interface {
	// Lock locks the Locker resource.
	// If the lock is already in use, the calling will be blocked until the locks is available.
	// It returns a context that represent a locked context, and an error that is nil if locking succeeded.
	// The returned context may hold locking related runtime states,
	// It might signal cancellation if the ownership of the lock is lost for some reason.
	Lock(ctx context.Context) (_lockCtx context.Context, _ error)
	// Unlock unlocks the Locker resource.
	// It is an error if Locker is not locked on entry to Unlock.
	//
	// It takes the context that Lock returned.
	Unlock(lockCtx context.Context) error
}
    type LockerFactory ¶
type LockerFactory[Key comparable] interface { LockerFor(Key) Locker }
 Click to show internal directories. 
   Click to hide internal directories.