Documentation ¶
Index ¶
- Variables
- func NewRaft[T any, T2 interfaces.Work[T]](c RaftConfig, ch chan RaftLog[T, T2]) (*raft.Raft, error)
- type Option
- func Distributor[T any, T2 interfaces.Work[T]](distrib interfaces.Distributor[T, T2]) Option[T, T2]
- func HCLogger[T any, T2 interfaces.Work[T]](logger hclog.Logger) Option[T, T2]
- func Logger[T any, T2 interfaces.Work[T]](logger interfaces.Logger) Option[T, T2]
- func RaftAdvertisedAddress[T any, T2 interfaces.Work[T]](address string) Option[T, T2]
- func RaftListeningAddressPort[T any, T2 interfaces.Work[T]](address string, port int) Option[T, T2]
- type RaftConfig
- type RaftLog
- type Rafty
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrLoggerRequired = fmt.Errorf("logger is required")
)
Functions ¶
func NewRaft ¶
func NewRaft[T any, T2 interfaces.Work[T]](c RaftConfig, ch chan RaftLog[T, T2]) (*raft.Raft, error)
Types ¶
type Option ¶
type Option[T any, T2 interfaces.Work[T]] func(*Rafty[T, T2]) error
func Distributor ¶
func Distributor[T any, T2 interfaces.Work[T]](distrib interfaces.Distributor[T, T2]) Option[T, T2]
func Logger ¶
func Logger[T any, T2 interfaces.Work[T]](logger interfaces.Logger) Option[T, T2]
func RaftAdvertisedAddress ¶
func RaftAdvertisedAddress[T any, T2 interfaces.Work[T]](address string) Option[T, T2]
type RaftConfig ¶
type RaftLog ¶
type RaftLog[T any, T2 interfaces.Work[T]] struct { Disco map[raft.ServerID][]T2 // contains filtered or unexported fields }
func (RaftLog[T, T2]) Diff ¶
func (l RaftLog[T, T2]) Diff(key raft.ServerID, targetLog RaftLog[T, T2]) (removed []int, added []int)
Diff returns the source slice indexes that needs to be removed because they are not present or have been modified in the target slice. It also returns the indexes of the target slice that needs to be added because they are not present in the source slice. This function is nil safe.
type Rafty ¶
type Rafty[T any, T2 interfaces.Work[T]] struct { // contains filtered or unexported fields }
Rafty
func New ¶
func New[T any, T2 interfaces.Work[T]](disco interfaces.Discoverer, foreman interfaces.Foreman[T, T2], start func(context.Context, T2), opts ...Option[T, T2]) (*Rafty[T, T2], error)
Directories ¶
Path | Synopsis |
---|---|
Package discovery contains utility functions for discovery.
|
Package discovery contains utility functions for discovery. |
consul
Module
|
|
dns
Module
|
|
nats
Module
|
|
distributor
|
|
consistent
Module
|
|
modulo
Module
|
|
examples
|
|
raftymcraftface
Module
|
|
Package interfaces provides all the interfaces used in Rafty.
|
Package interfaces provides all the interfaces used in Rafty. |
Package loggers contains default loggers for Rafty.
|
Package loggers contains default loggers for Rafty. |
zerolog
Module
|
Click to show internal directories.
Click to hide internal directories.