lockman

package
v0.3.10-0-alpha2 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2022 License: Apache-2.0 Imports: 14 Imported by: 13

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(man ILockManager)

func LockClass

func LockClass(ctx context.Context, manager ILockedClass, projectId string)

func LockJointObject

func LockJointObject(ctx context.Context, model ILockedObject, model2 ILockedObject)

func LockObject

func LockObject(ctx context.Context, model ILockedObject)

func LockRawObject

func LockRawObject(ctx context.Context, resName string, resId string)

func ReleaseClass

func ReleaseClass(ctx context.Context, manager ILockedClass, projectId string)

func ReleaseJointObject

func ReleaseJointObject(ctx context.Context, model ILockedObject, model2 ILockedObject)

func ReleaseObject

func ReleaseObject(ctx context.Context, model ILockedObject)

func ReleaseRawObject

func ReleaseRawObject(ctx context.Context, resName string, resId string)

Types

type ElementInspectFunc

type ElementInspectFunc func(ele interface{})

type FIFO

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

func NewFIFO

func NewFIFO() *FIFO

func (*FIFO) Enum

func (f *FIFO) Enum(eif ElementInspectFunc)

func (*FIFO) Len

func (f *FIFO) Len() int

func (*FIFO) Pop

func (f *FIFO) Pop(ele interface{}) interface{}

func (*FIFO) Push

func (f *FIFO) Push(ele interface{})

type ILockManager

type ILockManager interface {
	LockKey(ctx context.Context, key string)
	UnlockKey(ctx context.Context, key string)

	LockClass(ctx context.Context, manager ILockedClass, projectId string)
	ReleaseClass(ctx context.Context, manager ILockedClass, projectId string)
	LockObject(ctx context.Context, model ILockedObject)
	ReleaseObject(ctx context.Context, model ILockedObject)
	LockRawObject(ctx context.Context, resName string, resId string)
	ReleaseRawObject(ctx context.Context, resName string, resId string)
	LockJointObject(ctx context.Context, model ILockedObject, model2 ILockedObject)
	ReleaseJointObject(ctx context.Context, model ILockedObject, model2 ILockedObject)
}

func NewEtcdLockManager

func NewEtcdLockManager(config *SEtcdLockManagerConfig) (ILockManager, error)

func NewInMemoryLockManager

func NewInMemoryLockManager() ILockManager

func NewNoopLockManager

func NewNoopLockManager() ILockManager

type ILockedClass

type ILockedClass interface {
	Keyword() string
}

type ILockedObject

type ILockedObject interface {
	ILockedClass
	GetId() string
}

type SBaseLockManager

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

func NewBaseLockManger

func NewBaseLockManger(m ILockManager) *SBaseLockManager

func (*SBaseLockManager) LockClass

func (m *SBaseLockManager) LockClass(ctx context.Context, manager ILockedClass, projectId string)

func (*SBaseLockManager) LockJointObject

func (m *SBaseLockManager) LockJointObject(ctx context.Context, model ILockedObject, model2 ILockedObject)

func (*SBaseLockManager) LockObject

func (m *SBaseLockManager) LockObject(ctx context.Context, model ILockedObject)

func (*SBaseLockManager) LockRawObject

func (m *SBaseLockManager) LockRawObject(ctx context.Context, resName string, resId string)

func (*SBaseLockManager) ReleaseClass

func (m *SBaseLockManager) ReleaseClass(ctx context.Context, manager ILockedClass, projectId string)

func (*SBaseLockManager) ReleaseJointObject

func (m *SBaseLockManager) ReleaseJointObject(ctx context.Context, model ILockedObject, model2 ILockedObject)

func (*SBaseLockManager) ReleaseObject

func (m *SBaseLockManager) ReleaseObject(ctx context.Context, model ILockedObject)

func (*SBaseLockManager) ReleaseRawObject

func (m *SBaseLockManager) ReleaseRawObject(ctx context.Context, resName string, resId string)

type SEtcdLockManager

type SEtcdLockManager struct {
	*SBaseLockManager
	// contains filtered or unexported fields
}

func (*SEtcdLockManager) LockKey

func (lockman *SEtcdLockManager) LockKey(ctx context.Context, key string)

func (*SEtcdLockManager) UnlockKey

func (lockman *SEtcdLockManager) UnlockKey(ctx context.Context, key string)

type SEtcdLockManagerConfig

type SEtcdLockManagerConfig struct {
	Endpoints []string
	Username  string
	Password  string
	TLS       *tls.Config

	LockTTL    int
	LockPrefix string
	// contains filtered or unexported fields
}

type SEtcdLockRecord

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

type SInMemoryLockManager

type SInMemoryLockManager struct {
	*SBaseLockManager
	// contains filtered or unexported fields
}

func (*SInMemoryLockManager) LockKey

func (lockman *SInMemoryLockManager) LockKey(ctx context.Context, key string)

func (*SInMemoryLockManager) UnlockKey

func (lockman *SInMemoryLockManager) UnlockKey(ctx context.Context, key string)

type SInMemoryLockRecord

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

type SLockTableIndex

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

type SNoopLockManager

type SNoopLockManager struct {
	*SBaseLockManager
}

func (*SNoopLockManager) LockKey

func (lockman *SNoopLockManager) LockKey(ctx context.Context, key string)

func (*SNoopLockManager) UnlockKey

func (lockman *SNoopLockManager) UnlockKey(ctx context.Context, key string)

Jump to

Keyboard shortcuts

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