storage

package
v1.0.0-alpha.15 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAllowedDBEngines

func WithAllowedDBEngines(optsAllowedDBEngines []db.Engine) options.Option[Storage]

func WithBucketManagerOptions

func WithBucketManagerOptions(opts ...options.Option[prunable.BucketManager]) options.Option[Storage]

func WithDBEngine

func WithDBEngine(optsDBEngine db.Engine) options.Option[Storage]

func WithPermanentOptions

func WithPermanentOptions(opts ...options.Option[permanent.Permanent]) options.Option[Storage]

func WithPruningDelay

func WithPruningDelay(optsPruningDelay iotago.EpochIndex) options.Option[Storage]

func WithPruningSizeCooldownTime

func WithPruningSizeCooldownTime(cooldown time.Duration) options.Option[Storage]

func WithPruningSizeEnable

func WithPruningSizeEnable(pruningSizeEnabled bool) options.Option[Storage]

func WithPruningSizeMaxTargetSizeBytes

func WithPruningSizeMaxTargetSizeBytes(pruningSizeTargetSizeBytes int64) options.Option[Storage]

func WithPruningSizeReductionPercentage

func WithPruningSizeReductionPercentage(pruningSizeReductionPercentage float64) options.Option[Storage]

Types

type SQLDatabaseExecFunc

type SQLDatabaseExecFunc func(func(*gorm.DB) error) error

type Storage

type Storage struct {
	Pruned *event.Event1[iotago.EpochIndex]
	// contains filtered or unexported fields
}

Storage is an abstraction around the storage layer of the node.

func Clone

func Clone(parentLogger log.Logger, source *Storage, directory string, dbVersion byte, errorHandler func(error), opts ...options.Option[Storage]) (*Storage, error)

Clone creates a new storage instance with the named database version in the given directory and cloning the permannent and prunable counterparts from the given source storage.

func Create

func Create(parentLogger log.Logger, directory string, dbVersion byte, errorHandler func(error), opts ...options.Option[Storage]) *Storage

Create creates a new storage instance with the named database version in the given directory and initializes its permanent and prunable counterparts.

func (*Storage) AccountDiffs

func (s *Storage) AccountDiffs(slot iotago.SlotIndex) (*slotstore.AccountDiffs, error)

func (*Storage) Accounts

func (s *Storage) Accounts(optRealm ...byte) kvstore.KVStore

Accounts returns the Accounts storage (or a specialized sub-storage if a realm is provided).

func (*Storage) Attestations

func (s *Storage) Attestations(slot iotago.SlotIndex) (kvstore.KVStore, error)

func (*Storage) BlockMetadata

func (s *Storage) BlockMetadata(slot iotago.SlotIndex) (*slotstore.BlockMetadataStore, error)

func (*Storage) Blocks

func (s *Storage) Blocks(slot iotago.SlotIndex) (*slotstore.Blocks, error)

func (*Storage) CheckCorrectnessCommitmentLedgerState

func (s *Storage) CheckCorrectnessCommitmentLedgerState() error

Checks the correctness of the latest commitment. Additionally, for non-genesis slots it checks whether the ledger state corresponds to the state root.

func (*Storage) Commitments

func (s *Storage) Commitments() *permanent.Commitments

func (*Storage) Committee

func (s *Storage) Committee() epochstore.Store[*account.SeatedAccounts]

func (*Storage) CommitteeCandidates

func (s *Storage) CommitteeCandidates(epoch iotago.EpochIndex) (*kvstore.TypedStore[iotago.AccountID, iotago.SlotIndex], error)

func (*Storage) DecidedUpgradeSignals

func (s *Storage) DecidedUpgradeSignals() epochstore.Store[model.VersionAndHash]

func (*Storage) Directory

func (s *Storage) Directory() string

func (*Storage) ExportRoots

func (s *Storage) ExportRoots(writer io.WriteSeeker, targetCommitment *iotago.Commitment) error

func (*Storage) Flush

func (s *Storage) Flush()

func (*Storage) GenesisRootBlockID

func (s *Storage) GenesisRootBlockID() iotago.BlockID

func (*Storage) ImportRoots

func (s *Storage) ImportRoots(reader io.ReadSeeker, targetCommitment *model.Commitment) error

func (*Storage) IsPruning

func (s *Storage) IsPruning() bool

func (*Storage) LastPrunedEpoch

func (s *Storage) LastPrunedEpoch() (epoch iotago.EpochIndex, hasPruned bool)

func (*Storage) Ledger

func (s *Storage) Ledger() *utxoledger.Manager

Ledger returns the ledger storage (or a specialized sub-storage if a realm is provided).

func (*Storage) Mutations

func (s *Storage) Mutations(slot iotago.SlotIndex) (kvstore.KVStore, error)

func (*Storage) PermanentDatabaseSize

func (s *Storage) PermanentDatabaseSize() int64

PermanentDatabaseSize returns the size of the underlying permanent database and files.

func (*Storage) PoolStats

func (s *Storage) PoolStats() epochstore.Store[*model.PoolsStats]

func (*Storage) PrunableDatabaseSize

func (s *Storage) PrunableDatabaseSize() int64

PrunableDatabaseSize returns the size of the underlying prunable databases.

func (*Storage) PruneByDepth

func (s *Storage) PruneByDepth(epochDepth iotago.EpochIndex) (firstPruned iotago.EpochIndex, lastPruned iotago.EpochIndex, err error)

func (*Storage) PruneByEpochIndex

func (s *Storage) PruneByEpochIndex(epoch iotago.EpochIndex) error

PruneByEpochIndex prunes the database until the given epoch. It returns an error if the epoch is too old or too new. It is to be called by the user e.g. via the WebAPI.

func (*Storage) PruneBySize

func (s *Storage) PruneBySize(targetSizeMaxBytes ...int64) error

func (*Storage) Reset

func (s *Storage) Reset()

Reset resets the component to a clean state as if it was created at the last commitment.

func (*Storage) RestoreFromDisk

func (s *Storage) RestoreFromDisk()

func (*Storage) Rewards

func (s *Storage) Rewards() *epochstore.EpochKVStore

func (*Storage) RewardsForEpoch

func (s *Storage) RewardsForEpoch(epoch iotago.EpochIndex) (kvstore.KVStore, error)

func (*Storage) Rollback

func (s *Storage) Rollback(targetSlot iotago.SlotIndex) error

func (*Storage) RootBlocks

func (*Storage) Roots

func (*Storage) Settings

func (s *Storage) Settings() *permanent.Settings

func (*Storage) Shutdown

func (s *Storage) Shutdown()

Shutdown shuts down the storage.

func (*Storage) Size

func (s *Storage) Size() int64

func (*Storage) TransactionRetainerDatabaseExecFunc

func (s *Storage) TransactionRetainerDatabaseExecFunc() SQLDatabaseExecFunc

func (*Storage) TransactionRetainerDatabaseSize

func (s *Storage) TransactionRetainerDatabaseSize() int64

TransactionRetainerDatabaseSize returns the size of the underlying SQL database of the transaction retainer.

func (*Storage) TryPrune

func (s *Storage) TryPrune() error

func (*Storage) UpgradeSignals

func (*Storage) ValidatorPerformances

func (s *Storage) ValidatorPerformances(slot iotago.SlotIndex) (*slotstore.Store[iotago.AccountID, *model.ValidatorPerformance], error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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