ckpt

package
v0.0.0-...-c497fb9 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	StorageTypeAPI            = "api"
	StorageTypeDB             = "database"
	CheckpointDefaultDatabase = utils.AppDatabase
	CheckpointName            = "name"

	MajorityWriteConcern = "majority"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Checkpoint

type Checkpoint struct {
	Name          string
	StartPosition int64
}

type CheckpointContext

type CheckpointContext struct {
	Name      string              `bson:"name" json:"name"`
	Timestamp bson.MongoTimestamp `bson:"ckpt" json:"ckpt"`
}

type CheckpointManager

type CheckpointManager struct {
	Type string
	// contains filtered or unexported fields
}

func NewCheckpointManager

func NewCheckpointManager(name string) *CheckpointManager

func (*CheckpointManager) Get

func (manager *CheckpointManager) Get() *CheckpointContext

func (*CheckpointManager) GetInMemory

func (manager *CheckpointManager) GetInMemory() *CheckpointContext

func (*CheckpointManager) Update

func (manager *CheckpointManager) Update(ts bson.MongoTimestamp) error

type CheckpointOperation

type CheckpointOperation interface {
	// read checkpoint from remote storage. and encapsulation
	// with CheckpointContext struct
	Get() *CheckpointContext

	// save checkpoint
	Insert(ckpt *CheckpointContext) error
}

type HttpApiCheckpoint

type HttpApiCheckpoint struct {
	Checkpoint

	URL string
}

func (*HttpApiCheckpoint) Get

func (ckpt *HttpApiCheckpoint) Get() *CheckpointContext

func (*HttpApiCheckpoint) Insert

func (ckpt *HttpApiCheckpoint) Insert(insert *CheckpointContext) error

type MongoCheckpoint

type MongoCheckpoint struct {
	Checkpoint

	Conn        *dbpool.MongoConn
	QueryHandle *mgo.Collection

	// connection info
	URL       string
	DB, Table string
}

func (*MongoCheckpoint) Get

func (ckpt *MongoCheckpoint) Get() *CheckpointContext

func (*MongoCheckpoint) Insert

func (ckpt *MongoCheckpoint) Insert(updates *CheckpointContext) error

Jump to

Keyboard shortcuts

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