store

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 47 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrIndexEntryNotFound = errors.New("index entry not found")
View Source
var ErrSegmentNotFound = errors.New("segment not found")

Functions

This section is empty.

Types

type Config

type Config struct {
	// Mandatory Setting, must be set
	IDSeed string `long:"id-seed" description:"used to generate the id and Key pair for this node"`

	// Optional Settings
	UseIpfsDefaultPeers encoding.Bool `long:"use-ipfs-default-peers" description:"if true ipfs default peers will be appended to the bootstrap peers"`
	BootstrapPeers      []string      `` /* 145-byte string literal not displayed */
	SwarmPort           int           `long:"swarm-port" description:"ipfs swarm port"`

	// Without this there would be no way to isolate an environment if needed and process a given chains data (e.g. for dev)
	SwarmKeyOverride string `long:"swarm-key-override" description:"optional swarm key override, the default behaviour is to use the datanode's chain id'"`

	StartWebUI encoding.Bool `long:"start-web-ui" description:"if true the store will expose the ipfs web UI"`
	WebUIPort  int           `long:"webui-port" description:"webui port"`
}

func NewDefaultConfig

func NewDefaultConfig() Config

type LevelDbBackedIndex

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

func NewIndex

func NewIndex(dataDir string) (*LevelDbBackedIndex, error)

func (LevelDbBackedIndex) Add

func (l LevelDbBackedIndex) Add(indexEntry SegmentIndexEntry) error

func (LevelDbBackedIndex) Close

func (l LevelDbBackedIndex) Close() error

func (LevelDbBackedIndex) Get

func (LevelDbBackedIndex) GetHighestBlockHeightEntry

func (l LevelDbBackedIndex) GetHighestBlockHeightEntry() (SegmentIndexEntry, error)

func (LevelDbBackedIndex) ListAllEntriesOldestFirst

func (l LevelDbBackedIndex) ListAllEntriesOldestFirst() ([]SegmentIndexEntry, error)

type SegmentIndexEntry

type SegmentIndexEntry struct {
	SegmentMetaData
	HistorySegmentID string
}

type SegmentMetaData

type SegmentMetaData struct {
	HeightFrom               int64
	HeightTo                 int64
	ChainID                  string
	PreviousHistorySegmentID string
}

type Store

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

func New

func New(ctx context.Context, log *logging.Logger, chainID string, cfg Config, deHistoryHome string, wipeOnStartup bool) (*Store, error)

func (*Store) AddSnapshotData

func (p *Store) AddSnapshotData(ctx context.Context, historySnapshot snapshot.History, currentState snapshot.CurrentState,
	sourceDir string,
) (err error)

func (*Store) ConnectedToPeer

func (p *Store) ConnectedToPeer(peerIDStr string) (bool, error)

func (*Store) CopySnapshotDataIntoDir

func (p *Store) CopySnapshotDataIntoDir(ctx context.Context, toHeight int64, targetDir string) (currentStateSnapshot snapshot.CurrentState,
	historySnapshot snapshot.History, err error,
)

func (*Store) FetchHistorySegment

func (p *Store) FetchHistorySegment(ctx context.Context, historySegmentID string) (SegmentIndexEntry, error)

func (*Store) GetHighestBlockHeightEntry

func (p *Store) GetHighestBlockHeightEntry() (SegmentIndexEntry, error)

func (*Store) GetPeerAddrs

func (p *Store) GetPeerAddrs() []ma.Multiaddr

func (*Store) GetPeerID

func (p *Store) GetPeerID() string

func (*Store) ListAllHistorySegments

func (p *Store) ListAllHistorySegments() ([]SegmentIndexEntry, error)

func (*Store) ResetIndex

func (p *Store) ResetIndex() error

Jump to

Keyboard shortcuts

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