Versions in this module Expand all Collapse all v0 v0.43.0 Feb 13, 2025 v0.42.0 Jan 25, 2024 Changes in this version + const DefaultInstallSnapshotTimeoutScale + const DefaultLfwTimeout + const DefaultRpcTimeout + const DefaultStartupTimeout + var ErrKeyNotFound = errors.New("not found") + var ErrPipelineShutdown = fmt.Errorf("append pipeline closed") + var ErrTransportShutdown = fmt.Errorf("transport shutdown") + func DecodeMsgPack(b []byte, out any) error + func DecodeMsgPackFromReader(r io.ReadCloser, out any) error + func EncodeMsgPack(in any) ([]byte, error) + type AddVoterRequest struct + ServerAddress hraft.ServerAddress + ServerId hraft.ServerID + Timeout time.Duration + type AddVoterResponse struct + Index uint64 + type ApplyRequest struct + Command []byte + Timeout time.Duration + type ApplyResponse struct + Index uint64 + Response error + type RaftBinding struct + func (b *RaftBinding) Close() + func (b *RaftBinding) Node() *hraft.Raft + func (b *RaftBinding) NodeId() string + func (b *RaftBinding) ObserveMembershipChange(ctx context.Context) (<-chan api.MembershipChange, error) + func (b *RaftBinding) ObserveStateChange(ctx context.Context) (<-chan api.Input, error) + func (b *RaftBinding) Open(cfg *config.Config, com comapi.Api) error + func (b *RaftBinding) ProposeInput(ctx context.Context, in *api.Input) error + type RaftFsm struct + func NewRaftFsm() *RaftFsm + func (f *RaftFsm) AddStateChangeObserver(ch chan api.Input) uint64 + func (f *RaftFsm) Apply(entry *hraft.Log) any + func (f *RaftFsm) RemoveStateChangeObserver(chanId uint64) + func (f *RaftFsm) Restore(snapshot io.ReadCloser) error + func (f *RaftFsm) Snapshot() (hraft.FSMSnapshot, error) + func (f *RaftFsm) State() api.State + type RaftStore struct + SnapStore hraft.SnapshotStore + func NewRaftStore(location string) (*RaftStore, error) + func (s *RaftStore) AddMembershipChangeObserver(ch chan api.MembershipChange, raft *hraft.Raft) uint64 + func (s *RaftStore) Close(removeStorage bool) error + func (s *RaftStore) DeleteRange(min, max uint64) error + func (s *RaftStore) FirstIndex() (uint64, error) + func (s *RaftStore) Get(key []byte) ([]byte, error) + func (s *RaftStore) GetLog(index uint64, log *hraft.Log) error + func (s *RaftStore) GetUint64(key []byte) (uint64, error) + func (s *RaftStore) LastIndex() (uint64, error) + func (s *RaftStore) RemoveMembershipChangeObserver(chanId uint64) + func (s *RaftStore) Set(key []byte, val []byte) error + func (s *RaftStore) SetUint64(key []byte, val uint64) error + func (s *RaftStore) StoreLog(log *hraft.Log) error + func (s *RaftStore) StoreLogs(logs []*hraft.Log) error + type RaftTransport struct + func NewRaftTransport(config *RaftTransportConfig, addr hraft.ServerAddress, com comapi.Api) *RaftTransport + func (t *RaftTransport) AppendEntries(id hraft.ServerID, target hraft.ServerAddress, ...) error + func (t *RaftTransport) AppendEntriesPipeline(id hraft.ServerID, target hraft.ServerAddress) (hraft.AppendPipeline, error) + func (t *RaftTransport) Close() error + func (t *RaftTransport) Consumer() <-chan hraft.RPC + func (t *RaftTransport) DecodePeer(buf []byte) hraft.ServerAddress + func (t *RaftTransport) EncodePeer(id hraft.ServerID, addr hraft.ServerAddress) []byte + func (t *RaftTransport) InstallSnapshot(id hraft.ServerID, target hraft.ServerAddress, ...) error + func (t *RaftTransport) LfwAddVoter(ctx context.Context, args *AddVoterRequest, resp *AddVoterResponse) error + func (t *RaftTransport) LfwApply(ctx context.Context, args *ApplyRequest, resp *ApplyResponse) error + func (t *RaftTransport) LfwConsumer() <-chan hraft.RPC + func (t *RaftTransport) LfwRemoveServer(ctx context.Context, args *RemoveServerRequest, resp *RemoveServerResponse) error + func (t *RaftTransport) LocalAddr() hraft.ServerAddress + func (t *RaftTransport) RequestVote(id hraft.ServerID, target hraft.ServerAddress, args *hraft.RequestVoteRequest, ...) error + func (t *RaftTransport) SetHeartbeatHandler(cb func(rpc hraft.RPC)) + func (t *RaftTransport) Timeout() time.Duration + func (t *RaftTransport) TimeoutNow(id hraft.ServerID, target hraft.ServerAddress, args *hraft.TimeoutNowRequest, ...) error + type RaftTransportConfig struct + Timeout time.Duration + TimeoutScale int + type RemoveServerRequest struct + ServerId hraft.ServerID + Timeout time.Duration + type RemoveServerResponse struct + Index uint64