2023-08-16 23:03:25 +02:00
|
|
|
package persistence
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2023-09-17 13:15:06 +02:00
|
|
|
"io"
|
2023-08-16 23:03:25 +02:00
|
|
|
|
2023-09-17 13:15:06 +02:00
|
|
|
libcommon "github.com/ledgerwatch/erigon-lib/common"
|
2023-10-18 23:10:53 +02:00
|
|
|
"github.com/ledgerwatch/erigon-lib/kv"
|
2023-08-16 23:03:25 +02:00
|
|
|
"github.com/ledgerwatch/erigon/cl/cltypes"
|
|
|
|
"github.com/ledgerwatch/erigon/cl/sentinel/peers"
|
|
|
|
)
|
|
|
|
|
|
|
|
type BlockSource interface {
|
2023-10-22 17:30:27 +02:00
|
|
|
GetRange(ctx context.Context, tx kv.Tx, from uint64, count uint64) (*peers.PeeredObject[[]*cltypes.SignedBeaconBlock], error)
|
2023-11-13 14:10:57 +01:00
|
|
|
PurgeRange(ctx context.Context, tx kv.Tx, from uint64, count uint64) error
|
2023-10-22 19:21:37 +02:00
|
|
|
GetBlock(ctx context.Context, tx kv.Tx, slot uint64) (*peers.PeeredObject[*cltypes.SignedBeaconBlock], error)
|
2023-08-16 23:03:25 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type BeaconChainWriter interface {
|
2023-10-22 01:17:18 +02:00
|
|
|
WriteBlock(ctx context.Context, tx kv.RwTx, block *cltypes.SignedBeaconBlock, canonical bool) error
|
2023-08-16 23:03:25 +02:00
|
|
|
}
|
|
|
|
|
2023-09-17 13:15:06 +02:00
|
|
|
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
|
|
|
|
}
|
|
|
|
|
2023-08-16 23:03:25 +02:00
|
|
|
type BeaconChainDatabase interface {
|
|
|
|
BlockSource
|
|
|
|
BeaconChainWriter
|
|
|
|
}
|