mirror of
https://github.com/datarhei/core.git
synced 2025-10-05 16:07:07 +08:00
35 lines
512 B
Go
35 lines
512 B
Go
package cluster
|
|
|
|
import (
|
|
"io"
|
|
|
|
"github.com/hashicorp/raft"
|
|
)
|
|
|
|
// Implement a FSM
|
|
type fsm struct{}
|
|
|
|
func NewFSM() (raft.FSM, error) {
|
|
return &fsm{}, nil
|
|
}
|
|
|
|
func (f *fsm) Apply(*raft.Log) interface{} {
|
|
return nil
|
|
}
|
|
|
|
func (f *fsm) Snapshot() (raft.FSMSnapshot, error) {
|
|
return &fsmSnapshot{}, nil
|
|
}
|
|
|
|
func (f *fsm) Restore(snapshot io.ReadCloser) error {
|
|
return nil
|
|
}
|
|
|
|
type fsmSnapshot struct{}
|
|
|
|
func (s *fsmSnapshot) Persist(sink raft.SnapshotSink) error {
|
|
return nil
|
|
}
|
|
|
|
func (s *fsmSnapshot) Release() {}
|