database

package
v0.0.0-...-79d14b3 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2015 License: MIT Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB struct {
	// contains filtered or unexported fields
}

func Open

func Open() *DB

func (*DB) Close

func (db *DB) Close()

func (*DB) Get

func (db *DB) Get(key []byte, data interface{}) error

func (*DB) LoadAllTransactions

func (db *DB) LoadAllTransactions() []*inventory.TxVersion

LoadAllTransactions loads data with keys on the format "tx:HHHH", where HHHH is a hexadecimal counter, until no data is found for a value of the counter. This is considered to be all stored transactions. It does not check for duplicates. If duplicates are found, the later one should be used. TODO Find a better way to store transactions.

func (*DB) Set

func (db *DB) Set(key []byte, data interface{})

func (*DB) StoreNewTransaction

func (db *DB) StoreNewTransaction(tx *inventory.TxVersion)

Only call after LoadAllTransactions has completed. Due to how difficult it is to update transactions after the fact, duplicates storage of the same transaction is fine as long as they are incrementally more complete/correct.

Jump to

Keyboard shortcuts

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