sqlcore

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 4 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 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

Constants

This section is empty.

Variables

This section is empty.

Functions

func AckLandLost added in v0.22.0

func AckLandLost(ctx context.Context, p Probe, repo, id string) error

AckLandLost is the error of an ack that changed no row: ErrNotFound for a missing land, and ErrLandPending for a land that is not done.

func ClaimLost added in v0.22.0

func ClaimLost(ctx context.Context, p Probe, id string) error

ClaimLost is the error of a claim that changed no row: ErrGone for a deleted workspace and ErrWorkspaceConflict for one that another owner or repo holds.

func FenceLost

func FenceLost(ctx context.Context, p Probe, ws string, epoch uint64, repo string) error

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 FlushLost

func FlushLost(ctx context.Context, p Probe, ws string, epoch uint64) error

FlushLost is the error of a flush that changed no row.

func LandLeaseBusy added in v0.22.0

func LandLeaseBusy(ctx context.Context, p Probe, repo, ref string, now time.Time) (time.Time, error)

LandLeaseBusy is the answer to an acquire that changed no row: ErrLeaseHeld, and the time that the holder's lease ends, or now when the row is gone.

func LandLeaseLost

func LandLeaseLost(ctx context.Context, p Probe, repo, ref, owner string, now time.Time) error

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 LeaseLost

func LeaseLost(ctx context.Context, p Probe, id string, partition int) error

LeaseLost picks the error of an event lease write that changed no row.

func OpHeadsLost

func OpHeadsLost(ctx context.Context, p Probe, ws string, epoch uint64, repo string) error

OpHeadsLost is the error of an op heads swap that changed no row.

func RefConflict

func RefConflict(ctx context.Context, p Probe, repo, name string) error

RefConflict is the conflict of a ref write that lost on its own condition: the current ref, or none when it is missing.

func RefLost

func RefLost(ctx context.Context, p Probe, node bool, ws string, epoch uint64, repo, name string) error

RefLost is the error of a ref write that changed no row: the claim of a node writer that was lost, or a conflict with the current ref.

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)
	// LandLeaseEnd returns when the land lease of the ref ends, or meta.ErrNotFound when it has no row.
	LandLeaseEnd(ctx context.Context, repo, ref string) (time.Time, error)
	// LandItem returns meta.ErrNotFound for a land that does not exist.
	LandItem(ctx context.Context, repo, id string) (meta.LandItem, error)
}

Probe reads the rows that the checks need. Each method wraps a database error with the name of its backend.

Jump to

Keyboard shortcuts

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