Documentation ¶
Overview ¶
Package syncer provides functionality for ...
Index ¶
- Variables
- func InjectSubscribers(service *Service, network utils.Network, networkId utils.NetworkID) error
- func RegisterService(ctx *cli.Context, baseService service.Service) (service.Service, error)
- type Service
- type SourcesInterceptor
- func (i *SourcesInterceptor) Ch() chan *events.UnpackSources
- func (i *SourcesInterceptor) QueueSourceFn(network utils.Network, networkId utils.NetworkID, ...) subscribers.SourcesHookFn
- func (i *SourcesInterceptor) Start() error
- func (i *SourcesInterceptor) Stop() error
- func (i *SourcesInterceptor) Unpack(event *events.UnpackSources) error
Constants ¶
This section is empty.
Variables ¶
var SourcesSubscriber subscribers.SubscriberType = "sources"
SourcesSubscriber is a constant SubscriberType used to subscribe to new sources events.
Functions ¶
func InjectSubscribers ¶
InjectSubscribers will look into map of the subscribers and attempt to register them against subscriber manager. In case of any issues, it will sequentially fail. It's deliberate to fail on sequence instead of spawning goroutines and returning back errors.
Types ¶
type Service ¶
type Service struct { *service.BaseService // contains filtered or unexported fields }
Service represents the Syncer service for managing access control lists.
func NewService ¶
func NewService(ctx *cli.Context, baseService *service.BaseService) (*Service, error)
NewService creates a new instance of the Syncer service.
It initializes the service with the provided CLI context and base service.
func (*Service) Dependencies ¶
func (s *Service) Dependencies() map[service.DependencyName]service.Option
Dependencies returns the dependencies required by the Syncer service.
type SourcesInterceptor ¶
type SourcesInterceptor struct { *Service // contains filtered or unexported fields }
SourcesInterceptor manages the interception and processing of blockchain smart contract sources events.
func NewSourcesInterceptor ¶
func NewSourcesInterceptor(ctx context.Context, svc *Service, opts *options.Subscriber) (*SourcesInterceptor, error)
NewSourcesInterceptor creates a new BlockInterceptor. This constructor requires a Service and options.Subscriber options to set up the interceptor. It returns an error if any input is nil or the options are invalid.
func (*SourcesInterceptor) Ch ¶
func (i *SourcesInterceptor) Ch() chan *events.UnpackSources
Ch returns the channel that receives block events for processing.
func (*SourcesInterceptor) QueueSourceFn ¶
func (i *SourcesInterceptor) QueueSourceFn(network utils.Network, networkId utils.NetworkID, direction helpers.SyncDirection) subscribers.SourcesHookFn
QueueSourceFn returns a function that queues a sources for processing based on the given network and sync direction. This function is typically used as a callback in blockchain event listeners to forward sources to the interceptor.
func (*SourcesInterceptor) Start ¶
func (i *SourcesInterceptor) Start() error
Start initializes the block processing workers. This method starts the worker pool which listens for new sources and processes them.
func (*SourcesInterceptor) Stop ¶
func (i *SourcesInterceptor) Stop() error
Stop halts the processing of block events and closes the event channel. It ensures a graceful shutdown of the block interceptor's workers.
func (*SourcesInterceptor) Unpack ¶
func (i *SourcesInterceptor) Unpack(event *events.UnpackSources) error
Unpack processes an individual sources event, if they do not exist on the current machine, they will be saved.