mutex

package
v0.23.1 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: MPL-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mutex provides a simple key/value store for arbitrary mutexes.

Index

Constants

This section is empty.

Variables

View Source
var GlobalMutex = NewKV()

Functions

This section is empty.

Types

type KV

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

KV 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 NewKV

func NewKV() *KV

NewKV is an implementation of KV.

func (*KV) KvLock

func (m *KV) KvLock(ctx context.Context, key string)

KvLock locks the mutex for the given key. Caller is responsible for calling kvUnlock for the same key.

func (*KV) KvUnlock

func (m *KV) KvUnlock(ctx context.Context, key string)

KvUnlock unlocks the mutex for the given key. Caller must have called kvLock for the same key first.

Jump to

Keyboard shortcuts

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