Documentation ¶
Index ¶
- type MySQLTrackerStorage
- func (mts *MySQLTrackerStorage) DB() sqlxCommon
- func (mts *MySQLTrackerStorage) GetProgress(dbName string, tableName string) (*Progress, error)
- func (mts *MySQLTrackerStorage) Prepare() error
- func (mts *MySQLTrackerStorage) UpdateProgress(prgs *Progress) (*Progress, error)
- func (mts *MySQLTrackerStorage) WithTx(f func() error) (err error)
- type Position
- type Progress
- type TrackerClient
- type TrackerStorage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MySQLTrackerStorage ¶
type MySQLTrackerStorage struct {
// contains filtered or unexported fields
}
MySQLTrackerStorage implements TrackerStorage for MySQL
func BuildMySQLTrackerStorage ¶
func BuildMySQLTrackerStorage() (*MySQLTrackerStorage, error)
BuildMySQLTrackerStorage builds MySQL specific TrackerStorage
func (*MySQLTrackerStorage) DB ¶
func (mts *MySQLTrackerStorage) DB() sqlxCommon
DB provides access to db handler properly to process tx operation
func (*MySQLTrackerStorage) GetProgress ¶
func (mts *MySQLTrackerStorage) GetProgress(dbName string, tableName string) (*Progress, error)
GetProgress fetches progress associated w/ given source
func (*MySQLTrackerStorage) Prepare ¶
func (mts *MySQLTrackerStorage) Prepare() error
func (*MySQLTrackerStorage) UpdateProgress ¶
func (mts *MySQLTrackerStorage) UpdateProgress(prgs *Progress) (*Progress, error)
UpdateProgress updates progress's position
func (*MySQLTrackerStorage) WithTx ¶
func (mts *MySQLTrackerStorage) WithTx(f func() error) (err error)
WithTx provides transactional operation for given func
type Position ¶
type Position = int64
Position represents the AutoIncrement value coupled w/ TrackKey
type Progress ¶
type Progress struct { ID int64 `db:"id"` DatabaseName string `db:"database_name"` TableName string `db:"table_name"` TrackKey string `db:"track_key"` Position Position `db:"position"` }
Progress represents mining progress on DataSource Source has_one Progress
type TrackerClient ¶
type TrackerClient struct {
TrackerStorage
}
TrackerClient provide accesses for DataSource Progress by implements TrackerStorage interface
func BuildTrackerClient ¶
func BuildTrackerClient() (*TrackerClient, error)
BuildMySQLClient builds MySQL specific SourceClient
func (*TrackerClient) GetNextPosition ¶
func (tc *TrackerClient) GetNextPosition(dbName string, tableName string) (Position, error)
GetNextPosition returns next id after the last-published record
func (*TrackerClient) UpdatePosition ¶
func (tc *TrackerClient) UpdatePosition(dbName string, tableName string, position Position) error
UpdatePosition updates Progress's Position
type TrackerStorage ¶
type TrackerStorage interface { WithTx(f func() error) error Prepare() error GetProgress(dbName string, tableName string) (*Progress, error) UpdateProgress(progress *Progress) (*Progress, error) }
TrackerStorage provide access to persisted Progress
func BuildTrackerStorage ¶
func BuildTrackerStorage() (TrackerStorage, error)
BuildTrackerStorage builds TrackerStorage for abstraction