2023-08-16 21:03:25 +00:00
|
|
|
package persistence
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2023-09-14 00:56:29 +00:00
|
|
|
"database/sql"
|
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-09-14 00:56:29 +00:00
|
|
|
GetRange(tx *sql.Tx, ctx context.Context, from uint64, count uint64) ([]*peers.PeeredObject[*cltypes.SignedBeaconBlock], error)
|
|
|
|
PurgeRange(tx *sql.Tx, ctx context.Context, from uint64, count uint64) error
|
2023-08-16 21:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type BeaconChainWriter interface {
|
2023-09-14 00:56:29 +00:00
|
|
|
WriteBlock(tx *sql.Tx, ctx context.Context, block *cltypes.SignedBeaconBlock, canonical bool) error
|
2023-08-16 21:03:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type BeaconChainDatabase interface {
|
|
|
|
BlockSource
|
|
|
|
BeaconChainWriter
|
|
|
|
}
|