store

package
v0.68.3 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2023 License: MIT Imports: 43 Imported by: 1

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

func GenerateIdentityFromSeed

func GenerateIdentityFromSeed(seed []byte) (config.Identity, error)

Types

type Config

type Config struct {
	// Mandatory Setting, must be set
	PeerID  string `long:"peer-id" description:"the ipfs peer id of this node"`
	PrivKey string `long:"priv-key" description:"the ipfs priv key of this node"`

	// Optional Settings
	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'"`

	HistoryRetentionBlockSpan int64 `` /* 138-byte string literal not displayed */
}

func NewDefaultConfig

func NewDefaultConfig() Config

func (Config) GetSwarmKeySeed added in v0.68.0

func (c Config) GetSwarmKeySeed(log *logging.Logger, chainID string) string

type IpfsNode added in v0.68.0

type IpfsNode struct {
	IpfsId peer.ID
	Addr   ma.Multiaddr
}

func (IpfsNode) IpfsAddress added in v0.68.0

func (i IpfsNode) IpfsAddress() (ma.Multiaddr, error)

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)

func (LevelDbBackedIndex) Remove

func (l LevelDbBackedIndex) Remove(indexEntry SegmentIndexEntry) error

type PeerConnection added in v0.68.0

type PeerConnection struct {
	Local  IpfsNode
	Remote IpfsNode
}

type SegmentIndexEntry

type SegmentIndexEntry struct {
	SegmentMetaData
	HistorySegmentID string
}

func (SegmentIndexEntry) GetHistorySegmentId added in v0.68.0

func (i SegmentIndexEntry) GetHistorySegmentId() string

func (SegmentIndexEntry) GetPreviousHistorySegmentId added in v0.68.0

func (i SegmentIndexEntry) GetPreviousHistorySegmentId() string

type SegmentMetaData

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

func (SegmentMetaData) GetFromHeight added in v0.68.0

func (m SegmentMetaData) GetFromHeight() int64

func (SegmentMetaData) GetToHeight added in v0.68.0

func (m SegmentMetaData) GetToHeight() int64

type Store

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

func New

func New(ctx context.Context, log *logging.Logger, chainID string, cfg Config, networkHistoryHome 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) CopyHistorySegmentToFile

func (p *Store) CopyHistorySegmentToFile(ctx context.Context, historySegmentID string, targetFile string) 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) GetConnectedPeers added in v0.68.0

func (p *Store) GetConnectedPeers() []PeerConnection

func (*Store) GetHighestBlockHeightEntry

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

func (*Store) GetLocalNode added in v0.68.0

func (p *Store) GetLocalNode() (IpfsNode, error)

func (*Store) GetPeerID

func (p *Store) GetPeerID() string

func (*Store) GetSwarmKey

func (p *Store) GetSwarmKey() string

func (*Store) GetSwarmKeySeed added in v0.68.0

func (p *Store) GetSwarmKeySeed() string

func (*Store) ListAllIndexEntriesOldestFirst added in v0.68.0

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

func (*Store) ResetIndex

func (p *Store) ResetIndex() error

func (*Store) Stop

func (p *Store) Stop()

Jump to

Keyboard shortcuts

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