Documentation
¶
Index ¶
- type Cache
- type ChunkDataPacks
- func (ch *ChunkDataPacks) BatchRemove(chunkID flow.Identifier, rw storage.ReaderBatchWriter) error
- func (ch *ChunkDataPacks) BatchStore(c *flow.ChunkDataPack, rw storage.ReaderBatchWriter) error
- func (ch *ChunkDataPacks) ByChunkID(chunkID flow.Identifier) (*flow.ChunkDataPack, error)
- func (ch *ChunkDataPacks) Remove(chunkIDs []flow.Identifier) error
- func (ch *ChunkDataPacks) Store(cs []*flow.ChunkDataPack) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[K comparable, V any] struct { // contains filtered or unexported fields }
func (*Cache[K, V]) Get ¶
Get will try to retrieve the resource from cache first, and then from the injected. During normal operations, the following error returns are expected:
- `storage.ErrNotFound` if key is unknown.
func (*Cache[K, V]) Insert ¶
func (c *Cache[K, V]) Insert(key K, resource V)
Insert will add a resource directly to the cache with the given ID
func (*Cache[K, V]) IsCached ¶
IsCached returns true if the key exists in the cache. It DOES NOT check whether the key exists in the underlying data store.
type ChunkDataPacks ¶
type ChunkDataPacks struct {
// contains filtered or unexported fields
}
func NewChunkDataPacks ¶
func NewChunkDataPacks(collector module.CacheMetrics, db storage.DB, collections storage.Collections, byChunkIDCacheSize uint) *ChunkDataPacks
func (*ChunkDataPacks) BatchRemove ¶
func (ch *ChunkDataPacks) BatchRemove(chunkID flow.Identifier, rw storage.ReaderBatchWriter) error
BatchRemove removes ChunkDataPack c keyed by its ChunkID in provided batch No errors are expected during normal operation, even if no entries are matched. If Badger unexpectedly fails to process the request, the error is wrapped in a generic error and returned.
func (*ChunkDataPacks) BatchStore ¶
func (ch *ChunkDataPacks) BatchStore(c *flow.ChunkDataPack, rw storage.ReaderBatchWriter) error
BatchStore stores ChunkDataPack c keyed by its ChunkID in provided batch. No errors are expected during normal operation, but it may return generic error if entity is not serializable or Badger unexpectedly fails to process request
func (*ChunkDataPacks) ByChunkID ¶
func (ch *ChunkDataPacks) ByChunkID(chunkID flow.Identifier) (*flow.ChunkDataPack, error)
func (*ChunkDataPacks) Remove ¶
func (ch *ChunkDataPacks) Remove(chunkIDs []flow.Identifier) error
Remove removes multiple ChunkDataPacks cs keyed by their ChunkIDs in a batch. No errors are expected during normal operation, even if no entries are matched.
func (*ChunkDataPacks) Store ¶
func (ch *ChunkDataPacks) Store(cs []*flow.ChunkDataPack) error
Store stores multiple ChunkDataPacks cs keyed by their ChunkIDs in a batch. No errors are expected during normal operation, but it may return generic error