raftadmin

package
v0.0.0-...-ebdf8eb Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterOperationalServices

func RegisterOperationalServices(ctx context.Context, gs *grpc.Server, engine raftengine.Engine, serviceNames []string)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL