lcstore

package
v1.3.0-rc.1 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxTrials        = 5
	DelayBeforeRetry = 500 * time.Millisecond
)
View Source
const GetBlockMaxDuration = time.Minute * 2
View Source
const GetBlockRetryDelay = time.Second * 2

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"`
}

type Database

type Database interface {
	GetBlockJSONByHeight(h int, unconfirmed bool) ([]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)
	GetTPS() float32
	Close() error
}

func NewMergedDB added in v0.9.10

func NewMergedDB(dbs []Database) Database

func OpenLevelDB

func OpenLevelDB(dir string) (Database, error)

func OpenNodeDB

func OpenNodeDB(endpoint string, rps int) (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, pre bool) ([]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) GetTPS added in v0.9.10

func (ds *LevelDB) GetTPS() float32

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) Do added in v0.9.10

func (s *NodeDB) Do(method string, param interface{}, res interface{}) (*client.Response, error)

func (*NodeDB) GetBlockJSONByHeight

func (s *NodeDB) GetBlockJSONByHeight(height int, unconfirmed bool) ([]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) GetTPS added in v0.9.10

func (s *NodeDB) GetTPS() float32

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, rps int) (*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) GetVotesByHeight added in v0.9.10

func (lc *Store) GetVotesByHeight(height int) (*blockv0.BlockVoteList, 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