syncer

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartSyncer

func StartSyncer(syncers ...DataSyncInterface) error

func StartSyncerOnTime

func StartSyncerOnTime(syncers ...DataSyncInterface) error

func SyncOnce

func SyncOnce(s DataSyncInterface) error

SyncOnce to immediately execute the synchronization logic once

Types

type DataSyncInterface

type DataSyncInterface interface {
	store.SyncerPosInterface
	// Name define the syncer name
	Name() string
	// SetPosStore set position store
	SetPosStore(store.SyncerPosInterface)
	// QueryCount function for total data count retrieval
	QueryCount(start, end time.Time) (int64, error)
	// QueryData function for data retrieval
	QueryData(offset, limit int, start, end time.Time) (interface{}, int64, error)
	// Sink function for data synchronization logic
	Sink(data interface{}) error
	// InitData function for initialization logic before data synchronization logic
	InitData() error
	// InitialPos for the position during the initial synchronization
	InitialPos() (int64, int64, int64)
	// NextPos for the position of the next data synchronization
	NextPos(start, end, pos int64) (int64, int64, int64)
	// Interval for the synchronization interval
	Interval() error
}

type DummySyncer

type DummySyncer struct {
	SyncerName string
	store.SyncerPosInterface
}

func (*DummySyncer) InitData

func (s *DummySyncer) InitData() error

func (*DummySyncer) InitialPos

func (s *DummySyncer) InitialPos() (int64, int64, int64)

func (*DummySyncer) Interval

func (s *DummySyncer) Interval() error

func (*DummySyncer) Name

func (s *DummySyncer) Name() string

func (*DummySyncer) NextPos

func (s *DummySyncer) NextPos(start, end, pos int64) (int64, int64, int64)

func (*DummySyncer) QueryCount

func (s *DummySyncer) QueryCount(start, end time.Time) (int64, error)

func (*DummySyncer) QueryData

func (s *DummySyncer) QueryData(offset, limit int, start, end time.Time) (interface{}, int64, error)

func (*DummySyncer) SetPosStore

func (s *DummySyncer) SetPosStore(store store.SyncerPosInterface)

func (*DummySyncer) Sink

func (s *DummySyncer) Sink(interface{}) error

type Options

type Options struct {
	StartHour  int `yaml:"start_hour"`
	EndHour    int `yaml:"end_hour"`
	BatchLimit int `yaml:"batch_limit"`
	Interval   int `yaml:"interval"`
}

func NewDefaultOpt

func NewDefaultOpt() *Options

Jump to

Keyboard shortcuts

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