Documentation
¶
Index ¶
- Constants
- Variables
- func CompareCursors(cursor1, cursor2 string) (int, error)
- type Config
- type Service
- func (s *Service) Config() interface{}
- func (s *Service) Desc() string
- func (s *Service) Expose() interface{}
- func (s *Service) ID() string
- func (s *Service) Migrations() []cfg.MigrateHandler
- func (s *Service) Name() string
- func (s *Service) Needs() map[string]struct{}
- func (s *Service) Plug(exposed map[string]interface{}) error
- func (s *Service) Run(ctx context.Context, running, stopping func()) error
- func (s *Service) SetConfig(config interface{}) error
- func (s *Service) VersionKey() string
- type Synchronizer
- type WorkflowState
- type WorkflowStates
Constants ¶
const DefaultPagination = 50
DefaultPagination is the number of links fetched by API call.
const DefaultPollInterval = 10000
DefaultPollInterval is the default interval at which the livesync service calls Startumn APIs (in milliseconds).
Variables ¶
var ( // ErrNotClient is returned when the connected service is not a stratumn client. ErrNotClient = errors.New("connected service is not a stratumn client") )
Functions ¶
func CompareCursors ¶
CompareCursors returns the difference between relay cursors. Relay cursors are base64 encoded strings that look like this: ["natural",109]. The second element of the slice is the incrementing index, this is what we want to compare.
Types ¶
type Config ¶
type Config struct { // ConfigVersion is the version of the configuration file. ConfigVersion int `toml:"configuration_version" comment:"The version of the service configuration."` PollInterval time.Duration `toml:"poll_interval" comment:"The frenquency (in milliseconds) at which the livesync service polls data from Stratumn APIs."` WatchedWorkflows []string `toml:"watched_workflows" comment:"The IDs of the workflows to synchronize data from."` }
Config contains configuration options for the Livesync service.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the Livesync service.
func (*Service) Config ¶
func (s *Service) Config() interface{}
Config returns the current service configuration or creates one with good default values.
func (*Service) Expose ¶
func (s *Service) Expose() interface{}
Expose exposes the synchronizer client to other services. It exposes the Synchronizer instance.
func (*Service) Migrations ¶
func (s *Service) Migrations() []cfg.MigrateHandler
Migrations is the services migrations.
type Synchronizer ¶
type Synchronizer interface {
Register(WorkflowStates) (<-chan []*cs.Segment, error)
}
Synchronizer is the type exposed by the livesync service.
func NewSycnhronizer ¶
func NewSycnhronizer(client client.StratumnClient, watchedWorkflows []string) Synchronizer
NewSycnhronizer returns a new Synchronizer. It takes a stratumn client and a list of workflows to sync with.
type WorkflowState ¶
WorkflowState maps the ID of the workflow to the cursor of the last synced link.
type WorkflowStates ¶
type WorkflowStates []*WorkflowState
WorkflowStates is a list of WorkflowState
func (WorkflowStates) Get ¶
func (wfStates WorkflowStates) Get(id string) (*WorkflowState, bool)
Get finds a WorkflowState in the list given its ID.
Directories
¶
Path | Synopsis |
---|---|
Package mocksynchronizer is a generated GoMock package.
|
Package mocksynchronizer is a generated GoMock package. |