slotstore

package
v1.0.0-beta.6 Latest Latest
Warning

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

Go to latest
Published: May 22, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountDiffs

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

AccountDiffs is the storable unit of Account changes for all account in a slot.

func NewAccountDiffs

func NewAccountDiffs(slot iotago.SlotIndex, store kvstore.KVStore, api iotago.API) *AccountDiffs

NewAccountDiffs creates a new AccountDiffs instance.

func (*AccountDiffs) Clear

func (b *AccountDiffs) Clear() error

func (*AccountDiffs) Delete

func (b *AccountDiffs) Delete(accountID iotago.AccountID) (err error)

Delete deletes the given accountID from the root blocks.

func (*AccountDiffs) Has

func (b *AccountDiffs) Has(accountID iotago.AccountID) (has bool, err error)

Has returns true if the given accountID is a root block.

func (*AccountDiffs) Load

func (b *AccountDiffs) Load(accountID iotago.AccountID) (accountDiff *model.AccountDiff, destroyed bool, err error)

Load loads accountID and commitmentID for the given blockID.

func (*AccountDiffs) Slot

func (b *AccountDiffs) Slot() iotago.SlotIndex

func (*AccountDiffs) Store

func (b *AccountDiffs) Store(accountID iotago.AccountID, accountDiff *model.AccountDiff, destroyed bool) (err error)

Store stores the given accountID as a root block.

func (*AccountDiffs) Stream

func (b *AccountDiffs) Stream(consumer func(accountID iotago.AccountID, accountDiff *model.AccountDiff, destroyed bool) bool) error

Stream streams all accountIDs changes for a slot index.

func (*AccountDiffs) StreamDestroyed

func (b *AccountDiffs) StreamDestroyed(consumer func(accountID iotago.AccountID) bool) error

StreamDestroyed streams all destroyed accountIDs for a slot index.

type BlockMetadata

type BlockMetadata struct {
	State api.BlockState
}

func (*BlockMetadata) Bytes

func (b *BlockMetadata) Bytes() ([]byte, error)

type BlockMetadataStore

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

func NewBlockMetadataStore

func NewBlockMetadataStore(slot iotago.SlotIndex, store kvstore.KVStore) *BlockMetadataStore

func (*BlockMetadataStore) BlockMetadata

func (r *BlockMetadataStore) BlockMetadata(blockID iotago.BlockID) (*BlockMetadata, error)

func (*BlockMetadataStore) StoreBlockMetadata

func (r *BlockMetadataStore) StoreBlockMetadata(blockID iotago.BlockID, state api.BlockState) error

type Blocks

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

func NewBlocks

func NewBlocks(slot iotago.SlotIndex, store kvstore.KVStore, apiForSlot iotago.API) (newBlocks *Blocks)

func (*Blocks) Clear

func (b *Blocks) Clear() error

Clear clears the storage.

func (*Blocks) Delete

func (b *Blocks) Delete(id iotago.BlockID) (err error)

func (*Blocks) ForEachBlockInSlot

func (b *Blocks) ForEachBlockInSlot(consumer func(block *model.Block) error) error

func (*Blocks) Load

func (b *Blocks) Load(id iotago.BlockID) (*model.Block, error)

func (*Blocks) Store

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

func (*Blocks) StreamKeys

func (b *Blocks) StreamKeys(consumer func(blockID iotago.BlockID) error) error

type Store

type Store[K, V any] struct {
	// contains filtered or unexported fields
}

func NewStore

func NewStore[K, V any](
	slot iotago.SlotIndex,
	kv kvstore.KVStore,
	keyToBytes kvstore.ObjectToBytes[K],
	bytesToKey kvstore.BytesToObject[K],
	vToBytes kvstore.ObjectToBytes[V],
	bytesToV kvstore.BytesToObject[V],
) *Store[K, V]

func (*Store[K, V]) Delete

func (s *Store[K, V]) Delete(key K) (err error)

func (*Store[K, V]) Has

func (s *Store[K, V]) Has(key K) (has bool, err error)

Has returns true if the given blockID is a root block.

func (*Store[K, V]) Load

func (s *Store[K, V]) Load(key K) (value V, exists bool, err error)

func (*Store[K, V]) Store

func (s *Store[K, V]) Store(key K, value V) error

func (*Store[K, V]) Stream

func (s *Store[K, V]) Stream(consumer func(key K, value V) error) error

func (*Store[K, V]) StreamBytes

func (s *Store[K, V]) StreamBytes(consumer func([]byte, []byte) error) error

func (*Store[K, V]) StreamKeys

func (s *Store[K, V]) StreamKeys(consumer func(key K) error) error

Jump to

Keyboard shortcuts

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