raft

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2025 License: MIT Imports: 25 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 Node

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

func NewNode

func NewNode(db *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) 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) Leader

func (n *Node) Leader() string

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) 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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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