replication

package
v4.1.10 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRetryer added in v4.1.1

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

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 {
	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 NewGRPCReplicationService

func NewGRPCReplicationService() *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(TG_Serialized []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 RetryableError added in v4.1.1

type RetryableError string

RetryableError is a custom error to retry the logic when returned

func (RetryableError) Error added in v4.1.1

func (re RetryableError) Error() string

func (RetryableError) Is added in v4.1.1

func (re RetryableError) Is(err error) bool

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