syncer

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 29, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package syncer provides functionality for ...

Index

Constants

This section is empty.

Variables

View Source
var SourcesSubscriber subscribers.SubscriberType = "sources"

SourcesSubscriber is a constant SubscriberType used to subscribe to new sources events.

Functions

func InjectSubscribers

func InjectSubscribers(service *Service, network utils.Network, networkId utils.NetworkID) error

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.

func RegisterService

func RegisterService(ctx *cli.Context, baseService service.Service) (service.Service, error)

RegisterService registers the ACL service with the provided CLI context and base service.

It initializes a new ACL service instance and returns it as a service.Service interface.

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.

func (*Service) Start

func (s *Service) Start(network utils.Network, networkId utils.NetworkID) error

Start starts the Syncer service.

This method does nothing at the moment and may not perform any actions in the future.

func (*Service) Stop

func (s *Service) Stop() error

Stop stops the ACL service.

This method does nothing at the moment and may not perform any actions in the future.

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL