Simplify imports and improve comments.

dependabot/go_modules/go.uber.org/atomic-1.10.0
Piotr Tabor 2022-04-04 20:33:46 +02:00
parent 4e04770bac
commit c78bf655a7
4 changed files with 8 additions and 7 deletions

View File

@ -17,13 +17,13 @@ package v3rpc
import ( import (
pb "go.etcd.io/etcd/api/v3/etcdserverpb" pb "go.etcd.io/etcd/api/v3/etcdserverpb"
"go.etcd.io/etcd/server/v3/etcdserver" "go.etcd.io/etcd/server/v3/etcdserver"
apply2 "go.etcd.io/etcd/server/v3/etcdserver/apply" "go.etcd.io/etcd/server/v3/etcdserver/apply"
) )
type header struct { type header struct {
clusterID int64 clusterID int64
memberID int64 memberID int64
sg apply2.RaftStatusGetter sg apply.RaftStatusGetter
rev func() int64 rev func() int64
} }

View File

@ -26,7 +26,7 @@ import (
"go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/api/v3/v3rpc/rpctypes"
"go.etcd.io/etcd/server/v3/auth" "go.etcd.io/etcd/server/v3/auth"
"go.etcd.io/etcd/server/v3/etcdserver" "go.etcd.io/etcd/server/v3/etcdserver"
apply2 "go.etcd.io/etcd/server/v3/etcdserver/apply" "go.etcd.io/etcd/server/v3/etcdserver/apply"
"go.etcd.io/etcd/server/v3/storage/mvcc" "go.etcd.io/etcd/server/v3/storage/mvcc"
"go.uber.org/zap" "go.uber.org/zap"
@ -42,7 +42,7 @@ type watchServer struct {
maxRequestBytes int maxRequestBytes int
sg apply2.RaftStatusGetter sg apply.RaftStatusGetter
watchable mvcc.WatchableKV watchable mvcc.WatchableKV
ag AuthGetter ag AuthGetter
} }
@ -125,7 +125,7 @@ type serverWatchStream struct {
maxRequestBytes int maxRequestBytes int
sg apply2.RaftStatusGetter sg apply.RaftStatusGetter
watchable mvcc.WatchableKV watchable mvcc.WatchableKV
ag AuthGetter ag AuthGetter

View File

@ -104,6 +104,8 @@ func (a *UberApplier) RestoreAlarms() {
} }
func (a *UberApplier) Apply(r *pb.InternalRaftRequest, shouldApplyV3 membership.ShouldApplyV3) *ApplyResult { func (a *UberApplier) Apply(r *pb.InternalRaftRequest, shouldApplyV3 membership.ShouldApplyV3) *ApplyResult {
// We first execute chain of WrapApply across all objects (e.g. CorruptApplier -> CappedApplier -> Auth -> Quota -> Backend),
// than dispatch(), than individual methods wrappers CorruptApplier.Put(CappedApplier.Put(... BackendApplier.Put())))
return a.applyV3.WrapApply(context.TODO(), r, shouldApplyV3, a.dispatch) return a.applyV3.WrapApply(context.TODO(), r, shouldApplyV3, a.dispatch)
} }
@ -139,7 +141,6 @@ func (a *UberApplier) dispatch(ctx context.Context, r *pb.InternalRaftRequest, s
return nil return nil
} }
// call into a.s.applyV3.F instead of a.F so upper appliers can check individual calls
switch { switch {
case r.Range != nil: case r.Range != nil:
op = "Range" op = "Range"

View File

@ -1606,7 +1606,7 @@ func TestUpdateVersion(t *testing.T) {
srv := &EtcdServer{ srv := &EtcdServer{
lgMu: new(sync.RWMutex), lgMu: new(sync.RWMutex),
lg: zaptest.NewLogger(t), lg: zaptest.NewLogger(t),
memberId: 1, memberId: 1,
Cfg: config.ServerConfig{Logger: zaptest.NewLogger(t), TickMs: 1, SnapshotCatchUpEntries: DefaultSnapshotCatchUpEntries}, Cfg: config.ServerConfig{Logger: zaptest.NewLogger(t), TickMs: 1, SnapshotCatchUpEntries: DefaultSnapshotCatchUpEntries},
r: *newRaftNode(raftNodeConfig{lg: zaptest.NewLogger(t), Node: n}), r: *newRaftNode(raftNodeConfig{lg: zaptest.NewLogger(t), Node: n}),
attributes: membership.Attributes{Name: "node1", ClientURLs: []string{"http://node1.com"}}, attributes: membership.Attributes{Name: "node1", ClientURLs: []string{"http://node1.com"}},