storage

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Combine

func Combine(ops ...func(*badger.Txn) error) func(*badger.Txn) error

Combine goes through the provided operations until one of them fails. When the first one fails, the related error is returned.

func Fallback

func Fallback(ops ...func(*badger.Txn) error) func(*badger.Txn) error

Fallback goes through the provided operations until one of them succeeds. If all of them fail, a multi-error with all errors is returned.

Types

type Library

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

Library is the storage library.

func New

func New(codec dps.Codec) *Library

New returns a new storage library using the given codec.

func (*Library) IndexCollectionsForHeight

func (l *Library) IndexCollectionsForHeight(height uint64, collIDs []flow.Identifier) func(*badger.Txn) error

IndexCollectionsForHeight is an operation that indexes the height of a slice of collection identifiers.

func (*Library) IndexHeightForBlock

func (l *Library) IndexHeightForBlock(blockID flow.Identifier, height uint64) func(*badger.Txn) error

IndexHeightForBlock is an operation that indexes the given height for its block identifier.

func (*Library) IndexHeightForTransaction added in v1.1.0

func (l *Library) IndexHeightForTransaction(txID flow.Identifier, height uint64) func(*badger.Txn) error

IndexHeightForTransaction is an operation that writes the height a transaction identifier.

func (*Library) IndexSealsForHeight added in v1.1.0

func (l *Library) IndexSealsForHeight(height uint64, sealIDs []flow.Identifier) func(*badger.Txn) error

IndexSealsForHeight is an operation that indexes the height of a slice of seal identifiers.

func (*Library) IndexTransactionsForCollection

func (l *Library) IndexTransactionsForCollection(collID flow.Identifier, txIDs []flow.Identifier) func(*badger.Txn) error

IndexTransactionsForCollection is an operation that indexes the collection identifier to which a slice of transactions belongs.

func (*Library) IndexTransactionsForHeight

func (l *Library) IndexTransactionsForHeight(height uint64, txIDs []flow.Identifier) func(*badger.Txn) error

IndexTransactionsForHeight is an operation that indexes the height of a slice of transaction identifiers.

func (*Library) IterateLedger added in v1.4.0

func (l *Library) IterateLedger(callback func(path ledger.Path, payload *ledger.Payload) error) func(*badger.Txn) error

IterateLedger steps through the entire ledger for ledger keys and payloads and call the given callback for each of them.

func (*Library) LookupCollectionsForHeight

func (l *Library) LookupCollectionsForHeight(height uint64, collIDs *[]flow.Identifier) func(*badger.Txn) error

LookupCollectionsForHeight retrieves the identifiers of collections at the given height.

func (*Library) LookupHeightForBlock

func (l *Library) LookupHeightForBlock(blockID flow.Identifier, height *uint64) func(*badger.Txn) error

LookupHeightForBlock retrieves the height of the given block identifier.

func (*Library) LookupHeightForTransaction added in v1.1.0

func (l *Library) LookupHeightForTransaction(txID flow.Identifier, height *uint64) func(*badger.Txn) error

LookupHeightForTransaction retrieves the height of the transaction with the given identifier.

func (*Library) LookupSealsForHeight added in v1.1.0

func (l *Library) LookupSealsForHeight(height uint64, sealIDs *[]flow.Identifier) func(*badger.Txn) error

LookupSealsForHeight retrieves the identifiers of seals at the given height.

func (*Library) LookupTransactionsForCollection

func (l *Library) LookupTransactionsForCollection(collID flow.Identifier, txIDs *[]flow.Identifier) func(*badger.Txn) error

LookupTransactionsForCollection retrieves the identifiers of transactions within the collection with the given identifier.

func (*Library) LookupTransactionsForHeight

func (l *Library) LookupTransactionsForHeight(height uint64, txIDs *[]flow.Identifier) func(*badger.Txn) error

LookupTransactionsForHeight retrieves the identifiers of transactions at the given height.

func (*Library) RetrieveCollection

func (l *Library) RetrieveCollection(collectionID flow.Identifier, collection *flow.LightCollection) func(*badger.Txn) error

RetrieveCollection retrieves the collection with the given identifier.

func (*Library) RetrieveCommit

func (l *Library) RetrieveCommit(height uint64, commit *flow.StateCommitment) func(*badger.Txn) error

RetrieveCommit retrieves the commit at the given height.

func (*Library) RetrieveEvents

func (l *Library) RetrieveEvents(height uint64, types []flow.EventType, events *[]flow.Event) func(*badger.Txn) error

RetrieveEvents retrieves the events at the given height that match with the specified types. If no types were provided, all events are retrieved.

func (*Library) RetrieveFirst

func (l *Library) RetrieveFirst(height *uint64) func(*badger.Txn) error

RetrieveFirst retrieves the first indexed height.

func (*Library) RetrieveGuarantee added in v1.1.0

func (l *Library) RetrieveGuarantee(collectionID flow.Identifier, guarantee *flow.CollectionGuarantee) func(*badger.Txn) error

RetrieveGuarantee retrieves the guarantee with the given collection identifier.

func (*Library) RetrieveHeader

func (l *Library) RetrieveHeader(height uint64, header *flow.Header) func(*badger.Txn) error

RetrieveHeader retrieves the header at the given height.

func (*Library) RetrieveLast

func (l *Library) RetrieveLast(height *uint64) func(*badger.Txn) error

RetrieveLast retrieves the last indexed height.

func (*Library) RetrievePayload

func (l *Library) RetrievePayload(height uint64, path ledger.Path, payload *ledger.Payload) func(*badger.Txn) error

RetrievePayload retrieves the ledger payloads at the given height that match the given path.

func (*Library) RetrieveResult added in v1.1.0

func (l *Library) RetrieveResult(txID flow.Identifier, result *flow.TransactionResult) func(*badger.Txn) error

RetrieveResult retrieves the result with the given transaction identifier.

func (*Library) RetrieveSeal added in v1.1.0

func (l *Library) RetrieveSeal(sealID flow.Identifier, seal *flow.Seal) func(*badger.Txn) error

RetrieveSeal retrieves the seal with the given identifier.

func (*Library) RetrieveTransaction

func (l *Library) RetrieveTransaction(transactionID flow.Identifier, transaction *flow.TransactionBody) func(*badger.Txn) error

RetrieveTransaction retrieves the transaction with the given identifier.

func (*Library) SaveCollection

func (l *Library) SaveCollection(collection *flow.LightCollection) func(*badger.Txn) error

SaveCollection is an operation that writes the given collection.

func (*Library) SaveCommit

func (l *Library) SaveCommit(height uint64, commit flow.StateCommitment) func(*badger.Txn) error

SaveCommit is an operation that writes the height of a state commitment.

func (*Library) SaveEvents

func (l *Library) SaveEvents(height uint64, typ flow.EventType, events []flow.Event) func(*badger.Txn) error

SaveEvents is an operation that writes the height and type of a slice of events.

func (*Library) SaveFirst

func (l *Library) SaveFirst(height uint64) func(*badger.Txn) error

SaveFirst is an operation that writes the height of the first indexed block.

func (*Library) SaveGuarantee added in v1.1.0

func (l *Library) SaveGuarantee(guarantee *flow.CollectionGuarantee) func(*badger.Txn) error

SaveGuarantee is an operation that writes the given guarantee.

func (*Library) SaveHeader

func (l *Library) SaveHeader(height uint64, header *flow.Header) func(*badger.Txn) error

SaveHeader is an operation that writes the height of a header.

func (*Library) SaveLast

func (l *Library) SaveLast(height uint64) func(*badger.Txn) error

SaveLast is an operation that writes the height of the last indexed block.

func (*Library) SavePayload

func (l *Library) SavePayload(height uint64, path ledger.Path, payload *ledger.Payload) func(*badger.Txn) error

SavePayload is an operation that writes the height of a slice of paths and a slice of payloads.

func (*Library) SaveResult added in v1.1.0

func (l *Library) SaveResult(result *flow.TransactionResult) func(*badger.Txn) error

SaveResult is an operation that writes the given transaction result.

func (*Library) SaveSeal added in v1.1.0

func (l *Library) SaveSeal(seal *flow.Seal) func(*badger.Txn) error

SaveSeal is an operation that writes the given seal.

func (*Library) SaveTransaction

func (l *Library) SaveTransaction(transaction *flow.TransactionBody) func(*badger.Txn) error

SaveTransaction is an operation that writes the given transaction.

Jump to

Keyboard shortcuts

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