Documentation ¶
Index ¶
- func LockTypesCanBeParent(parent, child LockType) bool
- func LockTypesCompatible(l1, l2 LockType) bool
- func LockTypesSubstitutable(have, want LockType) bool
- type ChildSet
- func (t *ChildSet) AddChild(ptr *MultiLevelLock)
- func (t *ChildSet) AddReference(txId TransactionId, childKey ResourceNamePart)
- func (t *ChildSet) ClearReferences(txId TransactionId)
- func (t *ChildSet) RemoveChild(childKey ResourceNamePart)
- func (t *ChildSet) RemoveReference(txId TransactionId, childKey ResourceNamePart)
- func (t *ChildSet) String() string
- func (t *ChildSet) TransactionChildren(txId TransactionId) []*MultiLevelLock
- func (t *ChildSet) TransactionCount(txId TransactionId) int
- type DatabaseLock
- type Lock
- type LockEntry
- type LockList
- type LockManager
- func (l *LockManager) Acquire(txId TransactionId, name ResourceName, lockType LockType) error
- func (l *LockManager) AcquireThenRelease(txId TransactionId, name ResourceName, lockType LockType, ...) error
- func (l *LockManager) LockType(txId TransactionId, name ResourceName) LockType
- func (l *LockManager) Promote(txId TransactionId, name ResourceName, newLockType LockType) error
- func (l *LockManager) Release(txId TransactionId, name ResourceName) error
- func (l *LockManager) ReleaseAll(txId TransactionId) error
- type LockType
- func (l LockType) CanBeChildOf(parent LockType) bool
- func (l LockType) CanBeParentOf(child LockType) bool
- func (l LockType) CanSubsitute(other LockType) bool
- func (l LockType) Compatible(other LockType) bool
- func (l LockType) IsIntent() bool
- func (l LockType) LockOfParent() LockType
- func (l LockType) String() string
- type MultiLevelLock
- func (m *MultiLevelLock) Acquire(txId TransactionId, lockType LockType) error
- func (m *MultiLevelLock) EffectiveLockType(txId TransactionId) LockType
- func (m *MultiLevelLock) Esclate(txId TransactionId) error
- func (m *MultiLevelLock) LockType(txId TransactionId) LockType
- func (m *MultiLevelLock) PrintAllLocks()
- func (m *MultiLevelLock) Promote(txId TransactionId, newLockType LockType) error
- func (m *MultiLevelLock) Release(txId TransactionId) error
- type ResourceName
- type ResourceNamePart
- type TransactionId
- type TransactionLockMap
- func (m *TransactionLockMap) AddLock(txId TransactionId, name ResourceName, lockType LockType)
- func (m *TransactionLockMap) AllResources(txId TransactionId) []ResourceName
- func (m *TransactionLockMap) Contains(lock Lock) bool
- func (m *TransactionLockMap) ContainsResource(txId TransactionId, name ResourceName) bool
- func (m *TransactionLockMap) DeleteResource(txId TransactionId, name ResourceName)
- func (m *TransactionLockMap) LockTypes(txId TransactionId, name ResourceName) []LockType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LockTypesCanBeParent ¶
LockTypesCanBeParent returns if a parent with the given LockType can grant the given LockType to its child
func LockTypesCompatible ¶
LockTypesCompatible returns if locks of type l1 and l2 can applied to a resource at the same time.
func LockTypesSubstitutable ¶
LockTypesSubstitutable returns if a lock with type 'have' can substitute a lock with type 'want'.
Types ¶
type ChildSet ¶
type ChildSet struct {
// contains filtered or unexported fields
}
func NewTransactionRefCounter ¶
func NewTransactionRefCounter() *ChildSet
func (*ChildSet) AddChild ¶
func (t *ChildSet) AddChild(ptr *MultiLevelLock)
func (*ChildSet) AddReference ¶
func (t *ChildSet) AddReference(txId TransactionId, childKey ResourceNamePart)
func (*ChildSet) ClearReferences ¶
func (t *ChildSet) ClearReferences(txId TransactionId)
func (*ChildSet) RemoveChild ¶
func (t *ChildSet) RemoveChild(childKey ResourceNamePart)
func (*ChildSet) RemoveReference ¶
func (t *ChildSet) RemoveReference(txId TransactionId, childKey ResourceNamePart)
func (*ChildSet) TransactionChildren ¶
func (t *ChildSet) TransactionChildren(txId TransactionId) []*MultiLevelLock
func (*ChildSet) TransactionCount ¶
func (t *ChildSet) TransactionCount(txId TransactionId) int
type DatabaseLock ¶
type DatabaseLock struct {
// contains filtered or unexported fields
}
func NewDatabaseLock ¶
func NewDatabaseLock() *DatabaseLock
func (*DatabaseLock) EnsureLock ¶
func (d *DatabaseLock) EnsureLock(txId TransactionId, resource ResourceName, lockType LockType) error
func (*DatabaseLock) Free ¶
func (d *DatabaseLock) Free(txId TransactionId) error
func (*DatabaseLock) PrintAllLocks ¶
func (d *DatabaseLock) PrintAllLocks()
type Lock ¶
type Lock struct { Name ResourceName Transaction TransactionId Type LockType }
type LockEntry ¶
type LockEntry struct {
// contains filtered or unexported fields
}
func NewLockEntry ¶
func NewLockEntry(name ResourceName, txLockMap *TransactionLockMap) *LockEntry
func (*LockEntry) AddToQueue ¶
func (*LockEntry) LockCompatible ¶
func (l *LockEntry) LockCompatible(lockType LockType, txId TransactionId) bool
func (*LockEntry) Release ¶
func (l *LockEntry) Release(txId TransactionId)
func (*LockEntry) TransactionLockType ¶
func (l *LockEntry) TransactionLockType(txId TransactionId) LockType
type LockManager ¶
type LockManager struct {
// contains filtered or unexported fields
}
func (*LockManager) Acquire ¶
func (l *LockManager) Acquire(txId TransactionId, name ResourceName, lockType LockType) error
func (*LockManager) AcquireThenRelease ¶
func (l *LockManager) AcquireThenRelease(txId TransactionId, name ResourceName, lockType LockType, releases []ResourceName) error
func (*LockManager) LockType ¶
func (l *LockManager) LockType(txId TransactionId, name ResourceName) LockType
func (*LockManager) Promote ¶
func (l *LockManager) Promote(txId TransactionId, name ResourceName, newLockType LockType) error
func (*LockManager) Release ¶
func (l *LockManager) Release(txId TransactionId, name ResourceName) error
func (*LockManager) ReleaseAll ¶
func (l *LockManager) ReleaseAll(txId TransactionId) error
type LockType ¶
type LockType uint8
func (LockType) CanBeChildOf ¶
func (LockType) CanBeParentOf ¶
func (LockType) CanSubsitute ¶
func (LockType) Compatible ¶
func (LockType) LockOfParent ¶
type MultiLevelLock ¶
type MultiLevelLock struct {
// contains filtered or unexported fields
}
func NewMultiLevelLock ¶
func NewMultiLevelLock(manager *LockManager, parent *MultiLevelLock, key ResourceNamePart) *MultiLevelLock
func (*MultiLevelLock) Acquire ¶
func (m *MultiLevelLock) Acquire(txId TransactionId, lockType LockType) error
func (*MultiLevelLock) EffectiveLockType ¶
func (m *MultiLevelLock) EffectiveLockType(txId TransactionId) LockType
func (*MultiLevelLock) Esclate ¶
func (m *MultiLevelLock) Esclate(txId TransactionId) error
func (*MultiLevelLock) LockType ¶
func (m *MultiLevelLock) LockType(txId TransactionId) LockType
func (*MultiLevelLock) PrintAllLocks ¶
func (m *MultiLevelLock) PrintAllLocks()
func (*MultiLevelLock) Promote ¶
func (m *MultiLevelLock) Promote(txId TransactionId, newLockType LockType) error
func (*MultiLevelLock) Release ¶
func (m *MultiLevelLock) Release(txId TransactionId) error
type ResourceName ¶
type ResourceName struct { Parts []ResourceNamePart // contains filtered or unexported fields }
func NewCodeResourceName ¶
func NewCodeResourceName(marketCode, code string) ResourceName
func NewMarketResourceName ¶
func NewMarketResourceName(marketCode string) ResourceName
func NewResourceName ¶
func NewResourceName(parts []ResourceNamePart) ResourceName
func NewSetResourceName ¶
func NewSetResourceName(set page.CandleSet) ResourceName
func (ResourceName) CreateChild ¶
func (r ResourceName) CreateChild(key ResourceNamePart) ResourceName
func (ResourceName) Hash ¶
func (r ResourceName) Hash() uint64
func (ResourceName) LastPart ¶
func (r ResourceName) LastPart() ResourceNamePart
func (ResourceName) String ¶
func (r ResourceName) String() string
type ResourceNamePart ¶
type ResourceNamePart struct { Value string // contains filtered or unexported fields }
func NewResourceNamePart ¶
func NewResourceNamePart(value string) ResourceNamePart
func (ResourceNamePart) Hash ¶
func (r ResourceNamePart) Hash() uint64
func (ResourceNamePart) String ¶
func (r ResourceNamePart) String() string
type TransactionId ¶
type TransactionId uint64
type TransactionLockMap ¶
type TransactionLockMap struct {
// contains filtered or unexported fields
}
func NewTransactionLockMap ¶
func NewTransactionLockMap() TransactionLockMap
func (*TransactionLockMap) AddLock ¶
func (m *TransactionLockMap) AddLock(txId TransactionId, name ResourceName, lockType LockType)
func (*TransactionLockMap) AllResources ¶
func (m *TransactionLockMap) AllResources(txId TransactionId) []ResourceName
func (*TransactionLockMap) Contains ¶
func (m *TransactionLockMap) Contains(lock Lock) bool
func (*TransactionLockMap) ContainsResource ¶
func (m *TransactionLockMap) ContainsResource(txId TransactionId, name ResourceName) bool
func (*TransactionLockMap) DeleteResource ¶
func (m *TransactionLockMap) DeleteResource(txId TransactionId, name ResourceName)
func (*TransactionLockMap) LockTypes ¶
func (m *TransactionLockMap) LockTypes(txId TransactionId, name ResourceName) []LockType
Click to show internal directories.
Click to hide internal directories.