Documentation
¶
Index ¶
- Constants
- Variables
- func GetLogPackHeader(r io.Reader) uint32
- func LogPackHeader(typ uint32) []byte
- func NewFSMHandlers(s store.Store) map[serverpb.RaftLogCommand]FSMHandleFunc
- func NewTLSTransport(addr string, advertise net.Addr, maxPool int, timeout time.Duration, ...) (*raft.NetworkTransport, error)
- func NewTLSTransportWithGenerator(addr string, advertise net.Addr, config *raft.NetworkTransportConfig) (*raft.NetworkTransport, error)
- func RaftLogPayloadKey(m *serverpb.RaftLogPayload) uint64
- func UnpackLog(r io.Reader) ([]*serverpb.RaftLogPayload, error)
- type ApplyFunc
- type FSM
- type FSMHandleFunc
- type FSMHandlers
- func (h *FSMHandlers) Del(payload *serverpb.RaftLogPayload) error
- func (h *FSMHandlers) Set(payload *serverpb.RaftLogPayload) error
- func (h *FSMHandlers) SetWithTTL(payload *serverpb.RaftLogPayload) error
- func (h *FSMHandlers) TrySet(payload *serverpb.RaftLogPayload) error
- func (h *FSMHandlers) TrySetWithTTL(payload *serverpb.RaftLogPayload) error
- type Raft
- type RaftApply
- type RaftServerOption
- func RaftWithBoltLogStore(path string) RaftServerOption
- func RaftWithBootstrap() RaftServerOption
- func RaftWithClusters(clusters []raft.Server) RaftServerOption
- func RaftWithConfig(cfg *raft.Config) RaftServerOption
- func RaftWithContext(ctx context.Context) RaftServerOption
- func RaftWithEmpty() RaftServerOption
- func RaftWithFileSnapshotStore(path string, retain int, logOut io.Writer) RaftServerOption
- func RaftWithStdFSM(store store.Store) RaftServerOption
- func RaftWithStdStableStore(store store.Store) RaftServerOption
- func RaftWithTCPTransport(addr string, maxPool int, timeout time.Duration, logOut io.Writer) RaftServerOption
- type RaftTLStreamLayer
- type Server
- type Snapshot
- type StableStore
Constants ¶
View Source
const ( SingleLogPack uint32 = iota MultipleLogPack )
View Source
const ( StoreSuffix = "data" RaftLog = "raft-log.db" )
Variables ¶
View Source
var ( ErrApplyLogTimeTravelDone = errors.New("raft apply log time-travel done") ErrApplyLogDone = errors.New("raft apply log done") )
Functions ¶
func GetLogPackHeader ¶
func LogPackHeader ¶
func NewFSMHandlers ¶
func NewFSMHandlers(s store.Store) map[serverpb.RaftLogCommand]FSMHandleFunc
func NewTLSTransport ¶
func NewTLSTransportWithGenerator ¶
func NewTLSTransportWithGenerator( addr string, advertise net.Addr, config *raft.NetworkTransportConfig, ) (*raft.NetworkTransport, error)
func RaftLogPayloadKey ¶
func RaftLogPayloadKey(m *serverpb.RaftLogPayload) uint64
Types ¶
type FSM ¶
type FSM struct { Term *uint64 Handlers map[serverpb.RaftLogCommand]FSMHandleFunc Store store.Store }
type FSMHandleFunc ¶
type FSMHandleFunc func(*serverpb.RaftLogPayload) error
type FSMHandlers ¶
type FSMHandlers struct {
// contains filtered or unexported fields
}
func (*FSMHandlers) Del ¶
func (h *FSMHandlers) Del(payload *serverpb.RaftLogPayload) error
func (*FSMHandlers) Set ¶
func (h *FSMHandlers) Set(payload *serverpb.RaftLogPayload) error
func (*FSMHandlers) SetWithTTL ¶
func (h *FSMHandlers) SetWithTTL(payload *serverpb.RaftLogPayload) error
func (*FSMHandlers) TrySet ¶
func (h *FSMHandlers) TrySet(payload *serverpb.RaftLogPayload) error
func (*FSMHandlers) TrySetWithTTL ¶
func (h *FSMHandlers) TrySetWithTTL(payload *serverpb.RaftLogPayload) error
type Raft ¶
func NewRaftWithOptions ¶
func NewRaftWithOptions(opts ...RaftServerOption) (*Raft, error)
func (*Raft) AddCluster ¶
type RaftApply ¶
type RaftApply interface {
Apply(ctx *context.Context, m *serverpb.RaftLogPayload, timeout time.Duration) error
}
func NewRaftMultipleLogApply ¶
func NewRaftSingeLogApply ¶
type RaftServerOption ¶
func RaftWithBoltLogStore ¶
func RaftWithBoltLogStore(path string) RaftServerOption
func RaftWithBootstrap ¶
func RaftWithBootstrap() RaftServerOption
func RaftWithClusters ¶
func RaftWithClusters(clusters []raft.Server) RaftServerOption
func RaftWithConfig ¶
func RaftWithConfig(cfg *raft.Config) RaftServerOption
func RaftWithContext ¶
func RaftWithContext(ctx context.Context) RaftServerOption
func RaftWithEmpty ¶
func RaftWithEmpty() RaftServerOption
func RaftWithFileSnapshotStore ¶
func RaftWithFileSnapshotStore(path string, retain int, logOut io.Writer) RaftServerOption
func RaftWithStdFSM ¶
func RaftWithStdFSM(store store.Store) RaftServerOption
func RaftWithStdStableStore ¶
func RaftWithStdStableStore(store store.Store) RaftServerOption
func RaftWithTCPTransport ¶
type RaftTLStreamLayer ¶
type RaftTLStreamLayer struct {
// contains filtered or unexported fields
}
func (RaftTLStreamLayer) Addr ¶
func (r RaftTLStreamLayer) Addr() net.Addr
func (RaftTLStreamLayer) Close ¶
func (r RaftTLStreamLayer) Close() error
func (RaftTLStreamLayer) Dial ¶
func (r RaftTLStreamLayer) Dial(addr raft.ServerAddress, timeout time.Duration) (net.Conn, error)
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
func (*Server) ListenAndServe ¶
type StableStore ¶
type StableStore struct {
// contains filtered or unexported fields
}
func NewStableStore ¶
func NewStableStore(s store.Store) (*StableStore, error)
func (*StableStore) Get ¶
func (s *StableStore) Get(key []byte) ([]byte, error)
Get returns the value for key, or an empty byte slice if key was not found.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.