Documentation
¶
Index ¶
- Constants
- func MarshalMovementRecord(movementRecord *MovementRecord) ([]byte, error)
- func MarshalTransactionRecord(txnRecord *TransactionRecord) ([]byte, error)
- type Driver
- type MovementRecord
- type MovementSelector
- type Opts
- type Persistence
- func (db *Persistence) AddMovement(record *driver.MovementRecord) error
- func (db *Persistence) AddTransaction(record *driver.TransactionRecord) error
- func (db *Persistence) BeginUpdate() error
- func (db *Persistence) Close() error
- func (db *Persistence) Commit() error
- func (db *Persistence) Discard() error
- func (db *Persistence) QueryMovements(params driver.QueryMovementsParams) ([]*driver.MovementRecord, error)
- func (db *Persistence) QueryTransactions(params driver.QueryTransactionsParams) (driver.TransactionIterator, error)
- func (db *Persistence) SetStatus(txID string, status driver.TxStatus) error
- type RecordSlice
- type TransactionIterator
- type TransactionRecord
- type TransactionRecordSelector
- type TransactionSelector
Constants ¶
View Source
const ( // SeqBandwidth sets the size of the lease, determining how many Next() requests can be served from memory SeqBandwidth = 10 // IndexLength is the length of the index used to store the sequence IndexLength = 26 // DefaultNumGoStream is the default number of goroutines used to process the DB streams DefaultNumGoStream = 16 )
View Source
const (
// OptsKey is the key for the opts in the config
OptsKey = "token.ttxdb.persistence.opts"
)
Variables ¶
This section is empty.
Functions ¶
func MarshalMovementRecord ¶
func MarshalMovementRecord(movementRecord *MovementRecord) ([]byte, error)
MarshalMovementRecord marshals a MovementRecord into a byte array
func MarshalTransactionRecord ¶
func MarshalTransactionRecord(txnRecord *TransactionRecord) ([]byte, error)
MarshalTransactionRecord marshals a TransactionRecord into a byte array
Types ¶
type Driver ¶
type Driver struct { }
func (Driver) Open ¶
func (d Driver) Open(sp view2.ServiceProvider, name string) (driver.TokenTransactionDB, error)
type MovementRecord ¶
type MovementRecord struct { Id uint64 Record *driver.MovementRecord }
func UnmarshalMovementRecord ¶
func UnmarshalMovementRecord(data []byte) (*MovementRecord, error)
UnmarshalMovementRecord unmarshals a MovementRecord from a byte array
type MovementSelector ¶
type MovementSelector struct {
// contains filtered or unexported fields
}
MovementSelector is used to select a set of movement records
func (*MovementSelector) Select ¶
func (m *MovementSelector) Select(record *MovementRecord) bool
Select returns true is the record matches the selection criteria
type Persistence ¶
type Persistence struct {
// contains filtered or unexported fields
}
func OpenDB ¶
func OpenDB(path string) (*Persistence, error)
func (*Persistence) AddMovement ¶
func (db *Persistence) AddMovement(record *driver.MovementRecord) error
func (*Persistence) AddTransaction ¶
func (db *Persistence) AddTransaction(record *driver.TransactionRecord) error
func (*Persistence) BeginUpdate ¶
func (db *Persistence) BeginUpdate() error
func (*Persistence) Close ¶
func (db *Persistence) Close() error
func (*Persistence) Commit ¶
func (db *Persistence) Commit() error
func (*Persistence) Discard ¶
func (db *Persistence) Discard() error
func (*Persistence) QueryMovements ¶
func (db *Persistence) QueryMovements(params driver.QueryMovementsParams) ([]*driver.MovementRecord, error)
func (*Persistence) QueryTransactions ¶
func (db *Persistence) QueryTransactions(params driver.QueryTransactionsParams) (driver.TransactionIterator, error)
type RecordSlice ¶
type RecordSlice []*MovementRecord
func (RecordSlice) Len ¶
func (p RecordSlice) Len() int
func (RecordSlice) Less ¶
func (p RecordSlice) Less(i, j int) bool
func (RecordSlice) Swap ¶
func (p RecordSlice) Swap(i, j int)
type TransactionIterator ¶
type TransactionIterator struct {
// contains filtered or unexported fields
}
func (*TransactionIterator) Close ¶
func (t *TransactionIterator) Close()
func (*TransactionIterator) Next ¶
func (t *TransactionIterator) Next() (*driver.TransactionRecord, error)
type TransactionRecord ¶
type TransactionRecord struct { Id uint64 Record *driver.TransactionRecord }
func UnmarshalTransactionRecord ¶
func UnmarshalTransactionRecord(data []byte) (*TransactionRecord, error)
UnmarshalTransactionRecord unmarshals a TransactionRecord from a byte array
type TransactionRecordSelector ¶
type TransactionRecordSelector interface {
Select(record *TransactionRecord) (bool, bool)
}
type TransactionSelector ¶
type TransactionSelector struct {
// contains filtered or unexported fields
}
TransactionSelector is used to select a set of transaction records
func (*TransactionSelector) Select ¶
func (t *TransactionSelector) Select(record *TransactionRecord) (bool, bool)
Select returns true is the record matches the selection criteria. Additionally, it returns another flag indicating if it is time to stop or not.
Click to show internal directories.
Click to hide internal directories.