locking

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2022 License: Apache-2.0, MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type LockNode

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

LockNode is a node in the lock tree. It is used to provide multi-dimensional read and write lock.

func CreateLockNode

func CreateLockNode(path ...interface{}) *LockNode

CreateLockNode creates a lock node. It will create a linked list of lock node based on given path and return the root node.

@input - path.

@output - root node.

func (*LockNode) Insert

func (node *LockNode) Insert(path ...interface{})

Insert inserts a path to a given node. Note: In multiprocess, Lock(path) must be called prior to this function call.

@input - path.

func (*LockNode) Lock

func (node *LockNode) Lock(ctx context.Context, path ...interface{}) (func(), error)

Lock write locks a given path.

@input - context, path.

@output - function to release lock, error.

func (*LockNode) RLock

func (node *LockNode) RLock(ctx context.Context, path ...interface{}) (func(), error)

RLock read locks a given path.

@input - context, path.

@output - function to release lock, error.

func (*LockNode) Remove

func (node *LockNode) Remove(path ...interface{})

Remove removes a path from a given node. Note: In multiprocess, Lock(path) must be called prior to this function call.

@input - path.

Jump to

Keyboard shortcuts

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