persistence

package
v0.0.0-...-ff78b6e Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RootToPaths

func RootToPaths(slot uint64, root libcommon.Hash, config *clparams.BeaconChainConfig) (folderPath string, filePath string)

SlotToPaths define the file structure to store a block

"/signedBeaconBlock/{slot/10_000}/{root}.ssz_snappy"

Types

type BeaconChainDatabase

type BeaconChainDatabase interface {
	BlockSource
	BeaconChainWriter
}

type BeaconChainWriter

type BeaconChainWriter interface {
	WriteBlock(ctx context.Context, tx kv.RwTx, block *cltypes.SignedBeaconBlock, canonical bool) error
}

type BeaconRpcSource

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

func NewBeaconRpcSource

func NewBeaconRpcSource(rpc *rpc.BeaconRpcP2P) *BeaconRpcSource

func (*BeaconRpcSource) GetBlock

func (*BeaconRpcSource) GetRange

func (b *BeaconRpcSource) GetRange(ctx context.Context, _ kv.Tx, from uint64, count uint64) (*peers.PeeredObject[[]*cltypes.SignedBeaconBlock], error)

func (*BeaconRpcSource) PurgeRange

func (b *BeaconRpcSource) PurgeRange(ctx context.Context, _ kv.Tx, from uint64, count uint64) error

a noop for rpc source since we always return new data

func (*BeaconRpcSource) SaveBlocks

type BlockSource

type BlockSource interface {
	GetRange(ctx context.Context, tx kv.Tx, from uint64, count uint64) (*peers.PeeredObject[[]*cltypes.SignedBeaconBlock], error)
	PurgeRange(ctx context.Context, tx kv.Tx, from uint64, count uint64) error
	GetBlock(ctx context.Context, tx kv.Tx, slot uint64) (*peers.PeeredObject[*cltypes.SignedBeaconBlock], error)
}

type GossipSource

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

func NewGossipSource

func NewGossipSource(ctx context.Context, gossip *network.GossipManager) *GossipSource

func (*GossipSource) GetBlock

func (*GossipSource) GetRange

func (b *GossipSource) GetRange(ctx context.Context, _ kv.Tx, from uint64, count uint64) (*peers.PeeredObject[[]*cltypes.SignedBeaconBlock], error)

func (*GossipSource) PurgeRange

func (b *GossipSource) PurgeRange(ctx context.Context, _ kv.Tx, from uint64, count uint64) error

type RawBeaconBlockChain

type RawBeaconBlockChain interface {
	BlockWriter(ctx context.Context, slot uint64, blockRoot libcommon.Hash) (io.WriteCloser, error)
	BlockReader(ctx context.Context, slot uint64, blockRoot libcommon.Hash) (io.ReadCloser, error)
	DeleteBlock(ctx context.Context, slot uint64, blockRoot libcommon.Hash) error
}

func AferoRawBeaconBlockChainFromOsPath

func AferoRawBeaconBlockChainFromOsPath(cfg *clparams.BeaconChainConfig, path string) RawBeaconBlockChain

func NewAferoRawBlockSaver

func NewAferoRawBlockSaver(fs afero.Fs, cfg *clparams.BeaconChainConfig) RawBeaconBlockChain

Directories

Path Synopsis
format

Jump to

Keyboard shortcuts

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