Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RingMutex

type RingMutex struct {
	// contains filtered or unexported fields
}

func NewRingMutex

func NewRingMutex(mutexCount int, hashMaker func() hash.Hash64) *RingMutex

    Create a RW mutex that provides a pseudo-independent set of mutexes for addresses where the address space is mapped into possibly much smaller set of backing mutexes using the xxhash (non-cryptographic) hash function // modulo size. If some addresses collide modulo size they will be unnecessary contention between those addresses, but you can trade space against contention as desired.

    func NewRingMutexNoHash

    func NewRingMutexNoHash(mutexCount int) *RingMutex

    func NewRingMutexXXHash

    func NewRingMutexXXHash(mutexCount int) *RingMutex

    func (*RingMutex) Lock

    func (mtx *RingMutex) Lock(address []byte) (value *Value)

    func (*RingMutex) Mutex

    func (mtx *RingMutex) Mutex(address []byte) *sync.RWMutex

    func (*RingMutex) MutexCount

    func (mtx *RingMutex) MutexCount() uint64

      Return the size of the underlying array of mutexes

      func (*RingMutex) RLock

      func (mtx *RingMutex) RLock(address []byte)

      func (*RingMutex) RUnlock

      func (mtx *RingMutex) RUnlock(address []byte)

      func (*RingMutex) Unlock

      func (mtx *RingMutex) Unlock(address []byte)

      type Value

      type Value struct {
      	// contains filtered or unexported fields
      }

      func (*Value) Get

      func (v *Value) Get() interface{}

      func (*Value) IsSet

      func (v *Value) IsSet() bool

      func (*Value) Set

      func (v *Value) Set(value interface{})

      Source Files