shardedmutex

package
v1.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2024 License: Apache-2.0, MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ShardedMutex

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

func New

func New(nShards int) ShardedMutex

New creates a new ShardedMutex with N shards

func (ShardedMutex) GetLock

func (sm ShardedMutex) GetLock(shard int) sync.Locker

func (ShardedMutex) Lock

func (sm ShardedMutex) Lock(shard int)

func (ShardedMutex) Shards

func (sm ShardedMutex) Shards() int

func (ShardedMutex) Unlock

func (sm ShardedMutex) Unlock(shard int)

type ShardedMutexFor

type ShardedMutexFor[K any] struct {
	// contains filtered or unexported fields
}

func NewFor

func NewFor[K any](hasher func(maphash.Seed, K) uint64, nShards int) ShardedMutexFor[K]

func (ShardedMutexFor[K]) GetLock

func (sm ShardedMutexFor[K]) GetLock(key K) sync.Locker

func (ShardedMutexFor[K]) Lock

func (sm ShardedMutexFor[K]) Lock(key K)

func (ShardedMutexFor[K]) Unlock

func (sm ShardedMutexFor[K]) Unlock(key K)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL