Documentation ¶
Index ¶
- Constants
- func MarshalMovementRecord(movementRecord *MovementRecord) ([]byte, error)
- func MarshalTokenRequest(mr *TokenRequest) ([]byte, error)
- func MarshalTransactionRecord(txnRecord *TransactionRecord) ([]byte, error)
- func MarshalValidationRecord(mr *ValidationRecord) ([]byte, error)
- type Driver
- type MovementRecord
- type MovementSelector
- type Opts
- type Persistence
- func (db *Persistence) AddMovement(record *driver.MovementRecord) error
- func (db *Persistence) AddTokenRequest(txID string, tr []byte) error
- func (db *Persistence) AddTransaction(record *driver.TransactionRecord) error
- func (db *Persistence) AddValidationRecord(txID string, tr []byte, meta map[string][]byte) error
- func (db *Persistence) BeginUpdate() error
- func (db *Persistence) Close() error
- func (db *Persistence) Commit() error
- func (db *Persistence) Discard() error
- func (db *Persistence) GetStatus(txID string) (driver.TxStatus, error)
- func (db *Persistence) GetTokenRequest(txID string) ([]byte, error)
- func (db *Persistence) QueryMovements(params driver.QueryMovementsParams) ([]*driver.MovementRecord, error)
- func (db *Persistence) QueryTransactions(params driver.QueryTransactionsParams) (driver.TransactionIterator, error)
- func (db *Persistence) QueryValidations(params driver.QueryValidationRecordsParams) (driver.ValidationRecordsIterator, error)
- func (db *Persistence) SetStatus(txID string, status driver.TxStatus) error
- type RecordSlice
- type TokenRequest
- type TransactionIterator
- type TransactionRecord
- type TransactionRecordSelector
- type TransactionSelector
- type ValidationRecord
- type ValidationRecordSelector
- type ValidationRecordsIterator
- type ValidationRecordsSelector
Constants ¶
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 )
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 MarshalTokenRequest ¶ added in v0.3.0
func MarshalTokenRequest(mr *TokenRequest) ([]byte, error)
MarshalTokenRequest marshals a TokenRequest into a byte array
func MarshalTransactionRecord ¶
func MarshalTransactionRecord(txnRecord *TransactionRecord) ([]byte, error)
MarshalTransactionRecord marshals a TransactionRecord into a byte array
func MarshalValidationRecord ¶ added in v0.3.0
func MarshalValidationRecord(mr *ValidationRecord) ([]byte, error)
MarshalValidationRecord marshals a ValidationRecord 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) AddTokenRequest ¶ added in v0.3.0
func (db *Persistence) AddTokenRequest(txID string, tr []byte) error
func (*Persistence) AddTransaction ¶
func (db *Persistence) AddTransaction(record *driver.TransactionRecord) error
func (*Persistence) AddValidationRecord ¶ added in v0.3.0
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) GetStatus ¶ added in v0.3.0
func (db *Persistence) GetStatus(txID string) (driver.TxStatus, error)
func (*Persistence) GetTokenRequest ¶ added in v0.3.0
func (db *Persistence) GetTokenRequest(txID string) ([]byte, 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)
func (*Persistence) QueryValidations ¶ added in v0.3.0
func (db *Persistence) QueryValidations(params driver.QueryValidationRecordsParams) (driver.ValidationRecordsIterator, 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 TokenRequest ¶ added in v0.3.0
func UnmarshalTokenRequest ¶ added in v0.3.0
func UnmarshalTokenRequest(data []byte) (*TokenRequest, error)
UnmarshalTokenRequest unmarshals a TokenRequest from a byte array
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.
type ValidationRecord ¶ added in v0.3.0
type ValidationRecord struct { Id uint64 Record *driver.ValidationRecord }
func UnmarshalValidationRecord ¶ added in v0.3.0
func UnmarshalValidationRecord(data []byte) (*ValidationRecord, error)
UnmarshalValidationRecord unmarshals a ValidationRecord from a byte array
type ValidationRecordSelector ¶ added in v0.3.0
type ValidationRecordSelector interface {
Select(record *ValidationRecord) (bool, bool)
}
type ValidationRecordsIterator ¶ added in v0.3.0
type ValidationRecordsIterator struct {
// contains filtered or unexported fields
}
func (*ValidationRecordsIterator) Close ¶ added in v0.3.0
func (t *ValidationRecordsIterator) Close()
func (*ValidationRecordsIterator) Next ¶ added in v0.3.0
func (t *ValidationRecordsIterator) Next() (*driver.ValidationRecord, error)
type ValidationRecordsSelector ¶ added in v0.3.0
type ValidationRecordsSelector struct {
// contains filtered or unexported fields
}
ValidationRecordsSelector is used to select a set of transaction records
func (*ValidationRecordsSelector) Select ¶ added in v0.3.0
func (t *ValidationRecordsSelector) Select(record *ValidationRecord) (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.