store

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	BKTHeaders  = []byte("H")
	BKTIndexes  = []byte("I")
	BKTChainTip = []byte("B")
)
View Source
var (
	BKTQue    = []byte("Q")
	BKTQueIdx = []byte("U")
)
View Source
var (
	BKTTxs       = []byte("T")
	BKTHeightTxs = []byte("H")
	BKTForkTxs   = []byte("F")
)
View Source
var (
	BKTAddrs = []byte("A")
)
View Source
var (
	BKTOps = []byte("O")
)

Functions

func NewAddrs

func NewAddrs(db *leveldb.DB) (*addrs, error)

func NewDataStore

func NewDataStore(dataDir string) (*dataStore, error)

func NewHeaderStore

func NewHeaderStore(dataDir string, newHeader func() util.BlockHeader) (*headers, error)

func NewOps

func NewOps(db *leveldb.DB) *ops

func NewQue

func NewQue(db *leveldb.DB) *que

func NewTxs

func NewTxs(db *leveldb.DB) *txs

Types

type Addrs

type Addrs interface {
	database.DB
	GetFilter() *sdk.AddrFilter
	Put(addr *common.Uint168) error
	GetAll() []*common.Uint168
}

type DataBatch

type DataBatch interface {
	Txs() TxsBatch
	Ops() OpsBatch
	Que() QueBatch
	// Delete all transactions, ops, queued items on
	// the given height.
	DelAll(height uint32) error
	// contains filtered or unexported methods
}

type DataStore

type DataStore interface {
	database.DB
	Addrs() Addrs
	Txs() Txs
	Ops() Ops
	Que() Que
	Batch() DataBatch
}

type HeaderStore

type HeaderStore interface {
	database.Headers
	GetByHeight(height uint32) (header *util.Header, err error)
}

type Ops

type Ops interface {
	database.DB
	Put(*util.OutPoint, common.Uint168) error
	HaveOp(*util.OutPoint) *common.Uint168
	GetAll() ([]*util.OutPoint, error)
	Batch() OpsBatch
}

type OpsBatch

type OpsBatch interface {
	Put(*util.OutPoint, common.Uint168) error
	Del(*util.OutPoint) error
	// contains filtered or unexported methods
}

type Que

type Que interface {
	database.DB

	// Put a queue item to database
	Put(item *QueItem) error

	// Get all items in queue
	GetAll() ([]*QueItem, error)

	// Delete confirmed item in queue
	Del(notifyId, txHash *common.Uint256) error

	// Batch returns a queue batch instance.
	Batch() QueBatch
}

type QueBatch

type QueBatch interface {

	// Put a queue item to database
	Put(item *QueItem) error

	// Delete confirmed item in queue
	Del(notifyId, txHash *common.Uint256) error

	// Delete all items on the given height.
	DelAll(height uint32) error
	// contains filtered or unexported methods
}

type QueItem

type QueItem struct {
	NotifyId   common.Uint256
	TxId       common.Uint256
	Height     uint32
	LastNotify time.Time
}

type Txs

type Txs interface {
	database.DB
	Put(tx *util.Tx) error
	Get(txId *common.Uint256) (*util.Tx, error)
	GetAll() ([]*util.Tx, error)
	GetIds(height uint32) ([]*common.Uint256, error)
	PutForkTxs(txs []*util.Tx, hash *common.Uint256) error
	GetForkTxs(hash *common.Uint256) ([]*util.Tx, error)
	Del(txId *common.Uint256) error
	Batch() TxsBatch
}

type TxsBatch

type TxsBatch interface {
	Put(tx *util.Tx) error
	Del(txId *common.Uint256) error
	DelAll(height uint32) error
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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