log

package
v0.0.0-...-1b4ec53 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const RaftRPC = 1

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Raft struct {
		raft.Config
		BindAddr    string
		StreamLayer *StreamLayer
		Bootstrap   bool
	}
	Segment struct {
		MaxStoreBytes uint64
		MaxIndexBytes uint64
		InitialOffset uint64
	}
}

type DistributedLog

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

func NewDistributedLog

func NewDistributedLog(dataDir string, config Config) (*DistributedLog, error)

func (*DistributedLog) Append

func (l *DistributedLog) Append(record *api.Record) (uint64, error)

func (*DistributedLog) Close

func (l *DistributedLog) Close() error

func (*DistributedLog) GetServers

func (l *DistributedLog) GetServers() ([]*api.Server, error)

func (*DistributedLog) Join

func (l *DistributedLog) Join(id, addr string) error

func (*DistributedLog) Leave

func (l *DistributedLog) Leave(id string) error

func (*DistributedLog) Read

func (l *DistributedLog) Read(offset uint64) (*api.Record, error)

func (*DistributedLog) WaitForLeader

func (l *DistributedLog) WaitForLeader(timeout time.Duration) error

type Log

type Log struct {
	Dir    string
	Config Config
	// contains filtered or unexported fields
}

func NewLog

func NewLog(dir string, c Config) (*Log, error)

func (*Log) Append

func (l *Log) Append(record *api.Record) (uint64, error)

func (*Log) Close

func (l *Log) Close() error

func (*Log) HighestOffset

func (l *Log) HighestOffset() (uint64, error)

func (*Log) LowestOffset

func (l *Log) LowestOffset() (uint64, error)

func (*Log) Read

func (l *Log) Read(off uint64) (*api.Record, error)

func (*Log) Reader

func (l *Log) Reader() io.Reader

func (*Log) Remove

func (l *Log) Remove() error

func (*Log) Reset

func (l *Log) Reset() error

func (*Log) Truncate

func (l *Log) Truncate(lowest uint64) error

type RequestType

type RequestType uint8
const (
	AppendRequestType RequestType = 0
)

type StreamLayer

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

func NewStreamLayer

func NewStreamLayer(
	ln net.Listener,
	serverTLSConfig,
	peerTLSConfig *tls.Config,
) *StreamLayer

func (*StreamLayer) Accept

func (s *StreamLayer) Accept() (net.Conn, error)

func (*StreamLayer) Addr

func (s *StreamLayer) Addr() net.Addr

func (*StreamLayer) Close

func (s *StreamLayer) Close() error

func (*StreamLayer) Dial

func (s *StreamLayer) Dial(
	addr raft.ServerAddress,
	timeout time.Duration,
) (net.Conn, error)

Jump to

Keyboard shortcuts

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