vault: github.com/hashicorp/vault/sdk/helper/locksutil Index | Files

package locksutil

import "github.com/hashicorp/vault/sdk/helper/locksutil"

Index

Package Files

locks.go

Constants

const (
    LockCount = 256
)

func LockIndexForKey Uses

func LockIndexForKey(key string) uint8

type LockEntry Uses

type LockEntry struct {
    sync.RWMutex
}

func CreateLocks Uses

func CreateLocks() []*LockEntry

CreateLocks returns an array so that the locks can be iterated over in order.

This is only threadsafe if a process is using a single lock, or iterating over the entire lock slice in order. Using a consistent order avoids deadlocks because you can never have the following:

Lock A, Lock B Lock B, Lock A

Where process 1 is now deadlocked trying to lock B, and process 2 deadlocked trying to lock A

func LockForKey Uses

func LockForKey(locks []*LockEntry, key string) *LockEntry

func LocksForKeys Uses

func LocksForKeys(locks []*LockEntry, keys []string) []*LockEntry

Package locksutil imports 2 packages (graph) and is imported by 11 packages. Updated 2019-04-12. Refresh now. Tools for package owners.