Documentation
¶
Index ¶
- type DataSyncService
- type HeaderSyncService
- type SyncService
- func (syncService *SyncService[H]) Start(ctx context.Context) error
- func (syncService *SyncService[H]) StartSyncer(ctx context.Context) error
- func (syncService *SyncService[H]) Stop(ctx context.Context) error
- func (syncService *SyncService[H]) Store() *goheaderstore.Store[H]
- func (syncService *SyncService[H]) WriteToStoreAndBroadcast(ctx context.Context, headerOrData H) error
- type SyncerStatus
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataSyncService ¶
type DataSyncService = SyncService[*types.Data]
DataSyncService is the P2P Sync Service for blocks.
func NewDataSyncService ¶
func NewDataSyncService( store ds.Batching, conf config.Config, genesis genesis.Genesis, p2p *p2p.Client, logger logging.EventLogger, ) (*DataSyncService, error)
NewDataSyncService returns a new DataSyncService.
type HeaderSyncService ¶
type HeaderSyncService = SyncService[*types.SignedHeader]
HeaderSyncService is the P2P Sync Service for headers.
func NewHeaderSyncService ¶
func NewHeaderSyncService( store ds.Batching, conf config.Config, genesis genesis.Genesis, p2p *p2p.Client, logger logging.EventLogger, ) (*HeaderSyncService, error)
NewHeaderSyncService returns a new HeaderSyncService.
type SyncService ¶
SyncService is the P2P Sync Service for blocks and headers.
Uses the go-header library for handling all P2P logic.
func (*SyncService[H]) Start ¶
func (syncService *SyncService[H]) Start(ctx context.Context) error
Start is a part of Service interface.
func (*SyncService[H]) StartSyncer ¶
func (syncService *SyncService[H]) StartSyncer(ctx context.Context) error
StartSyncer starts the SyncService's syncer
func (*SyncService[H]) Stop ¶
func (syncService *SyncService[H]) Stop(ctx context.Context) error
Stop is a part of Service interface.
`store` is closed last because it's used by other services.
func (*SyncService[H]) Store ¶
func (syncService *SyncService[H]) Store() *goheaderstore.Store[H]
Store returns the store of the SyncService
func (*SyncService[H]) WriteToStoreAndBroadcast ¶
func (syncService *SyncService[H]) WriteToStoreAndBroadcast(ctx context.Context, headerOrData H) error
WriteToStoreAndBroadcast initializes store if needed and broadcasts provided header or block. Note: Only returns an error in case store can't be initialized. Logs error if there's one while broadcasting.
type SyncerStatus ¶
type SyncerStatus struct {
// contains filtered or unexported fields
}
SyncerStatus is used by header and block exchange service for keeping track of the status of the syncer in them.