|
@@ -153,13 +153,13 @@ type Server interface {
|
|
|
|
|
|
|
|
// EtcdServer is the production implementation of the Server interface
|
|
// EtcdServer is the production implementation of the Server interface
|
|
|
type EtcdServer struct {
|
|
type EtcdServer struct {
|
|
|
- // r and inflightSnapshots must be the first elements to keep 64-bit alignment for atomic
|
|
|
|
|
- // access to fields
|
|
|
|
|
-
|
|
|
|
|
- // count the number of inflight snapshots.
|
|
|
|
|
- // MUST use atomic operation to access this field.
|
|
|
|
|
- inflightSnapshots int64
|
|
|
|
|
- Cfg *ServerConfig
|
|
|
|
|
|
|
+ // inflightSnapshots holds count the number of snapshots currently inflight.
|
|
|
|
|
+ inflightSnapshots int64 // must use atomic operations to access; keep 64-bit aligned.
|
|
|
|
|
+ appliedIndex uint64 // must use atomic operations to access; keep 64-bit aligned.
|
|
|
|
|
+ // consistIndex used to hold the offset of current executing entry
|
|
|
|
|
+ // It is initialized to 0 before executing any entry.
|
|
|
|
|
+ consistIndex consistentIndex // must use atomic operations to access; keep 64-bit aligned.
|
|
|
|
|
+ Cfg *ServerConfig
|
|
|
|
|
|
|
|
readych chan struct{}
|
|
readych chan struct{}
|
|
|
r raftNode
|
|
r raftNode
|
|
@@ -194,10 +194,6 @@ type EtcdServer struct {
|
|
|
// compactor is used to auto-compact the KV.
|
|
// compactor is used to auto-compact the KV.
|
|
|
compactor *compactor.Periodic
|
|
compactor *compactor.Periodic
|
|
|
|
|
|
|
|
- // consistent index used to hold the offset of current executing entry
|
|
|
|
|
- // It is initialized to 0 before executing any entry.
|
|
|
|
|
- consistIndex consistentIndex
|
|
|
|
|
-
|
|
|
|
|
// peerRt used to send requests (version, lease) to peers.
|
|
// peerRt used to send requests (version, lease) to peers.
|
|
|
peerRt http.RoundTripper
|
|
peerRt http.RoundTripper
|
|
|
reqIDGen *idutil.Generator
|
|
reqIDGen *idutil.Generator
|
|
@@ -211,8 +207,6 @@ type EtcdServer struct {
|
|
|
// wg is used to wait for the go routines that depends on the server state
|
|
// wg is used to wait for the go routines that depends on the server state
|
|
|
// to exit when stopping the server.
|
|
// to exit when stopping the server.
|
|
|
wg sync.WaitGroup
|
|
wg sync.WaitGroup
|
|
|
-
|
|
|
|
|
- appliedIndex uint64
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// NewServer creates a new EtcdServer from the supplied configuration. The
|
|
// NewServer creates a new EtcdServer from the supplied configuration. The
|