Documentation ¶
Index ¶
- Constants
- type BoltStore
- type InMemoryUnitLocker
- func (m *InMemoryUnitLocker) Close() error
- func (m *InMemoryUnitLocker) GetUnit(accountID, unitID []byte) (*LockedUnit, error)
- func (m *InMemoryUnitLocker) GetUnits(accountID []byte) ([]*LockedUnit, error)
- func (m *InMemoryUnitLocker) LockUnit(lockedBill *LockedUnit) error
- func (m *InMemoryUnitLocker) UnlockUnit(accountID, unitID []byte) error
- type LockReason
- type LockedUnit
- type Transaction
- type UnitLocker
- type UnitStore
Constants ¶
View Source
const (
UnitStoreDBFileName = "unitlock.db"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BoltStore ¶
type BoltStore struct {
// contains filtered or unexported fields
}
func NewBoltStore ¶
func (*BoltStore) DeleteUnit ¶
func (*BoltStore) GetUnit ¶
func (s *BoltStore) GetUnit(accountID, unitID []byte) (*LockedUnit, error)
func (*BoltStore) PutUnit ¶
func (s *BoltStore) PutUnit(unit *LockedUnit) error
type InMemoryUnitLocker ¶
type InMemoryUnitLocker struct {
// contains filtered or unexported fields
}
func NewInMemoryUnitLocker ¶
func NewInMemoryUnitLocker() *InMemoryUnitLocker
func (*InMemoryUnitLocker) Close ¶
func (m *InMemoryUnitLocker) Close() error
func (*InMemoryUnitLocker) GetUnit ¶
func (m *InMemoryUnitLocker) GetUnit(accountID, unitID []byte) (*LockedUnit, error)
func (*InMemoryUnitLocker) GetUnits ¶
func (m *InMemoryUnitLocker) GetUnits(accountID []byte) ([]*LockedUnit, error)
func (*InMemoryUnitLocker) LockUnit ¶
func (m *InMemoryUnitLocker) LockUnit(lockedBill *LockedUnit) error
func (*InMemoryUnitLocker) UnlockUnit ¶
func (m *InMemoryUnitLocker) UnlockUnit(accountID, unitID []byte) error
type LockReason ¶
type LockReason uint
const ( LockReasonAddFees LockReason = iota LockReasonReclaimFees LockReasonCollectDust )
func (LockReason) String ¶
func (r LockReason) String() string
type LockedUnit ¶
type LockedUnit struct { AccountID []byte `json:"accountId"` // account id of the unit e.g. a public key UnitID []byte `json:"unitId"` // id of the locked unit TxHash []byte `json:"txHash"` // state hash of the locked unit SystemID []byte `json:"systemId"` // target system id of the locked unit LockReason LockReason `json:"lockReason"` // reason for locking the bill Transactions []*Transaction `json:"transactions"` // transactions that must be confirmed/failed in order to unlock the bill }
func NewLockedUnit ¶
func NewLockedUnit(accountID, unitID, txHash, systemID []byte, lockReason LockReason, transactions ...*Transaction) *LockedUnit
type Transaction ¶
type Transaction struct { TxOrder *types.TransactionOrder `json:"txOrder"` TxHash []byte `json:"txHash"` }
func NewTransaction ¶
func NewTransaction(txo *types.TransactionOrder) *Transaction
type UnitLocker ¶
type UnitLocker struct {
// contains filtered or unexported fields
}
func NewUnitLocker ¶
func NewUnitLocker(dir string) (*UnitLocker, error)
func (*UnitLocker) Close ¶
func (l *UnitLocker) Close() error
func (*UnitLocker) GetUnit ¶
func (l *UnitLocker) GetUnit(accountID, unitID []byte) (*LockedUnit, error)
func (*UnitLocker) GetUnits ¶
func (l *UnitLocker) GetUnits(accountID []byte) ([]*LockedUnit, error)
func (*UnitLocker) LockUnit ¶
func (l *UnitLocker) LockUnit(unit *LockedUnit) error
func (*UnitLocker) UnlockUnit ¶
func (l *UnitLocker) UnlockUnit(accountID, unitID []byte) error
type UnitStore ¶
type UnitStore interface { GetUnit(accountID, unitID []byte) (*LockedUnit, error) GetUnits(accountID []byte) ([]*LockedUnit, error) PutUnit(unit *LockedUnit) error DeleteUnit(accountID, unitID []byte) error Close() error }
Click to show internal directories.
Click to hide internal directories.