db

package
v1.7.0-alpha Latest Latest
Warning

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

Go to latest
Published: May 23, 2019 License: LGPL-3.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenBestBlockHeaderKey

func GenBestBlockHeaderKey() *pool.ByteBuffer

func GenDataTransactionKey

func GenDataTransactionKey(hash common.Uint256) *pool.ByteBuffer

func GenGenesisBlockKey

func GenGenesisBlockKey() *pool.ByteBuffer

Types

type BestBlock

type BestBlock struct {
	Height uint32
	Hash   common.Uint256
}

type BestStateProvider

type BestStateProvider interface {
	GetBestBlock() (BestBlock, error)
	GetBestHeader() (*types.Header, error)
}

type KeyPrefix

type KeyPrefix byte

DataEntryPrefix

const (
	//SYSTEM
	SYS_VERSION       KeyPrefix = 0
	SYS_GENESIS_BLOCK KeyPrefix = 1 // key: prefix, value: gensisBlock

	SYS_BEST_BLOCK        KeyPrefix = 2 // key : prefix, value: bestblock
	SYS_BEST_BLOCK_HEADER KeyPrefix = 3 // key: prefix, value: BlockHeader

	// DATA
	//DATA_Block KeyPrefix = iota
	//DATA_Header
	DATA_TRANSACTION KeyPrefix = 10 // key: prefix+txid, value: height + tx
)

type Store

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

func NewStore

func NewStore(path string) (*Store, error)

func (*Store) Close

func (self *Store) Close() error

func (*Store) ContainTransaction

func (self *Store) ContainTransaction(hash common.Uint256) bool

implement TransactionProvider interface

func (*Store) GetBestBlock

func (self *Store) GetBestBlock() (BestBlock, error)

func (*Store) GetBestHeader

func (self *Store) GetBestHeader() (*types.Header, error)

func (*Store) GetTransaction

func (self *Store) GetTransaction(hash common.Uint256) (*types.Transaction, error)

func (*Store) GetTransactionBytes

func (self *Store) GetTransactionBytes(hash common.Uint256) ([]byte, error)

func (*Store) PersistBlock

func (self *Store) PersistBlock(block *types.Block) error

type TransactionProvider

type TransactionProvider interface {
	BestStateProvider
	ContainTransaction(hash common.Uint256) bool
	GetTransactionBytes(hash common.Uint256) ([]byte, error)
	GetTransaction(hash common.Uint256) (*types.Transaction, error)
	PersistBlock(block *types.Block) error
}

Jump to

Keyboard shortcuts

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