replicator

package
v0.0.0-...-5c706e2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrUnhandledWorkerEvent

type ErrUnhandledWorkerEvent struct {
	Evt string
}

ErrUnhandledWorkerEvent is a typed error that replicator can return if it receives any unhandled event

func NewUnhandledEvtErr

func NewUnhandledEvtErr(evt string) *ErrUnhandledWorkerEvent

NewUnhandledEvtErr returns an unhandled type error. TODO move this to errors package once we enable monitoring to capture err counts

func (*ErrUnhandledWorkerEvent) Error

func (e *ErrUnhandledWorkerEvent) Error() string

type MigrationEvent

type MigrationEvent struct {
	// contains filtered or unexported fields
}

MigrationEvent captures unit work of replication based on the key, value and the event type. SET/DEL

func (*MigrationEvent) Do

func (m *MigrationEvent) Do(workerID int) (err error)

Do implements the core business logic of migration. We ensure a single instance of worker active. TODO investigate if the we can take fine grained lock per keys. This will improve locking performance.

func (*MigrationEvent) String

func (m *MigrationEvent) String() string

type Replicator

type Replicator struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Replicator implements redis migration

func NewReplicator

func NewReplicator(log *logrus.Entry, srcAddr, dstAddr string, workerCount int) (*Replicator, error)

NewReplicator returns an instantiated replicator instance

func (*Replicator) Close

func (r *Replicator) Close()

Close cleans up the src and dst redis client conn handlers.

func (*Replicator) Migrate

func (r *Replicator) Migrate() error

Migrate migrates all new key values to dest redis

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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