store

package
v0.3.1-account Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultStoreCacheSize defines the amount of max entries allowed in the Header Store cache.
	DefaultStoreCacheSize = 4096
	// DefaultIndexCacheSize defines the amount of max entries allowed in the Height to Hash index cache.
	DefaultIndexCacheSize = 16384
	// DefaultWriteBatchSize defines the size of the batched header write.
	// Headers are written in batches not to thrash the underlying Datastore with writes.
	DefaultWriteBatchSize = 2048
)

TODO(@Wondertan): Those values must be configurable and proper defaults should be set for specific node type. (#709)

Functions

func Init

func Init(ctx context.Context, store header.Store, ex header.Exchange, hash tmbytes.HexBytes) error

Init ensures a Store is initialized. If it is not already initialized, it initializes the Store by requesting the header with the given hash.

func NewStore

func NewStore(ds datastore.Batching) (header.Store, error)

NewStore constructs a Store over datastore. The datastore must have a head there otherwise Start will error. For first initialization of Store use NewStoreWithHead.

func NewStoreWithHead

func NewStoreWithHead(ctx context.Context, ds datastore.Batching, head *header.ExtendedHeader) (header.Store, error)

NewStoreWithHead initiates a new Store and forcefully sets a given trusted header as head.

func NewTestStore

func NewTestStore(ctx context.Context, t *testing.T, head *header.ExtendedHeader) header.Store

NewTestStore creates initialized and started in memory header Store which is useful for testing.

Types

This section is empty.

Jump to

Keyboard shortcuts

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