slotstore

package
v1.0.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: Apache-2.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 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) 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) 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 BlockRetainerData

type BlockRetainerData struct {
	State         api.BlockState
	FailureReason api.BlockFailureReason
}

func BlockRetainerDataFromBytes

func BlockRetainerDataFromBytes(bytes []byte) (*BlockRetainerData, int, error)

func (*BlockRetainerData) Bytes

func (b *BlockRetainerData) Bytes() ([]byte, 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 Retainer

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

func NewRetainer

func NewRetainer(slot iotago.SlotIndex, store kvstore.KVStore) (newRetainer *Retainer)

func (*Retainer) DeleteTransactionData

func (r *Retainer) DeleteTransactionData(prevID iotago.BlockID) error

func (*Retainer) GetBlock

func (r *Retainer) GetBlock(blockID iotago.BlockID) (*BlockRetainerData, bool)

func (*Retainer) GetTransaction

func (r *Retainer) GetTransaction(blockID iotago.BlockID) (*TransactionRetainerData, bool)

func (*Retainer) StoreBlockAccepted

func (r *Retainer) StoreBlockAccepted(blockID iotago.BlockID) error

func (*Retainer) StoreBlockAttached

func (r *Retainer) StoreBlockAttached(blockID iotago.BlockID) error

func (*Retainer) StoreBlockConfirmed

func (r *Retainer) StoreBlockConfirmed(blockID iotago.BlockID) error

func (*Retainer) StoreBlockFailure

func (r *Retainer) StoreBlockFailure(blockID iotago.BlockID, failureType api.BlockFailureReason) error

func (*Retainer) StoreTransactionFailure

func (r *Retainer) StoreTransactionFailure(blockID iotago.BlockID, failureType api.TransactionFailureReason) error

func (*Retainer) StoreTransactionNoFailureStatus

func (r *Retainer) StoreTransactionNoFailureStatus(blockID iotago.BlockID, status api.TransactionState) error

func (*Retainer) StoreTransactionPending

func (r *Retainer) StoreTransactionPending(blockID iotago.BlockID) 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

type TransactionRetainerData

type TransactionRetainerData struct {
	TransactionID iotago.TransactionID
	State         api.TransactionState
	FailureReason api.TransactionFailureReason
}

func TransactionRetainerDataFromBytes

func TransactionRetainerDataFromBytes(bytes []byte) (*TransactionRetainerData, int, error)

func (*TransactionRetainerData) Bytes

func (t *TransactionRetainerData) Bytes() ([]byte, error)

Jump to

Keyboard shortcuts

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