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