replication

package
v4.1.23 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrRetryable = errors.New("retryable replication error")

ErrRetryable is a custom error to retry the logic when returned.

Functions

func WTSetToCSM

func WTSetToCSM(wtSet *wal.WTSet) (io.ColumnSeriesMap, error)

WTSetToCSM converts wal.WTSet to ColumnSeriesMap.

Types

type GRPCClient

type GRPCClient interface {
	Connect(ctx context.Context) error
	Recv() ([]byte, error)
}

GRPCClient is an interface to abstract GRPCReplicationClient.

type GRPCReplicationClient

type GRPCReplicationClient struct {
	Client pb.ReplicationClient
	// contains filtered or unexported fields
}

func NewGRPCReplicationClient

func NewGRPCReplicationClient(client pb.ReplicationClient) *GRPCReplicationClient

func (*GRPCReplicationClient) Connect

func (rc *GRPCReplicationClient) Connect(ctx context.Context) error

func (*GRPCReplicationClient) Recv

func (rc *GRPCReplicationClient) Recv() ([]byte, error)

Recv blocks until it receives a response from gRPC stream connection.

type GRPCReplicationServer

type GRPCReplicationServer struct {
	pb.UnimplementedReplicationServer
	CertFile    string
	CertKeyFile string
	// Key: IPAddr (e.g. "192.125.18.1:25"), Value: channel for messages sent to each gRPC stream
	StreamChannels map[string]chan []byte
}

func NewGRPCReplicationServer added in v4.1.18

func NewGRPCReplicationServer() *GRPCReplicationServer

func (*GRPCReplicationServer) GetWALStream

func (*GRPCReplicationServer) SendReplicationMessage

func (rs *GRPCReplicationServer) SendReplicationMessage(transactionGroup []byte)

type Receiver

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

func NewReceiver

func NewReceiver(grpcClient GRPCClient, replayer Replayer) *Receiver

func (*Receiver) Run

func (r *Receiver) Run(ctx context.Context) error

type Replayer

type Replayer interface {
	Replay(transactionGroup []byte) error
}

type ReplayerImpl

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

func NewReplayer

func NewReplayer(
	parseTGFunc func(tgSerialized []byte, rootPath string) (TGID int64, wtSets []wal.WTSet),
	writeFunc func(csm io.ColumnSeriesMap, isVariableLength bool) (err error),
	rootDir string,
) *ReplayerImpl

func (*ReplayerImpl) Replay

func (r *ReplayerImpl) Replay(transactionGroup []byte) error

type Retryer added in v4.1.13

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

func NewRetryer added in v4.1.1

func NewRetryer(retryFunc func(ctx context.Context) error, interval time.Duration, backoffCoeff int) *Retryer

func (*Retryer) Run added in v4.1.13

func (r *Retryer) Run(ctx context.Context) error

Run tries the Retryer until it succeeds, it returns unretriable error, or the context is canceled.

type Sender

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

func NewSender

func NewSender(service Service) *Sender

func (*Sender) Run

func (s *Sender) Run(ctx context.Context)

func (*Sender) Send

func (s *Sender) Send(transactionGroup []byte)

type Service

type Service interface {
	SendReplicationMessage(transactionGroup []byte)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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