dataPool

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2019 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMetaDataPool added in v1.0.3

func NewMetaDataPool(
	metaBlocks storage.Cacher,
	miniBlockHashes dataRetriever.ShardedDataCacherNotifier,
	shardHeaders storage.Cacher,
	metaBlockNonces dataRetriever.Uint64Cacher,
	shardHeadersNonces dataRetriever.Uint64Cacher,
) (*metaDataPool, error)

NewMetaDataPool creates a data pools holder object

func NewShardedDataPool added in v1.0.3

func NewShardedDataPool(
	transactions dataRetriever.ShardedDataCacherNotifier,
	smartContractResults dataRetriever.ShardedDataCacherNotifier,
	headers storage.Cacher,
	hdrNonces dataRetriever.Uint64Cacher,
	miniBlocks storage.Cacher,
	peerChangesBlocks storage.Cacher,
	metaBlocks storage.Cacher,
	metaHdrNonces dataRetriever.Uint64Cacher,
) (*shardedDataPool, error)

NewShardedDataPool creates a data pools holder object

Types

type NonceToHashCacher added in v1.0.3

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

NonceToHashCacher is a wrapper over a storage.Cacher interface that has the key of type uint64 and value of type byte slice

func NewNonceToHashCacher added in v1.0.3

func NewNonceToHashCacher(
	cacher storage.Cacher,
	nonceConverter typeConverters.Uint64ByteSliceConverter) (*NonceToHashCacher, error)

NewNonceToHashCacher returns a new instance of NonceToHashCacher

func (*NonceToHashCacher) Clear added in v1.0.3

func (nthc *NonceToHashCacher) Clear()

Clear is used to completely clear the cache.

func (*NonceToHashCacher) Get added in v1.0.3

func (nthc *NonceToHashCacher) Get(nonce uint64) (interface{}, bool)

Get looks up for a nonce in cache.

func (*NonceToHashCacher) Has added in v1.0.3

func (nthc *NonceToHashCacher) Has(nonce uint64) bool

Has checks if a nonce is in the cache, without updating the recent-ness or deleting it for being stale.

func (*NonceToHashCacher) HasOrAdd added in v1.0.3

func (nthc *NonceToHashCacher) HasOrAdd(nonce uint64, data interface{}) (ok, evicted bool)

HasOrAdd checks if a nonce is in the cache without updating the recent-ness or deleting it for being stale, and if not, adds the hash. Returns whether found and whether an eviction occurred.

func (*NonceToHashCacher) Keys added in v1.0.3

func (nthc *NonceToHashCacher) Keys() []uint64

Keys returns a slice of nonces from the cache, from oldest to newest.

func (*NonceToHashCacher) Len added in v1.0.3

func (nthc *NonceToHashCacher) Len() int

Len returns the number of items in the cache.

func (*NonceToHashCacher) Peek added in v1.0.3

func (nthc *NonceToHashCacher) Peek(nonce uint64) (interface{}, bool)

Peek returns the nonce value (or nil if not found) without updating the "recently used"-ness of the nonce.

func (*NonceToHashCacher) Put added in v1.0.3

func (nthc *NonceToHashCacher) Put(nonce uint64, data interface{}) (evicted bool)

Put adds a value to the cache. Returns true if an eviction occurred.

func (*NonceToHashCacher) RegisterHandler added in v1.0.3

func (nthc *NonceToHashCacher) RegisterHandler(handler func(nonce uint64))

RegisterHandler registers a new handler to be called when a new data is added

func (*NonceToHashCacher) Remove added in v1.0.3

func (nthc *NonceToHashCacher) Remove(nonce uint64)

Remove removes the provided nonce from the cache.

func (*NonceToHashCacher) RemoveOldest added in v1.0.3

func (nthc *NonceToHashCacher) RemoveOldest()

RemoveOldest removes the oldest item from the cache.

Jump to

Keyboard shortcuts

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