checkpoint

package
v0.0.0-...-6fba4f8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCheckPointClosed indicates the CheckPoint already closed.
	ErrCheckPointClosed = errors.New("CheckPoint already closed")
)
View Source
var ErrNoCheckpointItem = stderrors.New("no any checkpoint item")

ErrNoCheckpointItem represents there's no any checkpoint item and the cluster id must be specified for the mysql checkpoint type.

Functions

This section is empty.

Types

type CheckPoint

type CheckPoint interface {
	// Load loads checkpoint information.
	Load() error

	// Save saves checkpoint information.
	Save(commitTS int64, secondaryTS int64, consistent bool, version int64) error

	// TS gets checkpoint commit timestamp.
	TS() int64

	// SchemaVersion gets checkpoint current schemaversion.
	SchemaVersion() int64

	// IsConsistent return the Consistent status saved.
	IsConsistent() bool

	// Close closes the CheckPoint and release resources, after closed other methods should not be called again.
	Close() error
}

CheckPoint is the binlog sync pos meta. When syncer restarts, we should reload meta info to guarantee continuous transmission.

func NewCheckPoint

func NewCheckPoint(cfg *Config) (CheckPoint, error)

NewCheckPoint returns a CheckPoint instance by giving name

func NewFile

func NewFile(initialCommitTS int64, filePath string) (CheckPoint, error)

NewFile creates a new FileCheckpoint.

type Config

type Config struct {
	CheckpointType string

	Db     *DBConfig
	Schema string
	Table  string

	ClusterID       uint64
	InitialCommitTS int64
	CheckPointFile  string `toml:"dir" json:"dir"`
}

Config is the savepoint configuration

type DBConfig

type DBConfig struct {
	Host     string      `toml:"host" json:"host"`
	User     string      `toml:"user" json:"user"`
	Password string      `toml:"password" json:"password"`
	Port     int         `toml:"port" json:"port"`
	TLS      *tls.Config `toml:"-" json:"-"`
	//for oracle database
	OracleServiceName   string `toml:"oracle-service-name" json:"oracle-service-name"`
	OracleConnectString string `toml:"oracle-connect-string" json:"oracle-connect-string"`
}

DBConfig is the DB configuration.

type FileCheckPoint

type FileCheckPoint struct {
	sync.RWMutex

	ConsistentSaved bool  `toml:"consistent" json:"consistent"`
	CommitTS        int64 `toml:"commitTS" json:"commitTS"`
	Version         int64 `toml:"schema-version" json:"schema-version"`
	// contains filtered or unexported fields
}

FileCheckPoint is local CheckPoint struct.

func (*FileCheckPoint) Close

func (sp *FileCheckPoint) Close() error

Close implements CheckPoint.Close interface

func (*FileCheckPoint) IsConsistent

func (sp *FileCheckPoint) IsConsistent() bool

IsConsistent implements CheckPoint interface

func (*FileCheckPoint) Load

func (sp *FileCheckPoint) Load() error

Load implements CheckPointor.Load interface.

func (*FileCheckPoint) Save

func (sp *FileCheckPoint) Save(ts, secondaryTS int64, consistent bool, version int64) error

Save implements CheckPoint.Save interface

func (*FileCheckPoint) SchemaVersion

func (sp *FileCheckPoint) SchemaVersion() int64

SchemaVersion implements CheckPoint.SchemaVersion interface.

func (*FileCheckPoint) TS

func (sp *FileCheckPoint) TS() int64

TS implements CheckPoint.TS interface

type MysqlCheckPoint

type MysqlCheckPoint struct {
	sync.RWMutex

	ConsistentSaved bool             `toml:"consistent" json:"consistent"`
	CommitTS        int64            `toml:"commitTS" json:"commitTS"`
	TsMap           map[string]int64 `toml:"ts-map" json:"ts-map"`
	Version         int64            `toml:"schema-version" json:"schema-version"`
	// contains filtered or unexported fields
}

MysqlCheckPoint is a local savepoint struct for mysql

func (*MysqlCheckPoint) Close

func (sp *MysqlCheckPoint) Close() error

Close implements CheckPoint.Close interface

func (*MysqlCheckPoint) IsConsistent

func (sp *MysqlCheckPoint) IsConsistent() bool

IsConsistent implements CheckPoint interface

func (*MysqlCheckPoint) Load

func (sp *MysqlCheckPoint) Load() error

Load implements CheckPoint.Load interface

func (*MysqlCheckPoint) Save

func (sp *MysqlCheckPoint) Save(ts, secondaryTS int64, consistent bool, version int64) error

Save implements checkpoint.Save interface

func (*MysqlCheckPoint) SchemaVersion

func (sp *MysqlCheckPoint) SchemaVersion() int64

SchemaVersion implements CheckPoint.SchemaVersion interface.

func (*MysqlCheckPoint) TS

func (sp *MysqlCheckPoint) TS() int64

TS implements CheckPoint.TS interface

type OracleCheckPoint

type OracleCheckPoint struct {
	sync.RWMutex

	ConsistentSaved bool             `toml:"consistent" json:"consistent"`
	CommitTS        int64            `toml:"commitTS" json:"commitTS"`
	TsMap           map[string]int64 `toml:"ts-map" json:"ts-map"`
	Version         int64            `toml:"schema-version" json:"schema-version"`
	// contains filtered or unexported fields
}

OracleCheckPoint is a local savepoint struct for Oracle

func (*OracleCheckPoint) Close

func (sp *OracleCheckPoint) Close() error

Close implements CheckPoint.Close interface

func (*OracleCheckPoint) IsConsistent

func (sp *OracleCheckPoint) IsConsistent() bool

IsConsistent implements CheckPoint interface

func (*OracleCheckPoint) Load

func (sp *OracleCheckPoint) Load() error

Load implements CheckPoint.Load interface

func (*OracleCheckPoint) Save

func (sp *OracleCheckPoint) Save(ts, secondaryTS int64, consistent bool, version int64) error

Save implements checkpoint.Save interface

func (*OracleCheckPoint) SchemaVersion

func (sp *OracleCheckPoint) SchemaVersion() int64

SchemaVersion implements CheckPoint.SchemaVersion interface.

func (*OracleCheckPoint) TS

func (sp *OracleCheckPoint) TS() int64

TS implements CheckPoint.TS interface

Jump to

Keyboard shortcuts

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