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
- type ConsumerProgressInitializer
- type ResultApprovals
- func (r *ResultApprovals) ByChunk(resultID flow.Identifier, chunkIndex uint64) (*flow.ResultApproval, error)
- func (r *ResultApprovals) ByID(approvalID flow.Identifier) (*flow.ResultApproval, error)
- func (r *ResultApprovals) Index(resultID flow.Identifier, chunkIndex uint64, approvalID flow.Identifier) error
- func (r *ResultApprovals) Store(approval *flow.ResultApproval) 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
type ConsumerProgressInitializer ¶
type ConsumerProgressInitializer struct {
// contains filtered or unexported fields
}
ConsumerProgressInitializer is a helper to initialize the consumer progress index in storage It prevents the consumer from being used before initialization
func NewConsumerProgress ¶
func NewConsumerProgress(db storage.DB, consumer string) *ConsumerProgressInitializer
func (*ConsumerProgressInitializer) Initialize ¶
func (cpi *ConsumerProgressInitializer) Initialize(defaultIndex uint64) (storage.ConsumerProgress, error)
type ResultApprovals ¶
type ResultApprovals struct {
// contains filtered or unexported fields
}
ResultApprovals implements persistent storage for result approvals.
CAUTION suitable only for _Verification Nodes_ for persisting their _own_ approvals!
- In general, the Flow protocol requires multiple approvals for the same chunk from different verification nodes. In other words, there are multiple different approvals for the same chunk.
- Internally, ResultApprovals populates an index from Executed Chunk ➜ ResultApproval. This is *only safe* for Verification Nodes when tracking their own approvals (for the same ExecutionResult, a Verifier will always produce the same approval)
func NewResultApprovals ¶
func NewResultApprovals(collector module.CacheMetrics, db storage.DB) *ResultApprovals
func (*ResultApprovals) ByChunk ¶
func (r *ResultApprovals) ByChunk(resultID flow.Identifier, chunkIndex uint64) (*flow.ResultApproval, error)
ByChunk retrieves a ResultApproval by result ID and chunk index. The ResultApprovals store is only used within a verification node, where it is assumed that there is never more than one approval per chunk.
func (*ResultApprovals) ByID ¶
func (r *ResultApprovals) ByID(approvalID flow.Identifier) (*flow.ResultApproval, error)
ByID retrieves a ResultApproval by its ID
func (*ResultApprovals) Index ¶
func (r *ResultApprovals) Index(resultID flow.Identifier, chunkIndex uint64, approvalID flow.Identifier) error
Index indexes a ResultApproval by chunk (ResultID + chunk index). This operation is idempotent (repeated calls with the same value are equivalent to just calling the method once; still the method succeeds on each call).
CAUTION: the Flow protocol requires multiple approvals for the same chunk from different verification nodes. In other words, there are multiple different approvals for the same chunk. Therefore, the index Executed Chunk ➜ ResultApproval ID (populated here) is *only safe* to be used by Verification Nodes for tracking their own approvals.
func (*ResultApprovals) Store ¶
func (r *ResultApprovals) Store(approval *flow.ResultApproval) error
Store stores a ResultApproval