Documentation ¶
Index ¶
- Variables
- func NewStateSyncEventMessages(stateSyncEvents []rlp.RawValue, stateReceiverContract *libcommon.Address, ...) []*types.Message
- func NewTxStore(tx kv.Tx) txStore
- func UnwindBlockNumToEventID(tx kv.RwTx, blockNum uint64) error
- func UnwindEventProcessedBlocks(tx kv.RwTx, blockNum uint64) error
- func UnwindEventTxnToBlockNum(tx kv.RwTx, blockNum uint64) error
- func UnwindEvents(tx kv.RwTx, unwindPoint uint64) error
- type BackendServer
- func (b *BackendServer) BorEvents(ctx context.Context, in *remoteproto.BorEventsRequest) (*remoteproto.BorEventsReply, error)
- func (b *BackendServer) BorTxnLookup(ctx context.Context, in *remoteproto.BorTxnLookupRequest) (*remoteproto.BorTxnLookupReply, error)
- func (b *BackendServer) Version(ctx context.Context, in *emptypb.Empty) (*typesproto.VersionReply, error)
- type MdbxStore
- func (s *MdbxStore) BlockEventIdsRange(ctx context.Context, blockNum uint64) (uint64, uint64, bool, error)
- func (s *MdbxStore) BorStartEventId(ctx context.Context, hash libcommon.Hash, blockHeight uint64) (uint64, error)
- func (s *MdbxStore) Close()
- func (s *MdbxStore) EventTxnToBlockNum(ctx context.Context, borTxHash libcommon.Hash) (uint64, bool, error)
- func (s *MdbxStore) Events(ctx context.Context, start, end uint64) ([][]byte, error)
- func (s *MdbxStore) EventsByBlock(ctx context.Context, hash libcommon.Hash, blockHeight uint64) ([]rlp.RawValue, error)
- func (s *MdbxStore) EventsByIdFromSnapshot(from uint64, to time.Time, limit int) ([]*heimdall.EventRecordWithTime, bool, error)
- func (s *MdbxStore) LastEventId(ctx context.Context) (uint64, error)
- func (s *MdbxStore) LastEventIdWithinWindow(ctx context.Context, fromId uint64, toTime time.Time) (uint64, error)
- func (s *MdbxStore) LastFrozenEventBlockNum() uint64
- func (s *MdbxStore) LastFrozenEventId() uint64
- func (s *MdbxStore) LastProcessedBlockInfo(ctx context.Context) (ProcessedBlockInfo, bool, error)
- func (s *MdbxStore) LastProcessedEventId(ctx context.Context) (uint64, error)
- func (s *MdbxStore) Prepare(ctx context.Context) error
- func (s *MdbxStore) PruneEvents(ctx context.Context, blocksTo uint64, blocksDeleteLimit int) (deleted int, err error)
- func (s *MdbxStore) PutBlockNumToEventId(ctx context.Context, blockNumToEventId map[uint64]uint64) error
- func (s *MdbxStore) PutEventTxnToBlockNum(ctx context.Context, eventTxnToBlockNum map[libcommon.Hash]uint64) error
- func (s *MdbxStore) PutEvents(ctx context.Context, events []*heimdall.EventRecordWithTime) error
- func (s *MdbxStore) PutProcessedBlockInfo(ctx context.Context, info []ProcessedBlockInfo) error
- func (s *MdbxStore) RangeExtractor() snaptype.RangeExtractor
- func (s *MdbxStore) Unwind(ctx context.Context, blockNum uint64) error
- func (s *MdbxStore) WithTx(tx kv.Tx) Store
- type ProcessedBlockInfo
- type Reader
- type ReaderConfig
- type RemoteReader
- type Service
- func (s *Service) Close()
- func (s *Service) EventTxnLookup(ctx context.Context, borTxHash libcommon.Hash) (uint64, bool, error)
- func (s *Service) Events(ctx context.Context, blockNum uint64) ([]*types.Message, error)
- func (s *Service) InitialBlockReplayNeeded(ctx context.Context) (uint64, bool, error)
- func (s *Service) ProcessNewBlocks(ctx context.Context, blocks []*types.Block) error
- func (s *Service) Ready(ctx context.Context) <-chan error
- func (s *Service) ReplayInitialBlock(ctx context.Context, block *types.Block) error
- func (s *Service) Run(ctx context.Context) error
- func (s *Service) Synchronize(ctx context.Context, blockNum uint64) error
- func (s *Service) Unwind(ctx context.Context, blockNum uint64) error
- type ServiceConfig
- type SnapshotStore
- func (s *SnapshotStore) BlockEventIdsRange(ctx context.Context, blockNum uint64) (uint64, uint64, bool, error)
- func (s *SnapshotStore) BorStartEventId(ctx context.Context, hash libcommon.Hash, blockHeight uint64) (uint64, error)
- func (s *SnapshotStore) EventTxnToBlockNum(ctx context.Context, txnHash libcommon.Hash) (uint64, bool, error)
- func (s *SnapshotStore) Events(ctx context.Context, start, end uint64) ([][]byte, error)
- func (s *SnapshotStore) EventsByBlock(ctx context.Context, hash libcommon.Hash, blockHeight uint64) ([]rlp.RawValue, error)
- func (s *SnapshotStore) EventsByIdFromSnapshot(from uint64, to time.Time, limit int) ([]*heimdall.EventRecordWithTime, bool, error)
- func (s *SnapshotStore) LastEventId(ctx context.Context) (uint64, error)
- func (s *SnapshotStore) LastFrozenEventBlockNum() uint64
- func (s *SnapshotStore) LastFrozenEventId() uint64
- func (s *SnapshotStore) LastProcessedBlockInfo(ctx context.Context) (ProcessedBlockInfo, bool, error)
- func (s *SnapshotStore) LastProcessedEventId(ctx context.Context) (uint64, error)
- func (s *SnapshotStore) Prepare(ctx context.Context) error
- func (s *SnapshotStore) RangeExtractor() snaptype.RangeExtractor
- func (s *SnapshotStore) WithTx(tx kv.Tx) Store
- type Store
Constants ¶
This section is empty.
Variables ¶
var APIVersion = &typesproto.VersionReply{Major: 1, Minor: 0, Patch: 0}
Functions ¶
func NewStateSyncEventMessages ¶
func NewStateSyncEventMessages(stateSyncEvents []rlp.RawValue, stateReceiverContract *libcommon.Address, gasLimit uint64) []*types.Message
NewStateSyncEventMessages creates a corresponding message that can be passed to EVM for multiple state sync events
func NewTxStore ¶
func UnwindBlockNumToEventID ¶
UnwindBlockNumToEventID deletes data in kv.BorEventProcessedBlocks. The blockNum parameter is exclusive, i.e. only data in the range (blockNum, last] is deleted.
func UnwindEventProcessedBlocks ¶
UnwindEventProcessedBlocks deletes data in kv.BorEventProcessedBlocks. The blockNum parameter is exclusive, i.e. only data in the range (blockNum, last] is deleted.
func UnwindEventTxnToBlockNum ¶
UnwindEventTxnToBlockNum deletes data in kv.BorTxLookup. The blockNum parameter is exclusive, i.e. only data in the range (blockNum, last] is deleted.
Types ¶
type BackendServer ¶
type BackendServer struct { remoteproto.UnimplementedBridgeBackendServer // must be embedded to have forward compatible implementations. // contains filtered or unexported fields }
func NewBackendServer ¶
func NewBackendServer(ctx context.Context, bridgeReader bridgeReader) *BackendServer
func (*BackendServer) BorEvents ¶
func (b *BackendServer) BorEvents(ctx context.Context, in *remoteproto.BorEventsRequest) (*remoteproto.BorEventsReply, error)
func (*BackendServer) BorTxnLookup ¶
func (b *BackendServer) BorTxnLookup(ctx context.Context, in *remoteproto.BorTxnLookupRequest) (*remoteproto.BorTxnLookupReply, error)
func (*BackendServer) Version ¶
func (b *BackendServer) Version(ctx context.Context, in *emptypb.Empty) (*typesproto.VersionReply, error)
type MdbxStore ¶
type MdbxStore struct {
// contains filtered or unexported fields
}
func NewDbStore ¶
func NewMdbxStore ¶
func (*MdbxStore) BlockEventIdsRange ¶
func (s *MdbxStore) BlockEventIdsRange(ctx context.Context, blockNum uint64) (uint64, uint64, bool, error)
BlockEventIdsRange returns the [start, end] event Id for the given block number If the given block number is the first in the database, then the first uint64 (representing start Id) is 0.
func (*MdbxStore) BorStartEventId ¶
func (*MdbxStore) EventTxnToBlockNum ¶
func (*MdbxStore) EventsByBlock ¶
func (*MdbxStore) EventsByIdFromSnapshot ¶
func (*MdbxStore) LastEventId ¶
LastEventId the latest state sync event Id in given DB, 0 if DB is empty NOTE: Polygon sync events start at index 1
func (*MdbxStore) LastEventIdWithinWindow ¶
func (s *MdbxStore) LastEventIdWithinWindow(ctx context.Context, fromId uint64, toTime time.Time) (uint64, error)
LastEventIdWithinWindow gets the last event id where event.Id >= fromId and event.Time < toTime.
func (*MdbxStore) LastFrozenEventBlockNum ¶
func (*MdbxStore) LastFrozenEventId ¶
func (*MdbxStore) LastProcessedBlockInfo ¶
func (*MdbxStore) LastProcessedEventId ¶
LastProcessedEventId gets the last seen event Id in the BorEventNums table
func (*MdbxStore) PruneEvents ¶
func (*MdbxStore) PutBlockNumToEventId ¶
func (*MdbxStore) PutEventTxnToBlockNum ¶
func (*MdbxStore) PutProcessedBlockInfo ¶
func (s *MdbxStore) PutProcessedBlockInfo(ctx context.Context, info []ProcessedBlockInfo) error
func (*MdbxStore) RangeExtractor ¶
func (s *MdbxStore) RangeExtractor() snaptype.RangeExtractor
type ProcessedBlockInfo ¶
func (*ProcessedBlockInfo) MarshallBytes ¶
func (info *ProcessedBlockInfo) MarshallBytes() (key []byte, value []byte)
func (*ProcessedBlockInfo) UnmarshallBytes ¶
func (info *ProcessedBlockInfo) UnmarshallBytes(key []byte, value []byte)
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
func AssembleReader ¶
func AssembleReader(ctx context.Context, config ReaderConfig) (*Reader, error)
func (*Reader) EventTxnLookup ¶
type ReaderConfig ¶
type RemoteReader ¶
type RemoteReader struct {
// contains filtered or unexported fields
}
func NewRemoteReader ¶
func NewRemoteReader(client remote.BridgeBackendClient) *RemoteReader
func (*RemoteReader) Close ¶
func (r *RemoteReader) Close()
func (*RemoteReader) EnsureVersionCompatibility ¶
func (r *RemoteReader) EnsureVersionCompatibility() bool
func (*RemoteReader) EventTxnLookup ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(config ServiceConfig) *Service
func (*Service) EventTxnLookup ¶
func (*Service) InitialBlockReplayNeeded ¶
func (*Service) ProcessNewBlocks ¶
ProcessNewBlocks iterates through all blocks and constructs a map from block number to sync events
func (*Service) ReplayInitialBlock ¶
func (*Service) Synchronize ¶
Synchronize blocks until events up to a given block are processed.
type ServiceConfig ¶
type SnapshotStore ¶
type SnapshotStore struct { Store // contains filtered or unexported fields }
func NewSnapshotStore ¶
func NewSnapshotStore(base Store, snapshots *heimdall.RoSnapshots, sprintLengthCalculator sprintLengthCalculator) *SnapshotStore
func (*SnapshotStore) BlockEventIdsRange ¶
func (*SnapshotStore) BorStartEventId ¶
func (*SnapshotStore) EventTxnToBlockNum ¶
func (*SnapshotStore) EventsByBlock ¶
func (*SnapshotStore) EventsByIdFromSnapshot ¶
func (s *SnapshotStore) EventsByIdFromSnapshot(from uint64, to time.Time, limit int) ([]*heimdall.EventRecordWithTime, bool, error)
EventsByIdFromSnapshot returns the list of records limited by time, or the number of records along with a bool value to signify if the records were limited by time
func (*SnapshotStore) LastEventId ¶
func (s *SnapshotStore) LastEventId(ctx context.Context) (uint64, error)
func (*SnapshotStore) LastFrozenEventBlockNum ¶
func (s *SnapshotStore) LastFrozenEventBlockNum() uint64
func (*SnapshotStore) LastFrozenEventId ¶
func (s *SnapshotStore) LastFrozenEventId() uint64
func (*SnapshotStore) LastProcessedBlockInfo ¶
func (s *SnapshotStore) LastProcessedBlockInfo(ctx context.Context) (ProcessedBlockInfo, bool, error)
func (*SnapshotStore) LastProcessedEventId ¶
func (s *SnapshotStore) LastProcessedEventId(ctx context.Context) (uint64, error)
func (*SnapshotStore) RangeExtractor ¶
func (s *SnapshotStore) RangeExtractor() snaptype.RangeExtractor
type Store ¶
type Store interface { Prepare(ctx context.Context) error Close() LastEventId(ctx context.Context) (uint64, error) LastEventIdWithinWindow(ctx context.Context, fromID uint64, toTime time.Time) (uint64, error) LastProcessedEventId(ctx context.Context) (uint64, error) LastProcessedBlockInfo(ctx context.Context) (ProcessedBlockInfo, bool, error) LastFrozenEventId() uint64 LastFrozenEventBlockNum() uint64 EventTxnToBlockNum(ctx context.Context, borTxHash libcommon.Hash) (uint64, bool, error) Events(ctx context.Context, start, end uint64) ([][]byte, error) BlockEventIdsRange(ctx context.Context, blockNum uint64) (start uint64, end uint64, ok bool, err error) // [start,end) PutEventTxnToBlockNum(ctx context.Context, eventTxnToBlockNum map[libcommon.Hash]uint64) error PutEvents(ctx context.Context, events []*heimdall.EventRecordWithTime) error PutBlockNumToEventId(ctx context.Context, blockNumToEventId map[uint64]uint64) error PutProcessedBlockInfo(ctx context.Context, info []ProcessedBlockInfo) error Unwind(ctx context.Context, blockNum uint64) error // block reader compatibility BorStartEventId(ctx context.Context, hash libcommon.Hash, blockHeight uint64) (uint64, error) EventsByBlock(ctx context.Context, hash libcommon.Hash, blockNum uint64) ([]rlp.RawValue, error) EventsByIdFromSnapshot(from uint64, to time.Time, limit int) ([]*heimdall.EventRecordWithTime, bool, error) PruneEvents(ctx context.Context, blocksTo uint64, blocksDeleteLimit int) (deleted int, err error) }