mirror of https://github.com/status-im/consul.git
Gets rid of non-idomatic "state_store" alias in FSM.
This commit is contained in:
parent
8d444f2eed
commit
4fb8d1078e
|
@ -8,7 +8,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/armon/go-metrics"
|
"github.com/armon/go-metrics"
|
||||||
state_store "github.com/hashicorp/consul/consul/state"
|
"github.com/hashicorp/consul/consul/state"
|
||||||
"github.com/hashicorp/consul/consul/structs"
|
"github.com/hashicorp/consul/consul/structs"
|
||||||
"github.com/hashicorp/go-msgpack/codec"
|
"github.com/hashicorp/go-msgpack/codec"
|
||||||
"github.com/hashicorp/raft"
|
"github.com/hashicorp/raft"
|
||||||
|
@ -24,15 +24,15 @@ type consulFSM struct {
|
||||||
logOutput io.Writer
|
logOutput io.Writer
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
path string
|
path string
|
||||||
state *state_store.StateStore
|
state *state.StateStore
|
||||||
gc *state_store.TombstoneGC
|
gc *state.TombstoneGC
|
||||||
}
|
}
|
||||||
|
|
||||||
// consulSnapshot is used to provide a snapshot of the current
|
// consulSnapshot is used to provide a snapshot of the current
|
||||||
// state in a way that can be accessed concurrently with operations
|
// state in a way that can be accessed concurrently with operations
|
||||||
// that may modify the live state.
|
// that may modify the live state.
|
||||||
type consulSnapshot struct {
|
type consulSnapshot struct {
|
||||||
state *state_store.StateSnapshot
|
state *state.StateSnapshot
|
||||||
}
|
}
|
||||||
|
|
||||||
// snapshotHeader is the first entry in our snapshot
|
// snapshotHeader is the first entry in our snapshot
|
||||||
|
@ -43,8 +43,8 @@ type snapshotHeader struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewFSMPath is used to construct a new FSM with a blank state
|
// NewFSMPath is used to construct a new FSM with a blank state
|
||||||
func NewFSM(gc *state_store.TombstoneGC, logOutput io.Writer) (*consulFSM, error) {
|
func NewFSM(gc *state.TombstoneGC, logOutput io.Writer) (*consulFSM, error) {
|
||||||
state, err := state_store.NewStateStore(gc)
|
stateNew, err := state.NewStateStore(gc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -52,14 +52,14 @@ func NewFSM(gc *state_store.TombstoneGC, logOutput io.Writer) (*consulFSM, error
|
||||||
fsm := &consulFSM{
|
fsm := &consulFSM{
|
||||||
logOutput: logOutput,
|
logOutput: logOutput,
|
||||||
logger: log.New(logOutput, "", log.LstdFlags),
|
logger: log.New(logOutput, "", log.LstdFlags),
|
||||||
state: state,
|
state: stateNew,
|
||||||
gc: gc,
|
gc: gc,
|
||||||
}
|
}
|
||||||
return fsm, nil
|
return fsm, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// State is used to return a handle to the current state
|
// State is used to return a handle to the current state
|
||||||
func (c *consulFSM) State() *state_store.StateStore {
|
func (c *consulFSM) State() *state.StateStore {
|
||||||
return c.state
|
return c.state
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,11 +261,11 @@ func (c *consulFSM) Restore(old io.ReadCloser) error {
|
||||||
defer old.Close()
|
defer old.Close()
|
||||||
|
|
||||||
// Create a new state store
|
// Create a new state store
|
||||||
state, err := state_store.NewStateStore(c.gc)
|
stateNew, err := state.NewStateStore(c.gc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
c.state = state
|
c.state = stateNew
|
||||||
|
|
||||||
// Create a decoder
|
// Create a decoder
|
||||||
dec := codec.NewDecoder(old, msgpackHandle)
|
dec := codec.NewDecoder(old, msgpackHandle)
|
||||||
|
@ -332,7 +332,7 @@ func (c *consulFSM) Restore(old io.ReadCloser) error {
|
||||||
// For historical reasons, these are serialized in the
|
// For historical reasons, these are serialized in the
|
||||||
// snapshots as KV entries. We want to keep the snapshot
|
// snapshots as KV entries. We want to keep the snapshot
|
||||||
// format compatible with pre-0.6 versions for now.
|
// format compatible with pre-0.6 versions for now.
|
||||||
stone := &state_store.Tombstone{
|
stone := &state.Tombstone{
|
||||||
Key: req.Key,
|
Key: req.Key,
|
||||||
Index: req.ModifyIndex,
|
Index: req.ModifyIndex,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue