badger

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2020 License: AGPL-3.0 Imports: 14 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Blocks

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

Blocks implements a simple block storage around a badger DB.

func NewBlocks

func NewBlocks(db *badger.DB, headers *Headers, payloads *Payloads) *Blocks

func (*Blocks) ByCollectionID

func (b *Blocks) ByCollectionID(collID flow.Identifier) (*flow.Block, error)

func (*Blocks) ByHeight

func (b *Blocks) ByHeight(height uint64) (*flow.Block, error)

func (*Blocks) ByID

func (b *Blocks) ByID(blockID flow.Identifier) (*flow.Block, error)

func (*Blocks) GetLastFullBlockHeight

func (b *Blocks) GetLastFullBlockHeight() (uint64, error)

func (*Blocks) IndexBlockForCollections

func (b *Blocks) IndexBlockForCollections(blockID flow.Identifier, collIDs []flow.Identifier) error

func (*Blocks) Store

func (b *Blocks) Store(block *flow.Block) error

func (*Blocks) StoreTx

func (b *Blocks) StoreTx(block *flow.Block) func(*badger.Txn) error

func (*Blocks) UpdateLastFullBlockHeight

func (b *Blocks) UpdateLastFullBlockHeight(height uint64) error

UpdateLastFullBlockHeight upsert (update or insert) the last full block height

type Cache

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

func (*Cache) Get

func (c *Cache) Get(key interface{}) func(*badger.Txn) (interface{}, error)

Get will try to retrieve the resource from cache first, and then from the injected

func (*Cache) Put

func (c *Cache) Put(key interface{}, resource interface{}) func(*badger.Txn) error

Put will add an resource to the cache with the given ID.

type ChunkDataPacks

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

func NewChunkDataPacks

func NewChunkDataPacks(db *badger.DB) *ChunkDataPacks

func (*ChunkDataPacks) ByChunkID

func (ch *ChunkDataPacks) ByChunkID(chunkID flow.Identifier) (*flow.ChunkDataPack, error)

func (*ChunkDataPacks) Remove

func (ch *ChunkDataPacks) Remove(chunkID flow.Identifier) error

func (*ChunkDataPacks) Store

func (ch *ChunkDataPacks) Store(c *flow.ChunkDataPack) error

type Cleaner

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

func NewCleaner

func NewCleaner(log zerolog.Logger, db *badger.DB, metrics module.CleanerMetrics, frequency int) *Cleaner

NewCleaner returns a cleaner that runs the badger value log garbage collection once every `frequency` calls if a frequency of zero is passed in, we will not run the GC at all

func (*Cleaner) RunGC

func (c *Cleaner) RunGC()

type ClusterBlocks

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

ClusterBlocks implements a simple block storage around a badger DB.

func NewClusterBlocks

func NewClusterBlocks(db *badger.DB, chainID flow.ChainID, headers *Headers, payloads *ClusterPayloads) *ClusterBlocks

func (*ClusterBlocks) ByHeight

func (b *ClusterBlocks) ByHeight(height uint64) (*cluster.Block, error)

func (*ClusterBlocks) ByID

func (b *ClusterBlocks) ByID(blockID flow.Identifier) (*cluster.Block, error)

func (*ClusterBlocks) Store

func (b *ClusterBlocks) Store(block *cluster.Block) error

type ClusterPayloads

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

ClusterPayloads implements storage of block payloads for collection node cluster consensus.

func NewClusterPayloads

func NewClusterPayloads(cacheMetrics module.CacheMetrics, db *badger.DB) *ClusterPayloads

func (*ClusterPayloads) ByBlockID

func (cp *ClusterPayloads) ByBlockID(blockID flow.Identifier) (*cluster.Payload, error)

func (*ClusterPayloads) Store

func (cp *ClusterPayloads) Store(blockID flow.Identifier, payload *cluster.Payload) error

type Collections

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

func NewCollections

func NewCollections(db *badger.DB, transactions *Transactions) *Collections

func (*Collections) ByID

func (c *Collections) ByID(colID flow.Identifier) (*flow.Collection, error)

func (*Collections) LightByID

func (c *Collections) LightByID(colID flow.Identifier) (*flow.LightCollection, error)

func (*Collections) LightByTransactionID

func (c *Collections) LightByTransactionID(txID flow.Identifier) (*flow.LightCollection, error)

func (*Collections) Remove

func (c *Collections) Remove(colID flow.Identifier) error

func (*Collections) Store

func (c *Collections) Store(collection *flow.Collection) error

func (*Collections) StoreLight

func (c *Collections) StoreLight(collection *flow.LightCollection) error

func (*Collections) StoreLightAndIndexByTransaction

func (c *Collections) StoreLightAndIndexByTransaction(collection *flow.LightCollection) error

type Commits

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

func NewCommits

func NewCommits(collector module.CacheMetrics, db *badger.DB) *Commits

func (*Commits) ByBlockID

func (c *Commits) ByBlockID(blockID flow.Identifier) (flow.StateCommitment, error)

func (*Commits) Store

func (c *Commits) Store(blockID flow.Identifier, commit flow.StateCommitment) error

type EpochCommits

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

func NewEpochCommits

func NewEpochCommits(collector module.CacheMetrics, db *badger.DB) *EpochCommits

func (*EpochCommits) ByID

func (ec *EpochCommits) ByID(commitID flow.Identifier) (*flow.EpochCommit, error)

func (*EpochCommits) Store

func (ec *EpochCommits) Store(commit *flow.EpochCommit) error

TODO: can we remove this method? Its not contained in the interface.

func (*EpochCommits) StoreTx

func (ec *EpochCommits) StoreTx(commit *flow.EpochCommit) func(tx *badger.Txn) error

type EpochSetups

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

func NewEpochSetups

func NewEpochSetups(collector module.CacheMetrics, db *badger.DB) *EpochSetups

func (*EpochSetups) ByID

func (es *EpochSetups) ByID(setupID flow.Identifier) (*flow.EpochSetup, error)

func (*EpochSetups) Store

func (es *EpochSetups) Store(setup *flow.EpochSetup) error

TODO: can we remove this method? Its not contained in the interface.

func (*EpochSetups) StoreTx

func (es *EpochSetups) StoreTx(setup *flow.EpochSetup) func(tx *badger.Txn) error

type EpochStatuses

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

func NewEpochStatuses

func NewEpochStatuses(collector module.CacheMetrics, db *badger.DB) *EpochStatuses

func (*EpochStatuses) ByBlockID

func (es *EpochStatuses) ByBlockID(blockID flow.Identifier) (*flow.EpochStatus, error)

func (*EpochStatuses) StoreTx

func (es *EpochStatuses) StoreTx(blockID flow.Identifier, status *flow.EpochStatus) func(tx *badger.Txn) error

type Events

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

func NewEvents

func NewEvents(db *badger.DB) *Events

func (*Events) ByBlockID

func (e *Events) ByBlockID(blockID flow.Identifier) ([]flow.Event, error)

ByBlockID returns the events for the given block ID

func (*Events) ByBlockIDEventType

func (e *Events) ByBlockIDEventType(blockID flow.Identifier, event flow.EventType) ([]flow.Event, error)

ByBlockIDEventType returns the events for the given block ID and event type

func (*Events) ByBlockIDTransactionID

func (e *Events) ByBlockIDTransactionID(blockID flow.Identifier, txID flow.Identifier) ([]flow.Event, error)

ByBlockIDTransactionID returns the events for the given block ID and transaction ID

func (*Events) Store

func (e *Events) Store(blockID flow.Identifier, events []flow.Event) error

Store will store events for the given block ID

type ExecutionReceipts

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

ExecutionReceipts implements storage for execution receipts.

func NewExecutionReceipts

func NewExecutionReceipts(db *badger.DB, results *ExecutionResults) *ExecutionReceipts

func (*ExecutionReceipts) ByBlockID

func (r *ExecutionReceipts) ByBlockID(blockID flow.Identifier) (*flow.ExecutionReceipt, error)

func (*ExecutionReceipts) ByID

func (*ExecutionReceipts) Index

func (r *ExecutionReceipts) Index(blockID, receiptID flow.Identifier) error

func (*ExecutionReceipts) Store

func (r *ExecutionReceipts) Store(receipt *flow.ExecutionReceipt) error

type ExecutionResults

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

ExecutionResults implements persistent storage for execution results.

func NewExecutionResults

func NewExecutionResults(db *badger.DB) *ExecutionResults

func (*ExecutionResults) ByBlockID

func (r *ExecutionResults) ByBlockID(blockID flow.Identifier) (*flow.ExecutionResult, error)

func (*ExecutionResults) ByID

func (r *ExecutionResults) ByID(resultID flow.Identifier) (*flow.ExecutionResult, error)

func (*ExecutionResults) Index

func (r *ExecutionResults) Index(blockID flow.Identifier, resultID flow.Identifier) error

func (*ExecutionResults) Store

func (r *ExecutionResults) Store(result *flow.ExecutionResult) error

type Guarantees

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

Guarantees implements persistent storage for collection guarantees.

func NewGuarantees

func NewGuarantees(collector module.CacheMetrics, db *badger.DB) *Guarantees

func (*Guarantees) ByCollectionID

func (g *Guarantees) ByCollectionID(collID flow.Identifier) (*flow.CollectionGuarantee, error)

func (*Guarantees) Store

func (g *Guarantees) Store(guarantee *flow.CollectionGuarantee) error

type Headers

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

Headers implements a simple read-only header storage around a badger DB.

func NewHeaders

func NewHeaders(collector module.CacheMetrics, db *badger.DB) *Headers

func (*Headers) ByBlockID

func (h *Headers) ByBlockID(blockID flow.Identifier) (*flow.Header, error)

func (*Headers) ByHeight

func (h *Headers) ByHeight(height uint64) (*flow.Header, error)

func (*Headers) ByParentID

func (h *Headers) ByParentID(parentID flow.Identifier) ([]*flow.Header, error)

func (*Headers) FindHeaders

func (h *Headers) FindHeaders(filter func(header *flow.Header) bool) ([]flow.Header, error)

func (*Headers) Store

func (h *Headers) Store(header *flow.Header) error

type Index

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

Index implements a simple read-only payload storage around a badger DB.

func NewIndex

func NewIndex(collector module.CacheMetrics, db *badger.DB) *Index

func (*Index) ByBlockID

func (i *Index) ByBlockID(blockID flow.Identifier) (*flow.Index, error)

func (*Index) Store

func (i *Index) Store(blockID flow.Identifier, index *flow.Index) error

type Payloads

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

func NewPayloads

func NewPayloads(db *badger.DB, index *Index, guarantees *Guarantees, seals *Seals) *Payloads

func (*Payloads) ByBlockID

func (p *Payloads) ByBlockID(blockID flow.Identifier) (*flow.Payload, error)

func (*Payloads) Store

func (p *Payloads) Store(blockID flow.Identifier, payload *flow.Payload) error

type Seals

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

func NewSeals

func NewSeals(collector module.CacheMetrics, db *badger.DB) *Seals

func (*Seals) ByBlockID

func (s *Seals) ByBlockID(blockID flow.Identifier) (*flow.Seal, error)

func (*Seals) ByID

func (s *Seals) ByID(sealID flow.Identifier) (*flow.Seal, error)

func (*Seals) Store

func (s *Seals) Store(seal *flow.Seal) error

type TransactionResults

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

func NewTransactionResults

func NewTransactionResults(db *badger.DB) *TransactionResults

func (*TransactionResults) BatchStore

func (tr *TransactionResults) BatchStore(blockID flow.Identifier, transactionResults []flow.TransactionResult) error

BatchStore will store the transaction results for the given block ID

func (*TransactionResults) ByBlockIDTransactionID

func (tr *TransactionResults) ByBlockIDTransactionID(blockID flow.Identifier, txID flow.Identifier) (*flow.TransactionResult, error)

ByBlockIDTransactionID returns the runtime transaction result for the given block ID and transaction ID

func (*TransactionResults) Store

func (tr *TransactionResults) Store(blockID flow.Identifier, transactionResult *flow.TransactionResult) error

Store will store the transaction result for the given block ID

type Transactions

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

func NewTransactions

func NewTransactions(cacheMetrics module.CacheMetrics, db *badger.DB) *Transactions

func (*Transactions) ByID

func (*Transactions) Store

func (t *Transactions) Store(flowTx *flow.TransactionBody) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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