badger

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

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 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

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 Opts

type Opts struct {
	Path string
}

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 (db *Persistence) AddValidationRecord(txID string, tr []byte, meta map[string][]byte) 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) 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 (*Persistence) SetStatus

func (db *Persistence) SetStatus(txID string, status driver.TxStatus) 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

type TokenRequest struct {
	TxID string
	TR   []byte
}

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

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

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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