mutex

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2023 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mutex

type Mutex interface {
	// Lock the mutex for the given key. Caller is responsible for calling Unlock
	// for the same key
	Lock(ctx context.Context, key string)
	// Unlock the mutex for the given key. Caller must have called Lock for the same key first
	Unlock(ctx context.Context, key string)
	// RLock the mutex for the given key. Caller is responsible for calling RUnlock
	RLock(ctx context.Context, key string)
	// RUnlock the mutex for the given key. Caller must have called RLock for the same key first
	RUnlock(ctx context.Context, key string)
}

Mutex is a simple key/value store for arbitrary mutexes. It can be used to serialize changes across arbitrary collaborators that share knowledge of the keys they must serialize on.

The initial use case is to let aws_security_group_rule resources serialize their access to individual security groups based on SG ID.

func New

func New() Mutex

New returns a properly initialized local

Jump to

Keyboard shortcuts

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