kv

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ConsensusInfosCacheSize with 1024 consensus infos will be 1.5MB.
	ConsensusInfosCacheSize = 1 << 10
	// OrchestratorNodeDbDirName is the name of the directory containing the orchestrator node database.
	OrchestratorNodeDbDirName = "orchestrator"
	// DatabaseFileName is the name of the orchestrator node database.
	DatabaseFileName = "orchestrator.db"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	InitialMMapSize int
}

Config for the bolt db kv store.

type Store

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

func NewKVStore

func NewKVStore(ctx context.Context, dirPath string, config *Config) (*Store, error)

NewKVStore initializes a new boltDB key-value store at the directory path specified, creates the kv-buckets based on the schema, and stores an open connection db object as a property of the Store struct.

func (*Store) ClearDB

func (s *Store) ClearDB() error

ClearDB removes the previously stored database in the data directory.

func (*Store) Close

func (s *Store) Close() error

Close closes the underlying BoltDB database.

func (*Store) ConsensusInfo

func (s *Store) ConsensusInfo(ctx context.Context, epoch uint64) (*eventTypes.MinimalEpochConsensusInfo, error)

ConsensusInfo

func (*Store) ConsensusInfos

func (s *Store) ConsensusInfos(fromEpoch uint64) ([]*eventTypes.MinimalEpochConsensusInfo, error)

ConsensusInfos

func (*Store) DatabasePath

func (s *Store) DatabasePath() string

DatabasePath at which this database writes files.

func (*Store) FinalizedEpoch

func (s *Store) FinalizedEpoch() uint64

LatestLatestFinalizedEpoch

func (*Store) FinalizedSlot

func (s *Store) FinalizedSlot() uint64

LatestLatestFinalizedSlot

func (*Store) FindAncestor

func (s *Store) FindAncestor(fromStepId, toStepId uint64, blockHash common.Hash) (*types.MultiShardInfo, uint64, error)

FindAncestor

func (*Store) GetStepIdBySlot

func (s *Store) GetStepIdBySlot(slot uint64) (uint64, error)

GetStepIdBySlot

func (*Store) InvalidSlotInfo

func (s *Store) InvalidSlotInfo(slot uint64) (*types.SlotInfo, error)

InvalidSlotInfo

func (*Store) LatestSavedEpoch

func (s *Store) LatestSavedEpoch() uint64

LatestSavedEpoch

func (*Store) LatestStepID

func (s *Store) LatestStepID() uint64

LatestStepID

func (*Store) RemoveRangeConsensusInfo

func (s *Store) RemoveRangeConsensusInfo(startEpoch, endEpoch uint64) error

func (*Store) RemoveShardingInfos

func (s *Store) RemoveShardingInfos(fromStepId uint64) error

RemoveShardingInfos removes shard infos from db

func (*Store) SaveConsensusInfo

func (s *Store) SaveConsensusInfo(
	ctx context.Context,
	consensusInfo *eventTypes.MinimalEpochConsensusInfo,
) error

SaveConsensusInfo

func (*Store) SaveFinalizedEpoch

func (s *Store) SaveFinalizedEpoch(latestFinalizedEpoch uint64) error

SaveLatestFinalizedEpoch

func (*Store) SaveFinalizedSlot

func (s *Store) SaveFinalizedSlot(latestFinalizedSlot uint64) error

SaveLatestFinalizedSlot

func (*Store) SaveInvalidSlotInfo

func (s *Store) SaveInvalidSlotInfo(slot uint64, slotInfo *types.SlotInfo) error

SaveInvalidSlotInfo

func (*Store) SaveLatestEpoch

func (s *Store) SaveLatestEpoch(ctx context.Context, epoch uint64) error

SaveLatestEpoch

func (*Store) SaveLatestStepID

func (s *Store) SaveLatestStepID(stepID uint64) error

SaveLatestStepID

func (*Store) SaveSlotStepIndex

func (s *Store) SaveSlotStepIndex(slot, stepId uint64) error

StoreSlotStepIndex

func (*Store) SaveVerifiedShardInfo

func (s *Store) SaveVerifiedShardInfo(stepId uint64, shardInfo *types.MultiShardInfo) error

SaveVerifiedSlotInfo will insert slot information to particular slot to db and cache After save operations you must call SaveLatestVerifiedSlot to push in memory slot height to db

func (*Store) VerifiedShardInfo

func (s *Store) VerifiedShardInfo(stepId uint64) (*types.MultiShardInfo, error)

VerifiedSlotInfo

func (*Store) VerifiedShardInfos

func (s *Store) VerifiedShardInfos(fromStepId uint64) (map[uint64]*types.MultiShardInfo, error)

ConsensusInfos

Jump to

Keyboard shortcuts

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