driver

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: Apache-2.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package driver defines the L4 database abstraction for HA orchestration. See docs/architecture.md.

Index

Constants

This section is empty.

Variables

View Source
var ErrNotImplemented = errors.New("database driver: not implemented")

ErrNotImplemented is returned by stub driver methods.

Functions

This section is empty.

Types

type CandidacyEvaluator

type CandidacyEvaluator interface {
	Promotable(ctx context.Context) (ok bool, reason string)
	ReplicationLagBytes(ctx context.Context) (int64, error)
}

CandidacyEvaluator answers whether this node may become primary.

type Driver

type Driver interface {
	Type() Engine
	Lifecycle
	CandidacyEvaluator
	RoleApplier
	StatusReporter
}

Driver is the unified database facade for HA orchestration.

type Engine

type Engine int

Engine identifies which database engine a driver serves.

const (
	EngineMySQL Engine = 1 << iota
	EnginePostgreSQL
	EngineUnknown
)

type FailoverPolicyApplier added in v0.3.0

type FailoverPolicyApplier interface {
	SetFailoverPolicy(clusterconfig.FailoverPolicy)
}

FailoverPolicyApplier receives DCS failover policy updates from the reconciler.

type Health

type Health struct {
	Alive     bool
	Writable  bool
	Role      Role
	LastError string
	Details   any
}

Health is a coarse health snapshot for status RPC / neohactl.

type Lifecycle

type Lifecycle interface {
	Start()
	Stop()
	SetupBootstrap(ctx context.Context) error
}

Lifecycle covers setup and background health probes.

type MGRLifecycle

type MGRLifecycle interface {
	IsMGRMode() bool
	MGRPrimaryPhase1Done(ctx context.Context) (bool, error)
	MGRClusterWritableReady(ctx context.Context) (bool, error)
	ApplyPrimaryMGRPhase2(ctx context.Context) error
	// MGRReplicaJoined reports whether local mysqld is a live MGR secondary.
	MGRReplicaJoined(ctx context.Context) (bool, error)
}

MGRLifecycle covers MySQL Group Replication two-phase primary apply. Implemented by internal/database/mysql.Driver when repl_mode is MGR.

type PrimaryRef

type PrimaryRef struct {
	MemberID string
	Host     string
	Port     int
}

PrimaryRef identifies the cluster primary for replica setup.

type ReplicaConnectivity added in v0.3.0

type ReplicaConnectivity interface {
	ReplicaConnectedToPrimary(ctx context.Context, primary PrimaryRef) (bool, error)
}

ReplicaConnectivity reports whether replication to the primary is healthy.

type Role

type Role int

Role is the desired or observed replication role from the HA layer's view.

const (
	RoleUnknown Role = iota
	RolePrimary
	RoleReplica
	RoleReadOnly
	RoleInvalid
)

type RoleApplier

type RoleApplier interface {
	ApplyPrimary(ctx context.Context) error
	ApplyReplica(ctx context.Context, primary PrimaryRef) error
	Demote(ctx context.Context) error
}

RoleApplier executes role transitions on the database instance.

type StatusReporter

type StatusReporter interface {
	Status(ctx context.Context) (Health, error)
}

StatusReporter exposes read-only status for API/CLI.

Jump to

Keyboard shortcuts

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