replica

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2023 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	MasterIP       string
	MasterPort     int
	MasterUser     string
	MasterPassword string

	AnnounceIP   string
	AnnouncePort int

	// Send command (PSYNC MasterReplicaId MasterReplicaOffset) to master.
	// Replica will start a partial synchronization if replicaId and offset exist in master.
	// Set ContinueIfPartialFailed true if you hope do a full synchronized after partial synchronization failed.
	MasterReplicaId     string
	MasterReplicaOffset int

	// Whether to do a full synchronized after partial synchronization failed.
	ContinueIfPartialFailed bool

	// Receive RDB from master in full synchronization. RdbWriter will be closed when full synchronization finished.
	RdbWriter io.WriteCloser

	// Whether to continue incremental synchronization(AOF) after full synchronization.
	ContinueAfterFullSync bool

	// Receive AOF byte stream after full synchronization if ContinueAfterFullSync is true.
	// Receive all AOF bytes stream in partial synchronization.
	AofWriter io.Writer
}

type Replica

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

func NewReplica

func NewReplica(config *Config) (*Replica, error)

func (*Replica) Close

func (r *Replica) Close() error

func (*Replica) SyncWithMaster

func (r *Replica) SyncWithMaster() error

SyncWithMaster establish a connection with the master, and sync data from master. replication.c::syncWithMaster

Jump to

Keyboard shortcuts

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