Skip to content

Commit

Permalink
Tweaks a few comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
slackpad committed Jan 25, 2017
1 parent 75f2aa8 commit b787aa1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions consul/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ type consulFSM struct {

// stateLock is only used to protect outside callers to State() from
// racing with Restore(), which is called by Raft (it puts in a totally
// new state store). Everything else is synchronized by the Raft side,
// so doesn't need to lock this.
// new state store). Everything internal here is synchronized by the
// Raft side, so doesn't need to lock this.
stateLock sync.RWMutex
state *state.StateStore

Expand Down Expand Up @@ -336,7 +336,7 @@ func (c *consulFSM) Restore(old io.ReadCloser) error {

// The old state store has been abandoned already since we've replaced
// it with an empty one, but we defer telling watchers about it until
// the restore is done, so they wake up one we have the latest data.
// the restore is done, so they wake up once we have the latest data.
defer stateOld.Abandon()

// Set up a new restore transaction
Expand Down
5 changes: 4 additions & 1 deletion consul/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,10 @@ func (s *Server) raftApply(t structs.MessageType, msg interface{}) (interface{},
}

// queryFn is used to perform a query operation. If a re-query is needed, the
// passed-in watch set will be used to block for changes.
// passed-in watch set will be used to block for changes. The passed-in state
// store should be used (vs. calling fsm.State()) since the given state store
// will be correctly watched for changes if the state store is restored from
// a snapshot.
type queryFn func(memdb.WatchSet, *state.StateStore) error

// blockingQuery is used to process a potentially blocking query operation.
Expand Down

0 comments on commit b787aa1

Please sign in to comment.