Documentation
¶
Overview ¶
Package sqlcore holds the checks that the SQL backends of meta.Store run after a write changed no row: they read the cause and pick the error. A backend keeps its SQL and gives these functions a Probe.
Index ¶
- func FenceLost(ctx context.Context, p Probe, ws string, epoch uint64, repo string) error
- func FlushLost(ctx context.Context, p Probe, ws string, epoch uint64) error
- func LandLeaseLost(ctx context.Context, p Probe, repo, ref, owner string, now time.Time) error
- func LeaseLost(ctx context.Context, p Probe, id string, partition int) error
- func OpHeadsLost(ctx context.Context, p Probe, ws string, epoch uint64, repo string) error
- func RefConflict(ctx context.Context, p Probe, repo, name string) error
- func RefLost(ctx context.Context, p Probe, node bool, ws string, epoch uint64, ...) error
- type Probe
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FenceLost ¶
FenceLost reports a failed fenced write as ErrClaimLost when the fence no longer holds. It returns nil when the fence holds, so the write lost on its own condition.
func LandLeaseLost ¶
LandLeaseLost returns meta.ErrLeaseHeld when owner no longer holds the land lease of the ref, and nil when it does, so the write lost on its own condition.
func OpHeadsLost ¶
OpHeadsLost is the error of an op heads swap that changed no row.
func RefConflict ¶
RefConflict is the conflict of a ref write that lost on its own condition: the current ref, or none when it is missing.
Types ¶
type Probe ¶
type Probe interface {
// Fence returns meta.ErrNotFound for a workspace that does not exist.
Fence(ctx context.Context, ws string) (meta.Fence, error)
// OpHeads returns meta.ErrNotFound for a workspace with no op heads.
OpHeads(ctx context.Context, ws string) (meta.OpHeads, error)
// Ref returns meta.ErrNotFound for a missing ref.
Ref(ctx context.Context, repo, name string) (meta.Ref, error)
// CursorExists reports whether the subscription has a cursor row for the partition.
CursorExists(ctx context.Context, id string, partition int) (bool, error)
// LandLeaseHeld reports whether owner holds the land lease of the ref at now.
LandLeaseHeld(ctx context.Context, repo, ref, owner string, now time.Time) (bool, error)
}
Probe reads the rows that the checks need. Each method wraps a database error with the name of its backend.