synapse

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DATA_FILE_NAME               = "data"
	OFFSET_FILE_NAME             = "offset"
	INDEX_FILE_NAME              = "index"
	OFFSET_BUFFER_MAX_SIZE int64 = 4096
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Broker

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

func NewBroker

func NewBroker(id int, namespace string, filepath string, writeBufferSize int) *Broker

func (*Broker) AdvanceReadIndex added in v0.2.1

func (b *Broker) AdvanceReadIndex() error

used by Raft to commit a read across all nodes

func (*Broker) Initialize

func (b *Broker) Initialize() error

func (*Broker) PeekOne added in v0.2.1

func (b *Broker) PeekOne() ([]byte, error)

func (*Broker) Print

func (b *Broker) Print()

func (*Broker) Write

func (b *Broker) Write(data []byte) error

type Command added in v0.2.1

type Command struct {
	Type      CommandType
	Namespace string
	Data      []byte
}

type CommandType added in v0.2.1

type CommandType byte
const (
	CmdProduce CommandType = 0x01
	CmdConsume CommandType = 0x02
)

type LagSnapshot added in v0.2.1

type LagSnapshot struct {
	Namespace string `json:"namespace"`
	Lag       int64  `json:"lag"`
}

type Server

type Server struct {
	Port    int
	Brokers map[string]*Broker
	// contains filtered or unexported fields
}

func NewServer

func NewServer(port int, filepath string, bufferSize int, log *zap.Logger) *Server

func (*Server) GetLagSnapshot added in v0.2.1

func (s *Server) GetLagSnapshot() []LagSnapshot

func (*Server) SetupRaft added in v0.2.1

func (s *Server) SetupRaft(serverID, advertiseAddr, bindAddr string, bootstrapPeers map[string]string) error

func (*Server) Start

func (s *Server) Start() error

Jump to

Keyboard shortcuts

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