raft

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2025 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSM

type FSM struct {
	NodeID string
	// contains filtered or unexported fields
}

func (*FSM) Apply

func (f *FSM) Apply(raftLog *raft.Log) interface{}

func (*FSM) Restore

func (f *FSM) Restore(rc io.ReadCloser) error

func (*FSM) Snapshot

func (f *FSM) Snapshot() (raft.FSMSnapshot, error)

type FSMResponse

type FSMResponse struct {
	QueueName string
	ID        uint64
	Group     string
	Priority  int64
	Content   string
	Metadata  map[string]string
	// contains filtered or unexported fields
}

type FSMSnapshot

type FSMSnapshot struct {
	NodeID string
	// contains filtered or unexported fields
}

func (*FSMSnapshot) Persist

func (f *FSMSnapshot) Persist(sink raft.SnapshotSink) error

func (*FSMSnapshot) Release

func (f *FSMSnapshot) Release()

type LeaderConfig added in v0.10.0

type LeaderConfig struct {
	Id       string
	RaftAddr string
	GrpcAddr string
	// contains filtered or unexported fields
}

func NewLeaderConfig added in v0.10.0

func NewLeaderConfig(nodeID, raftAddr, grpcAddr string) *LeaderConfig

func (*LeaderConfig) GetLeaderGrpcAddress added in v0.10.0

func (c *LeaderConfig) GetLeaderGrpcAddress() string

func (*LeaderConfig) Set added in v0.10.1

func (c *LeaderConfig) Set(nodeID, raftAddr, grpcAddr string) error

type Node

type Node struct {
	Raft         *raft.Raft
	QueueManager *queue.QueueManager
	// contains filtered or unexported fields
}

func NewNode

func NewNode(db *badger.DB, raftDB *badger.DB, raftDir string, cfg *config.Config, peers []string) *Node

func (*Node) Ack

func (n *Node) Ack(QueueName string, id uint64) error

func (*Node) Backup added in v0.3.4

func (n *Node) Backup(w io.Writer, since uint64) (uint64, error)

func (*Node) CreateQueue

func (n *Node) CreateQueue(queueType, queueName string, settings entity.QueueSettings) error

func (*Node) Delete added in v0.3.0

func (n *Node) Delete(QueueName string, id uint64) error

func (*Node) DeleteQueue

func (n *Node) DeleteQueue(queueName string) error

func (*Node) Dequeue

func (n *Node) Dequeue(QueueName string, ack bool) (*entity.Message, error)

func (*Node) Enqueue

func (n *Node) Enqueue(
	queueName string, id uint64, group string, priority int64, content string, metadata map[string]string,
) (*entity.Message, error)

func (*Node) GenerateID added in v0.1.14

func (n *Node) GenerateID() uint64

func (*Node) Get added in v0.3.0

func (n *Node) Get(QueueName string, id uint64) (*entity.Message, error)

func (*Node) GetQueueInfo added in v0.2.0

func (n *Node) GetQueueInfo(queueName string) (*queue.QueueInfo, error)

func (*Node) GetQueues added in v0.2.0

func (n *Node) GetQueues() []*queue.QueueInfo

func (*Node) GetServers added in v0.10.5

func (n *Node) GetServers() ([]*entity.Server, error)

func (*Node) InitIDGenerator added in v0.1.14

func (n *Node) InitIDGenerator() error

func (*Node) Initialize

func (n *Node) Initialize()

func (*Node) IsLeader

func (n *Node) IsLeader() bool

func (*Node) Join

func (n *Node) Join(nodeID, addr string) error

func (*Node) Leave added in v0.10.4

func (n *Node) Leave(nodeID string) error

func (*Node) ListenToLeaderChanges

func (n *Node) ListenToLeaderChanges()

func (*Node) Nack added in v0.2.4

func (n *Node) Nack(QueueName string, id uint64, priority int64, metadata map[string]string) error

func (*Node) NotifyLeaderConfiguration added in v0.10.0

func (n *Node) NotifyLeaderConfiguration() error

func (*Node) PrometheusRegistry added in v0.2.0

func (n *Node) PrometheusRegistry() prometheus.Registerer

func (*Node) Restore added in v0.3.4

func (n *Node) Restore(r io.Reader, maxPendingWrites int) error

func (*Node) RunValueLogGC added in v0.3.8

func (n *Node) RunValueLogGC()

func (*Node) SetLeaderChangeFunc

func (n *Node) SetLeaderChangeFunc(leaderChangeFn func(bool))

func (*Node) UpdatePriority

func (n *Node) UpdatePriority(queueName string, id uint64, priority int64) error

func (*Node) UpdateQueue added in v0.12.0

func (n *Node) UpdateQueue(queueName string, settings entity.QueueSettings) error

Jump to

Keyboard shortcuts

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