Documentation
¶
Index ¶
- func NewMetaDataPool(metaBlocks storage.Cacher, ...) (*metaDataPool, error)
- func NewShardedDataPool(transactions dataRetriever.ShardedDataCacherNotifier, headers storage.Cacher, ...) (*shardedDataPool, error)
- type NonceToHashCacher
- func (nthc *NonceToHashCacher) Clear()
- func (nthc *NonceToHashCacher) Get(nonce uint64) ([]byte, bool)
- func (nthc *NonceToHashCacher) Has(nonce uint64) bool
- func (nthc *NonceToHashCacher) HasOrAdd(nonce uint64, hash []byte) (ok, evicted bool)
- func (nthc *NonceToHashCacher) Keys() []uint64
- func (nthc *NonceToHashCacher) Len() int
- func (nthc *NonceToHashCacher) Peek(nonce uint64) ([]byte, bool)
- func (nthc *NonceToHashCacher) Put(nonce uint64, hash []byte) (evicted bool)
- func (nthc *NonceToHashCacher) RegisterHandler(handler func(nonce uint64))
- func (nthc *NonceToHashCacher) Remove(nonce uint64)
- func (nthc *NonceToHashCacher) RemoveOldest()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMetaDataPool ¶
func NewMetaDataPool( metaBlocks storage.Cacher, miniBlockHashes dataRetriever.ShardedDataCacherNotifier, shardHeaders storage.Cacher, metaBlockNonces dataRetriever.Uint64Cacher, ) (*metaDataPool, error)
NewMetaDataPool creates a data pools holder object
func NewShardedDataPool ¶
func NewShardedDataPool( transactions 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 ¶
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 ¶
func NewNonceToHashCacher( cacher storage.Cacher, nonceConverter typeConverters.Uint64ByteSliceConverter) (*NonceToHashCacher, error)
NewNonceToHashCacher returns a new instance of NonceToHashCacher
func (*NonceToHashCacher) Clear ¶
func (nthc *NonceToHashCacher) Clear()
Clear is used to completely clear the cache.
func (*NonceToHashCacher) Get ¶
func (nthc *NonceToHashCacher) Get(nonce uint64) ([]byte, bool)
Get looks up for a nonce in cache.
func (*NonceToHashCacher) Has ¶
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 ¶
func (nthc *NonceToHashCacher) HasOrAdd(nonce uint64, hash []byte) (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 ¶
func (nthc *NonceToHashCacher) Keys() []uint64
Keys returns a slice of nonces from the cache, from oldest to newest.
func (*NonceToHashCacher) Len ¶
func (nthc *NonceToHashCacher) Len() int
Len returns the number of items in the cache.
func (*NonceToHashCacher) Peek ¶
func (nthc *NonceToHashCacher) Peek(nonce uint64) ([]byte, bool)
Peek returns the nonce value (or nil if not found) without updating the "recently used"-ness of the nonce.
func (*NonceToHashCacher) Put ¶
func (nthc *NonceToHashCacher) Put(nonce uint64, hash []byte) (evicted bool)
Put adds a value to the cache. Returns true if an eviction occurred.
func (*NonceToHashCacher) RegisterHandler ¶
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 ¶
func (nthc *NonceToHashCacher) Remove(nonce uint64)
Remove removes the provided nonce from the cache.
func (*NonceToHashCacher) RemoveOldest ¶
func (nthc *NonceToHashCacher) RemoveOldest()
RemoveOldest removes the oldest item from the cache.