pull/19/head
Armon Dadgar 11 years ago
parent 148607ac88
commit d96636ced1

@ -33,6 +33,9 @@ func NewFSM() (*consulFSM, error) {
} }
func (c *consulFSM) Apply([]byte) interface{} { func (c *consulFSM) Apply([]byte) interface{} {
// TODO: Decode
// TODO: Execute
return nil return nil
} }
@ -41,7 +44,19 @@ func (c *consulFSM) Snapshot() (raft.FSMSnapshot, error) {
return snap, nil return snap, nil
} }
func (c *consulFSM) Restore(io.ReadCloser) error { func (c *consulFSM) Restore(old io.ReadCloser) error {
defer old.Close()
// Create a new state store
state, err := NewStateStore()
if err != nil {
return err
}
// TODO: Populate the new state
// Do an atomic flip, safe since Apply is not called concurrently
c.state = state
return nil return nil
} }

Loading…
Cancel
Save