erigon-pulse/cl/persistence/interface.go

32 lines
999 B
Go
Raw Normal View History

package persistence
import (
"context"
"io"
libcommon "github.com/ledgerwatch/erigon-lib/common"
2023-10-18 21:10:53 +00:00
"github.com/ledgerwatch/erigon-lib/kv"
"github.com/ledgerwatch/erigon/cl/cltypes"
"github.com/ledgerwatch/erigon/cl/sentinel/peers"
)
type BlockSource interface {
2023-10-18 21:10:53 +00:00
GetRange(tx kv.Tx, ctx context.Context, from uint64, count uint64) ([]*peers.PeeredObject[*cltypes.SignedBeaconBlock], error)
PurgeRange(tx kv.RwTx, ctx context.Context, from uint64, count uint64) error
}
type BeaconChainWriter interface {
2023-10-18 21:10:53 +00:00
WriteBlock(tx kv.RwTx, ctx context.Context, block *cltypes.SignedBeaconBlock, canonical bool) error
}
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
}
type BeaconChainDatabase interface {
BlockSource
BeaconChainWriter
}