replication

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: May 25, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MasterType = "master"
	SlaveType  = "slave"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Master

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

func NewMaster

func NewMaster(logger *slog.Logger, sd SegmentDirectory, opts ...network.TCPServerOption) (*Master, error)

func (*Master) IsSlave

func (m *Master) IsSlave() bool

func (*Master) Shutdown

func (m *Master) Shutdown(ctx context.Context) error

type SegmentDirectory

type SegmentDirectory interface {
	ContentByName(name string) ([]byte, error)
	NextRotatedSegmentName(from string) (string, error)
	LastSegmentName() (string, error)
	Save(name string, data []byte) error
}

type Slave

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

func NewSlave

func NewSlave(
	logger *slog.Logger,
	sd SegmentDirectory,
	masterAddr string,
	syncInterval time.Duration,
	opts ...network.TCPClientOption,
) (*Slave, error)

func (*Slave) IsSlave

func (s *Slave) IsSlave() bool

func (*Slave) Shutdown

func (s *Slave) Shutdown(ctx context.Context) (err error)

func (*Slave) StartHandle

func (s *Slave) StartHandle(fn func(cid compute.CommandID, args []string) error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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