Documentation
¶
Index ¶
- func RegisterOperationalServices(ctx context.Context, gs *grpc.Server, engine raftengine.Engine, ...)
- func RegisterOperationalServicesWithInterceptor(ctx context.Context, gs *grpc.Server, engine raftengine.Engine, ...)
- type MembershipChangeInterceptor
- type Server
- func (s *Server) AddLearner(ctx context.Context, req *pb.RaftAdminAddLearnerRequest) (*pb.RaftAdminConfigurationChangeResponse, error)
- func (s *Server) AddVoter(ctx context.Context, req *pb.RaftAdminAddVoterRequest) (*pb.RaftAdminConfigurationChangeResponse, error)
- func (s *Server) Configuration(ctx context.Context, _ *pb.RaftAdminConfigurationRequest) (*pb.RaftAdminConfigurationResponse, error)
- func (s *Server) PromoteLearner(ctx context.Context, req *pb.RaftAdminPromoteLearnerRequest) (*pb.RaftAdminConfigurationChangeResponse, error)
- func (s *Server) RemoveServer(ctx context.Context, req *pb.RaftAdminRemoveServerRequest) (*pb.RaftAdminConfigurationChangeResponse, error)
- func (s *Server) Status(context.Context, *pb.RaftAdminStatusRequest) (*pb.RaftAdminStatusResponse, error)
- func (s *Server) TransferLeadership(ctx context.Context, req *pb.RaftAdminTransferLeadershipRequest) (*pb.RaftAdminTransferLeadershipResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RegisterOperationalServicesWithInterceptor ¶
func RegisterOperationalServicesWithInterceptor( ctx context.Context, gs *grpc.Server, engine raftengine.Engine, serviceNames []string, interceptor MembershipChangeInterceptor, )
RegisterOperationalServicesWithInterceptor is the Stage 7c variant of RegisterOperationalServices that installs an optional MembershipChangeInterceptor on the underlying Server so AddVoter/AddLearner run an encryption-aware pre-step before the conf-change proposal. Passing nil is equivalent to RegisterOperationalServices.
Types ¶
type MembershipChangeInterceptor ¶
type MembershipChangeInterceptor interface {
// PreAddMember runs on the leader before AddVoter/AddLearner
// proposes the conf-change. The raftID is the same string the
// caller passed in the AddVoter/AddLearner request (the
// `Id` field).
PreAddMember(ctx context.Context, raftID string) error
}
MembershipChangeInterceptor lets a caller of Server inject a pre-step into Server.AddVoter and Server.AddLearner that runs **before** the underlying Raft engine proposes the configuration change. A non-nil error from PreAddMember aborts the conf-change proposal; the error is returned to the gRPC caller verbatim.
Stage 7c uses this hook to pre-register a new node's writer- registry row (see docs/design/2026_05_29_proposed_7c_confchange_time_registration.md). Keeping the encryption-aware adapter outside this package preserves raftadmin's engine-generic posture — no concrete dependency on the KV or encryption layers.
The hook is intentionally optional: when nil is passed to NewServer (or NewServerWithInterceptor is not used), AddVoter/AddLearner run exactly as they did pre-7c. Encryption-unaware builds and encryption-disabled clusters therefore see no behavior change.
type Server ¶
type Server struct {
pb.UnimplementedRaftAdminServer
// contains filtered or unexported fields
}
func NewServer ¶
func NewServer(engine raftengine.Engine) *Server
func NewServerWithInterceptor ¶
func NewServerWithInterceptor(engine raftengine.Engine, interceptor MembershipChangeInterceptor) *Server
NewServerWithInterceptor constructs a Server with an optional pre-step that runs before AddVoter/AddLearner propose the conf-change. See MembershipChangeInterceptor. Passing nil is equivalent to NewServer — the pre-step is skipped and the conf-change runs exactly as the pre-7c posture.
func (*Server) AddLearner ¶
func (s *Server) AddLearner(ctx context.Context, req *pb.RaftAdminAddLearnerRequest) (*pb.RaftAdminConfigurationChangeResponse, error)
func (*Server) AddVoter ¶
func (s *Server) AddVoter(ctx context.Context, req *pb.RaftAdminAddVoterRequest) (*pb.RaftAdminConfigurationChangeResponse, error)
func (*Server) Configuration ¶
func (s *Server) Configuration(ctx context.Context, _ *pb.RaftAdminConfigurationRequest) (*pb.RaftAdminConfigurationResponse, error)
func (*Server) PromoteLearner ¶
func (s *Server) PromoteLearner(ctx context.Context, req *pb.RaftAdminPromoteLearnerRequest) (*pb.RaftAdminConfigurationChangeResponse, error)
func (*Server) RemoveServer ¶
func (s *Server) RemoveServer(ctx context.Context, req *pb.RaftAdminRemoveServerRequest) (*pb.RaftAdminConfigurationChangeResponse, error)
func (*Server) Status ¶
func (s *Server) Status(context.Context, *pb.RaftAdminStatusRequest) (*pb.RaftAdminStatusResponse, error)
func (*Server) TransferLeadership ¶
func (s *Server) TransferLeadership(ctx context.Context, req *pb.RaftAdminTransferLeadershipRequest) (*pb.RaftAdminTransferLeadershipResponse, error)