mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Marge applierV3Internal into applierV3 interface
This commit is contained in:
parent
b7ad746bfe
commit
f348134edd
@ -48,13 +48,6 @@ type applyResult struct {
|
||||
trace *traceutil.Trace
|
||||
}
|
||||
|
||||
// applierV3Internal is the interface for processing internal V3 raft request
|
||||
type applierV3Internal interface {
|
||||
ClusterVersionSet(r *membershippb.ClusterVersionSetRequest, shouldApplyV3 membership.ShouldApplyV3)
|
||||
ClusterMemberAttrSet(r *membershippb.ClusterMemberAttrSetRequest, shouldApplyV3 membership.ShouldApplyV3)
|
||||
DowngradeInfoSet(r *membershippb.DowngradeInfoSetRequest, shouldApplyV3 membership.ShouldApplyV3)
|
||||
}
|
||||
|
||||
type ApplyFunc func(ctx context.Context, r *pb.InternalRaftRequest, shouldApplyV3 membership.ShouldApplyV3) *applyResult
|
||||
|
||||
// applierV3 is the interface for processing V3 raft messages
|
||||
@ -94,6 +87,11 @@ type applierV3 interface {
|
||||
RoleDelete(ua *pb.AuthRoleDeleteRequest) (*pb.AuthRoleDeleteResponse, error)
|
||||
UserList(ua *pb.AuthUserListRequest) (*pb.AuthUserListResponse, error)
|
||||
RoleList(ua *pb.AuthRoleListRequest) (*pb.AuthRoleListResponse, error)
|
||||
|
||||
// processing internal V3 raft request
|
||||
ClusterVersionSet(r *membershippb.ClusterVersionSetRequest, shouldApplyV3 membership.ShouldApplyV3)
|
||||
ClusterMemberAttrSet(r *membershippb.ClusterMemberAttrSetRequest, shouldApplyV3 membership.ShouldApplyV3)
|
||||
DowngradeInfoSet(r *membershippb.DowngradeInfoSetRequest, shouldApplyV3 membership.ShouldApplyV3)
|
||||
}
|
||||
|
||||
type applierV3backend struct {
|
||||
|
@ -37,11 +37,6 @@ type uberApplier struct {
|
||||
|
||||
// This is the applier used for wrapping when alarms change
|
||||
applyV3base applierV3
|
||||
|
||||
// applyV3Internal is the applier for internal requests
|
||||
// (that seems to bypass wrappings)
|
||||
// TODO(ptab): Seems artificial and could be part of the regular stack.
|
||||
applyV3Internal applierV3Internal
|
||||
}
|
||||
|
||||
func newUberApplier(s *EtcdServer) *uberApplier {
|
||||
@ -53,7 +48,6 @@ func newUberApplier(s *EtcdServer) *uberApplier {
|
||||
warningApplyDuration: s.Cfg.WarningApplyDuration,
|
||||
applyV3: applyV3base_,
|
||||
applyV3base: applyV3base_,
|
||||
applyV3Internal: newApplierV3Internal(s),
|
||||
}
|
||||
ua.RestoreAlarms()
|
||||
return ua
|
||||
@ -63,11 +57,6 @@ func newApplierV3Backend(s *EtcdServer) applierV3 {
|
||||
return &applierV3backend{s: s}
|
||||
}
|
||||
|
||||
func newApplierV3Internal(s *EtcdServer) applierV3Internal {
|
||||
base := &applierV3backend{s: s}
|
||||
return base
|
||||
}
|
||||
|
||||
func newApplierV3(s *EtcdServer) applierV3 {
|
||||
return newAuthApplierV3(
|
||||
s.AuthStore(),
|
||||
@ -108,15 +97,15 @@ func (a *uberApplier) dispatch(ctx context.Context, r *pb.InternalRaftRequest, s
|
||||
switch {
|
||||
case r.ClusterVersionSet != nil: // Implemented in 3.5.x
|
||||
op = "ClusterVersionSet"
|
||||
a.applyV3Internal.ClusterVersionSet(r.ClusterVersionSet, shouldApplyV3)
|
||||
a.applyV3.ClusterVersionSet(r.ClusterVersionSet, shouldApplyV3)
|
||||
return ar
|
||||
case r.ClusterMemberAttrSet != nil:
|
||||
op = "ClusterMemberAttrSet" // Implemented in 3.5.x
|
||||
a.applyV3Internal.ClusterMemberAttrSet(r.ClusterMemberAttrSet, shouldApplyV3)
|
||||
a.applyV3.ClusterMemberAttrSet(r.ClusterMemberAttrSet, shouldApplyV3)
|
||||
return ar
|
||||
case r.DowngradeInfoSet != nil:
|
||||
op = "DowngradeInfoSet" // Implemented in 3.5.x
|
||||
a.applyV3Internal.DowngradeInfoSet(r.DowngradeInfoSet, shouldApplyV3)
|
||||
a.applyV3.DowngradeInfoSet(r.DowngradeInfoSet, shouldApplyV3)
|
||||
return ar
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user