store

package
v0.38.0-rc.3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2025 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

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

func (c *Cache[K, V]) Get(r storage.Reader, key K) (V, error)

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

func (c *Cache[K, V]) IsCached(key K) bool

IsCached returns true if the key exists in the cache. It DOES NOT check whether the key exists in the underlying data store.

func (*Cache[K, V]) PutTx

func (c *Cache[K, V]) PutTx(rw storage.ReaderBatchWriter, key K, resource V) error

PutTx will return tx which adds a resource to the cache with the given ID.

func (*Cache[K, V]) Remove

func (c *Cache[K, V]) Remove(key K)

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

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

Jump to

Keyboard shortcuts

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