diff --git a/server.go b/server.go index 753b131..e93dc94 100644 --- a/server.go +++ b/server.go @@ -136,7 +136,11 @@ type event struct { // //------------------------------------------------------------------------------ -// Creates a new server with a log at the given path. +// Creates a new server with a log at the given path. transporter must +// not be nil. stateMachine can be nil if snapshotting and log +// compaction is to be disabled. context can be anything (including nil) +// and is not used by the raft package except returned by +// Server.Context(). connectionString can be anything. func NewServer(name string, path string, transporter Transporter, stateMachine StateMachine, context interface{}, connectionString string) (Server, error) { if name == "" { return nil, errors.New("raft.Server: Name cannot be blank") diff --git a/statemachine.go b/statemachine.go index e59036c..a0a22e8 100644 --- a/statemachine.go +++ b/statemachine.go @@ -7,7 +7,8 @@ package raft //------------------------------------------------------------------------------ // StateMachine is the interface for allowing the host application to save and -// recovery the state machine +// recovery the state machine. This makes it possible to make snapshots +// and compact the log. type StateMachine interface { Save() ([]byte, error) Recovery([]byte) error