lcstore

package
v0.9.7 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxTrials        = 5
	DelayBeforeRetry = 500 * time.Millisecond
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheConfig

type CacheConfig struct {
	MaxWorkers int `json:"max_workers"`
	MaxBlocks  int `json:"max_blocks"`
	MaxRPS     int `json:"max_rps"`
}

type Database

type Database interface {
	GetBlockJSONByHeight(height int) ([]byte, error)
	GetBlockJSONByID(id []byte) ([]byte, error)
	GetLastBlockJSON() ([]byte, error)
	GetResultJSON(id []byte) ([]byte, error)
	GetTransactionJSON(id []byte) ([]byte, error)
	GetRepsJSONByHash(id []byte) ([]byte, error)
	GetReceiptJSON(id []byte) ([]byte, error)
	Close() error
}

func OpenLevelDB

func OpenLevelDB(dir string) (Database, error)

func OpenNodeDB

func OpenNodeDB(endpoint string) (Database, error)

type ForwardCache

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

func NewForwardCache

func NewForwardCache(store *Store, logger log.Logger, config *CacheConfig) *ForwardCache

func (*ForwardCache) GetBlockByHeight

func (cs *ForwardCache) GetBlockByHeight(height int) (blockv0.Block, error)

func (*ForwardCache) GetReceipt

func (cs *ForwardCache) GetReceipt(id []byte) (module.Receipt, error)

func (*ForwardCache) GetTPS

func (cs *ForwardCache) GetTPS() float32

type LevelDB

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

func (*LevelDB) Close

func (ds *LevelDB) Close() error

func (*LevelDB) GetBlockJSONByHeight

func (ds *LevelDB) GetBlockJSONByHeight(height int) ([]byte, error)

func (*LevelDB) GetBlockJSONByID

func (ds *LevelDB) GetBlockJSONByID(bid []byte) ([]byte, error)

func (*LevelDB) GetLastBlockJSON

func (ds *LevelDB) GetLastBlockJSON() ([]byte, error)

func (*LevelDB) GetReceiptJSON

func (ds *LevelDB) GetReceiptJSON(id []byte) ([]byte, error)

func (*LevelDB) GetRepsJSONByHash

func (ds *LevelDB) GetRepsJSONByHash(id []byte) ([]byte, error)

func (*LevelDB) GetResultJSON

func (ds *LevelDB) GetResultJSON(id []byte) ([]byte, error)

func (*LevelDB) GetTransactionJSON

func (ds *LevelDB) GetTransactionJSON(id []byte) ([]byte, error)

type NodeDB

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

func (*NodeDB) Close

func (s *NodeDB) Close() error

func (*NodeDB) GetBlockJSONByHeight

func (s *NodeDB) GetBlockJSONByHeight(height int) ([]byte, error)

func (*NodeDB) GetBlockJSONByID

func (s *NodeDB) GetBlockJSONByID(id []byte) ([]byte, error)

func (*NodeDB) GetLastBlockJSON

func (s *NodeDB) GetLastBlockJSON() ([]byte, error)

func (*NodeDB) GetReceiptJSON

func (s *NodeDB) GetReceiptJSON(id []byte) ([]byte, error)

func (*NodeDB) GetRepsJSONByHash

func (s *NodeDB) GetRepsJSONByHash(id []byte) ([]byte, error)

func (*NodeDB) GetResultJSON

func (s *NodeDB) GetResultJSON(id []byte) ([]byte, error)

func (*NodeDB) GetTransactionJSON

func (s *NodeDB) GetTransactionJSON(id []byte) ([]byte, error)

type Store

type Store struct {
	Database
	ReceiptRevision module.Revision
	ReceiptDatabase db.Database
}

func OpenStore

func OpenStore(blockuri string) (*Store, error)

func (*Store) GetBlockByHeight

func (lc *Store) GetBlockByHeight(height int) (blockv0.Block, error)

func (*Store) GetLastBlock

func (lc *Store) GetLastBlock() (blockv0.Block, error)

func (*Store) GetReceipt

func (lc *Store) GetReceipt(id []byte) (module.Receipt, error)

func (*Store) GetRepsByHash

func (lc *Store) GetRepsByHash(id []byte) (*blockv0.RepsList, error)

func (*Store) GetResult

func (lc *Store) GetResult(id []byte) (*TransactionInfo, error)

func (*Store) GetTransaction

func (lc *Store) GetTransaction(id []byte) (*blockv0.Transaction, error)

func (*Store) SetReceiptParameter

func (lc *Store) SetReceiptParameter(dbase db.Database, rev module.Revision)

type TransactionInfo

type TransactionInfo struct {
	BlockID     common.HexBytes     `json:"block_hash"`
	BlockHeight int                 `json:"block_height"`
	TxIndex     common.HexInt32     `json:"tx_index"`
	Transaction blockv0.Transaction `json:"transaction"`
	Receipt     json.RawMessage     `json:"receipt"`
	Result      json.RawMessage     `json:"result"`
}

Jump to

Keyboard shortcuts

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