Documentation
¶
Overview ¶
Package anchorhttp reads and advances rollback anchors through authenticated HTTPS members.
It implements meldbase.RollbackAnchorStore using a majority of members and is a reference trust-plane building block, not a replacement for independently operated failure domains.
Index ¶
- Constants
- Variables
- type Handler
- type HandlerOptions
- type QuorumOptions
- type QuorumStore
- func (store *QuorumStore) Advance(ctx context.Context, anchor meldbase.RollbackAnchor) error
- func (store *QuorumStore) CheckReplicas(ctx context.Context) ([]ReplicaCheck, error)
- func (store *QuorumStore) ConfigurationID() string
- func (store *QuorumStore) Load(ctx context.Context) (meldbase.RollbackAnchor, bool, error)
- func (store *QuorumStore) RollbackAnchorStatus() meldbase.RollbackAnchorStoreStatus
- func (store *QuorumStore) String() string
- type Replica
- type ReplicaCheck
- type ReplicaCheckState
Constants ¶
const ( // ProtocolVersion identifies the strict HTTP/JSON and signing contract. ProtocolVersion uint32 = 2 )
Variables ¶
var ( // ErrAuthentication reports rejected request credentials or signatures. ErrAuthentication = errors.New("meldbase anchor HTTP: authentication failed") // ErrConfiguration reports a cluster configuration or member identity mismatch. ErrConfiguration = errors.New("meldbase anchor HTTP: configuration or member mismatch") // ErrConflict reports an anchor update that conflicts with retained history. ErrConflict = errors.New("meldbase anchor HTTP: monotonic anchor conflict") // ErrInsecureTransport reports an endpoint that does not use HTTPS. ErrInsecureTransport = errors.New("meldbase anchor HTTP: HTTPS is required") // ErrProtocol reports an invalid anchor protocol response. ErrProtocol = errors.New("meldbase anchor HTTP: invalid protocol response") // ErrQuorum reports that too few members completed an operation. ErrQuorum = errors.New("meldbase anchor HTTP: quorum unavailable") )
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler serves authenticated reads and advances of file-backed rollback anchors.
func NewHandler ¶
func NewHandler(options HandlerOptions) (*Handler, error)
NewHandler creates an authenticated anchor handler using an existing trusted directory.
Deploy it behind TLS; request authentication does not encrypt traffic or authenticate the server to the client.
type HandlerOptions ¶
type HandlerOptions struct {
Directory string
ClusterID string
Members []string
MemberID string
Keys map[string][]byte
MaxClockSkew time.Duration
}
HandlerOptions supplies the member identity, storage directory, and request signing keys.
type QuorumOptions ¶
type QuorumOptions struct {
ClusterID string
Replicas []Replica
AnchorName string
KeyID string
Client *http.Client
AllowInsecureHTTP bool
}
QuorumOptions supplies static members, an anchor name, and signed request settings.
type QuorumStore ¶
type QuorumStore struct {
// contains filtered or unexported fields
}
QuorumStore reads and advances a rollback anchor through a majority of configured members.
func NewQuorumStore ¶
func NewQuorumStore(options QuorumOptions) (*QuorumStore, error)
NewQuorumStore validates members and creates a majority-based rollback anchor store.
Endpoint count must be one or an odd number of at least three, and duplicate endpoints are rejected so they cannot manufacture a quorum.
func (*QuorumStore) Advance ¶
func (store *QuorumStore) Advance(ctx context.Context, anchor meldbase.RollbackAnchor) error
Advance returns success after a majority accepts the requested anchor.
func (*QuorumStore) CheckReplicas ¶
func (store *QuorumStore) CheckReplicas(ctx context.Context) ([]ReplicaCheck, error)
CheckReplicas reports the anchor read result from every configured member.
It waits for all signed GET results and is intended for qualification and operator diagnostics, not commit paths.
func (*QuorumStore) ConfigurationID ¶
func (store *QuorumStore) ConfigurationID() string
ConfigurationID returns the non-secret digest of the cluster and complete sorted static member list.
func (*QuorumStore) Load ¶
func (store *QuorumStore) Load(ctx context.Context) (meldbase.RollbackAnchor, bool, error)
Load selects an observed anchor covering a successful majority or returns a majority-confirmed absence.
func (*QuorumStore) RollbackAnchorStatus ¶
func (store *QuorumStore) RollbackAnchorStatus() meldbase.RollbackAnchorStoreStatus
RollbackAnchorStatus returns aggregate anchor operations and failures without taking locks.
The process-session snapshot omits identities and is suitable for admin telemetry.
func (*QuorumStore) String ¶
func (store *QuorumStore) String() string
String describes the replica count and majority size without exposing member identities.
type Replica ¶
Replica pairs an endpoint with the configured member expected to serve it.
Distinct URLs with the same MemberID cannot manufacture a quorum.
type ReplicaCheck ¶
type ReplicaCheck struct {
MemberID string
State ReplicaCheckState
Exists bool
Anchor meldbase.RollbackAnchor
}
ReplicaCheck reports one member's availability and any verified anchor.
Anchor is set only when State is ReplicaAvailable and Exists is true.
type ReplicaCheckState ¶
type ReplicaCheckState string
ReplicaCheckState identifies the result of checking one configured member.
It contains no endpoint or database identity.
const ( // ReplicaAvailable marks a member that returned a valid anchor. ReplicaAvailable ReplicaCheckState = "available" // ReplicaMissing marks a member with no stored anchor. ReplicaMissing ReplicaCheckState = "missing" ReplicaUnavailable ReplicaCheckState = "unavailable" // ReplicaAuthentication marks a member that rejected request authentication. ReplicaAuthentication ReplicaCheckState = "authentication-failure" // ReplicaConfiguration marks a member with a different cluster configuration. ReplicaConfiguration ReplicaCheckState = "configuration-failure" // ReplicaProtocol marks a member that returned invalid protocol data. ReplicaProtocol ReplicaCheckState = "protocol-failure" )