Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrSerialization occurs when a type cannot be serialized correctly ErrSerialization = errors.New("error serializing type") // ErrDeserialization occurs when a type cannot be deserialized correctly ErrDeserialization = errors.New("error deserializing type") // ErrBackend occurs when there is an error in the backend ErrBackend = errors.New("error in backend") )
Functions ¶
This section is empty.
Types ¶
type BadgerBackend ¶
type BadgerBackend struct {
DB *badger.DB
}
BadgerBackend Badger backend implementation
func NewBadgerBackend ¶
func NewBadgerBackend(opts badger.Options) *BadgerBackend
NewBadgerBackend BadgerBackend constructor
func (*BadgerBackend) Get ¶
func (backend *BadgerBackend) Get(key []byte) ([]byte, error)
Get backend getter
func (*BadgerBackend) Put ¶
func (backend *BadgerBackend) Put(key, value []byte) error
Put backend setter
type KoinosBadgerLogger ¶
type KoinosBadgerLogger struct { }
KoinosBadgerLogger implements the badger.Logger interface in roder to pass badger logs the the koinos logger
func (KoinosBadgerLogger) Debugf ¶
func (kbl KoinosBadgerLogger) Debugf(msg string, args ...interface{})
Debugf implements formatted debug message handling for badger
func (KoinosBadgerLogger) Errorf ¶
func (kbl KoinosBadgerLogger) Errorf(msg string, args ...interface{})
Errorf implements formatted error message handling for badger
func (KoinosBadgerLogger) Infof ¶
func (kbl KoinosBadgerLogger) Infof(msg string, args ...interface{})
Infof implements formatted info message handling for badger
func (KoinosBadgerLogger) Warningf ¶
func (kbl KoinosBadgerLogger) Warningf(msg string, args ...interface{})
Warningf implements formatted warning message handling for badger
type MapBackend ¶
type MapBackend struct {
// contains filtered or unexported fields
}
MapBackend implements a key-value store backed by a simple map
func NewMapBackend ¶
func NewMapBackend() *MapBackend
NewMapBackend creates and returns a reference to a map backend instance
func (*MapBackend) Get ¶
func (backend *MapBackend) Get(key []byte) ([]byte, error)
Get fetches the requested value from the database
type TransactionStore ¶
type TransactionStore struct {
// contains filtered or unexported fields
}
TransactionStore contains a backend object and handles requests
func NewTransactionStore ¶
func NewTransactionStore(backend TransactionStoreBackend) *TransactionStore
NewTransactionStore creates a new TransactionStore wrapping the provided backend
func (*TransactionStore) AddIncludedTransaction ¶
func (handler *TransactionStore) AddIncludedTransaction(tx *protocol.Transaction, topology *koinos.BlockTopology) error
AddIncludedTransaction adds a transaction to with the associated block topology
func (*TransactionStore) GetTransactionsByID ¶
func (handler *TransactionStore) GetTransactionsByID(trxIDs [][]byte) ([]*transaction_store.TransactionItem, error)
GetTransactionsByID returns transactions by transaction ID
type TransactionStoreBackend ¶
type TransactionStoreBackend interface { /** * Store the given value in the given key. */ Put(key []byte, value []byte) error /** * Get a previously stored value. * * If the key is not found, returns (nil, nil). */ Get(key []byte) ([]byte, error) // Resets the entire database Reset() error }
TransactionStoreBackend interface defines an abstract key-value store