badger

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: Apache-2.0 Imports: 16 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 MarshalTransactionRecord

func MarshalTransactionRecord(txnRecord *TransactionRecord) ([]byte, error)

MarshalTransactionRecord marshals a TransactionRecord 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) 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)

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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