store

package
v0.75.8 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2024 License: AGPL-3.0 Imports: 48 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 `description:"the ipfs peer id of this node"  long:"peer-id"`
	PrivKey string `description:"the ipfs priv key of this node" long:"priv-key"`

	// Optional Settings
	BootstrapPeers []string `` /* 145-byte string literal not displayed */
	SwarmPort      int      `` /* 140-byte string literal not displayed */

	// 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 `description:"optional swarm key override, the default behaviour is to use the datanode's chain id'" long:"swarm-key-override"`

	HistoryRetentionBlockSpan int64             `` /* 138-byte string literal not displayed */
	GarbageCollectionInterval encoding.Duration `` /* 137-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, log *logging.Logger) (*LevelDbBackedIndex, error)

func (LevelDbBackedIndex) Add

func (l LevelDbBackedIndex) Add(indexEntry segment.Full) error

func (LevelDbBackedIndex) Close

func (l LevelDbBackedIndex) Close() error

func (LevelDbBackedIndex) Get

func (l LevelDbBackedIndex) Get(height int64) (segment.Full, error)

func (LevelDbBackedIndex) GetHighestBlockHeightEntry

func (l LevelDbBackedIndex) GetHighestBlockHeightEntry() (segment.Full, error)

func (LevelDbBackedIndex) ListAllEntriesMostRecentFirst added in v0.71.0

func (l LevelDbBackedIndex) ListAllEntriesMostRecentFirst() (segment.Segments[segment.Full], error)

func (LevelDbBackedIndex) ListAllEntriesOldestFirst

func (l LevelDbBackedIndex) ListAllEntriesOldestFirst() (segment.Segments[segment.Full], error)

func (LevelDbBackedIndex) Remove

func (l LevelDbBackedIndex) Remove(indexEntry segment.Full) error

type PeerConnection added in v0.68.0

type PeerConnection struct {
	Local  IpfsNode
	Remote IpfsNode
}

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, maxMemoryPercent uint8,
) (*Store, error)

func (*Store) AddSnapshotData

func (p *Store) AddSnapshotData(ctx context.Context, s segment.Unpublished) (err error)

func (*Store) CollectGarbage added in v0.72.13

func (p *Store) CollectGarbage(ctx context.Context) (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) FetchHistorySegment

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

func (*Store) GetConnectedPeers added in v0.68.0

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

func (*Store) GetHighestBlockHeightEntry

func (p *Store) GetHighestBlockHeightEntry() (segment.Full, error)

func (*Store) GetHistorySegmentReader added in v0.71.0

func (p *Store) GetHistorySegmentReader(ctx context.Context, historySegmentID string) (io.ReadSeekCloser, int64, 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) GetPreviousHistorySegmentID added in v0.71.0

func (p *Store) GetPreviousHistorySegmentID(fromHeight int64) (string, error)

func (*Store) GetSegmentForHeight added in v0.71.0

func (p *Store) GetSegmentForHeight(toHeight int64) (segment.Full, error)

func (*Store) GetSwarmKey

func (p *Store) GetSwarmKey() string

func (*Store) GetSwarmKeySeed added in v0.68.0

func (p *Store) GetSwarmKeySeed() string

func (*Store) ListAllIndexEntriesMostRecentFirst added in v0.71.0

func (p *Store) ListAllIndexEntriesMostRecentFirst() (segment.Segments[segment.Full], error)

func (*Store) ListAllIndexEntriesOldestFirst added in v0.68.0

func (p *Store) ListAllIndexEntriesOldestFirst() (segment.Segments[segment.Full], error)

func (*Store) RemoveSegments added in v0.71.0

func (p *Store) RemoveSegments(ctx context.Context, segmentsToRemove []segment.Full) error

func (*Store) ResetIndex

func (p *Store) ResetIndex() error

func (*Store) StagedContiguousHistory added in v0.71.0

func (p *Store) StagedContiguousHistory(ctx context.Context, chunk segment.ContiguousHistory[segment.Full]) (segment.ContiguousHistory[segment.Staged], error)

func (*Store) StagedSegment added in v0.71.0

func (p *Store) StagedSegment(ctx context.Context, s segment.Full) (segment.Staged, 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