Help us shape the future of Go! Take the 2026 Go Developer Survey

quarantine

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package quarantine is the data no object names that a start-up reclaim moves aside instead of deleting (ADR-0288): an entry per moved object, dated by its move, and the port each store's quarantine implements. Each store keeps its entries beside its data: the KV substrate's keys, the blob store's Buckets, the SQL directories, the Function volumes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseStamp

func ParseStamp(s string) (time.Time, error)

ParseStamp reads a Stamp.

func Stamp

func Stamp(t time.Time) string

Stamp is t in UTC, to the ms: an entry's <since> in its key or path (Decision 2).

Types

type Entry

type Entry struct {
	Ref
	Since time.Time
	State State
}

Entry is one object's quarantined data: Since is when its move began, to the ms.

func Pick

func Pick(entries []Entry, ref Ref, since time.Time) (Entry, error)

Pick is the entry Return takes among ref's entries: the one dated since, else the newest. Returning wins, as a cut return resumes; fault.NotFound when none.

func (Entry) Expired

func (e Entry) Expired(cutoff time.Time) bool

Expired reports whether the sweep deletes the entry at cutoff, now less the period: only a Kept entry that old (Decisions 3 and 5).

func (Entry) Until

func (e Entry) Until(period time.Duration) time.Time

Until is when the entry expires: Since plus the period (Decision 4).

type Ref

type Ref struct {
	v1.ObjectRef
	Volume v1.ObjectName
}

Ref names the object an entry holds the data of: a volume's Function, with Volume its volume, else "".

func (Ref) String

func (r Ref) String() string

String is <kind> <ns>/<name>, a volume's with /<volume>.

type Returner

type Returner interface {
	Return(ctx context.Context, ref Ref, since time.Time) error
}

Returner is a Store whose entries `funcdctl quarantine return` brings back: KVStore, Bucket and Function volume. Return moves ref's Kept entry dated since, the newest when since is zero, back into the data of ref's object: fault.NotFound without such an entry, fault.Conflict when that data is not empty. A Returning entry resumes, its emptiness check skipped. That the object exists is the caller's check (Decision 6).

type State

type State string

State is an entry's state (Decision 2). A copy move writes Moving before its first copy and Kept after it deleted the source; a rename move writes none; a return writes Returning first. A missing state reads Kept.

const (
	Moving    State = "moving"
	Kept      State = "kept"
	Returning State = "returning"
)

The states of Decision 2.

func ParseState

func ParseState(s string) (State, error)

ParseState reads a stored state: empty, the missing state, is Kept.

type Store

type Store interface {
	// Move moves ref's data into a new entry dated now, or resumes ref's Moving entry.
	Move(ctx context.Context, ref Ref, now time.Time) (Entry, error)
	// List returns the entries, an entry with neither data nor state skipped.
	List(ctx context.Context) ([]Entry, error)
	// Expire deletes each entry Expired at cutoff, and each entry with neither data nor state, and returns the first.
	Expire(ctx context.Context, cutoff time.Time) ([]Entry, error)
}

Store is one kind's quarantine.

Jump to

Keyboard shortcuts

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