dataepoch

package
v1.0.562 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2026 License: MIT Imports: 8 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 dataepoch is the data-compatibility contract between proxy builds (ADR-0062 slice 6a, contract UPG-003).

A data epoch is a whole number that changes only when a release migrates persisted state under /data into a form an older build cannot read. Two facts are compared before any older image is put back on this data:

  • the data directory's epoch: the marker file <dataDir>/.data-epoch, which only ever rises. A build raises it to its own Current before it writes anything in the newer form, and never lowers it. An absent marker means epoch 1: only builds released before this package existed have written the data, and every one of them reads and writes epoch 1.
  • the epochs an image reads: the labels io.culvert.data-epoch.min and io.culvert.data-epoch.max on the image, which are this package's OldestReadable and Current (Dockerfile; a drift test keeps them equal).

An image may run on data whose epoch lies in [min, max]. An image without the labels says nothing, and nothing may assume it can read the data.

Bumping Current is a release decision with obligations recorded in docs/engineering/data-epoch.md; a tripwire test in the root package fails while they are not met.

Index

Constants

View Source
const (
	// Current is the epoch this build writes.
	Current = 1
	// OldestReadable is the oldest epoch this build reads.
	OldestReadable = 1

	// MarkerName is the marker's file name under the data directory.
	MarkerName = ".data-epoch"
	// LabelMin is the image label naming the oldest epoch the image reads.
	LabelMin = "io.culvert.data-epoch.min"
	// LabelMax is the image label naming the newest epoch the image reads.
	LabelMax = "io.culvert.data-epoch.max"

	// ImplicitEpoch is the epoch of a data directory with no marker.
	ImplicitEpoch = 1
)

Variables

This section is empty.

Functions

func RaiseTo

func RaiseTo(dataDir string, epoch int) (Outcome, Reading, error)

RaiseTo makes the marker name at least epoch and never lowers it. It writes only when the data is below epoch (an absent marker counts as the implicit epoch, so a build at epoch 1 never writes). An unreadable marker is an error and is left as it is.

Types

type Marker

type Marker struct {
	Schema int `json:"schema"`
	Epoch  int `json:"epoch"`
}

Marker is the on-disk marker.

type Outcome

type Outcome int

Outcome of RaiseTo.

const (
	// Unchanged means the data was already at the epoch (or the marker is absent
	// and the epoch is the implicit one), so nothing was written.
	Unchanged Outcome = iota
	// Raised means the marker now names the epoch.
	Raised
	// Newer means the data is at a higher epoch than asked; nothing was written.
	Newer
)

type Reading

type Reading struct {
	Epoch int
	// Present is false when there is no marker (Epoch is then ImplicitEpoch).
	Present bool
}

Reading is what Read found.

func Read

func Read(dataDir string) (Reading, error)

Read returns the data directory's epoch. A marker that cannot be read, is too large, is not exactly the expected JSON, or names an epoch below 1 is an error: it is never taken for an absent marker.

type Report

type Report struct {
	Schema        int  `json:"schema"`
	Epoch         int  `json:"epoch"`
	MarkerPresent bool `json:"marker_present"`
	BuildMin      int  `json:"build_min"`
	BuildMax      int  `json:"build_max"`
}

Report is what `culvert --print-data-epoch` prints: the data directory's epoch and the range this build reads.

func ReportFor

func ReportFor(dataDir string) (Report, error)

ReportFor builds the Report for dataDir.

Jump to

Keyboard shortcuts

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