history

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package history provides read-only views over the commit DAG: log (commits in parent order), diff (RRset changes between trees), blame (who last touched a specific RRset), and walk-at (point-in-time).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WalkAt

func WalkAt(ctx context.Context, s store.Storage, head store.Hash, t time.Time) (store.Hash, object.Commit, error)

WalkAt returns the most recent commit at or before t, walking the first-parent chain from head. Returns ErrNotFound if every reachable commit is newer than t.

Types

type BlameInfo

type BlameInfo struct {
	Commit  store.Hash // commit hash that introduced the current value
	Author  object.Identity
	Message string
	Blob    store.Hash // current blob hash for (path, rrtype)
	Found   bool       // false if the RRset doesn't exist at head
}

BlameInfo identifies the commit that introduced the *current* value of an RRset and the value itself. "Introduced" = the commit whose parent either lacks the RRset or has a different blob.

func Blame

func Blame(ctx context.Context, s store.Storage, head store.Hash, path []string, rrtype string) (BlameInfo, error)

Blame walks the first-parent chain from head and returns the commit that last changed (path, rrtype). If the RRset is absent at head, Found=false.

type Change

type Change struct {
	Path    []string // labels from zone root down (e.g. ["api"] for api.<zone>)
	RRType  string   // "A", "AAAA", "MX", ...
	Op      ChangeOp
	OldBlob store.Hash // ZeroHash for OpAdded
	NewBlob store.Hash // ZeroHash for OpRemoved
}

Change is one RRset-level change between two trees.

func Diff

func Diff(ctx context.Context, s store.Storage, oldTree, newTree store.Hash) ([]Change, error)

Diff walks two trees in lockstep and returns the set of RRset-level changes. If oldTree == newTree (by hash), it returns no changes without loading anything. Identical sub-trees are skipped (structural sharing makes diff cost O(changed-paths), not O(zone-size)).

Either hash may be ZeroHash to mean "empty tree".

Output order: lexicographic by FQDN, then RRType.

func (Change) FQDN

func (c Change) FQDN() string

FQDN returns the labels joined dot-style (without trailing zone suffix).

type ChangeOp

type ChangeOp int

ChangeOp describes the nature of an RRset change between two trees.

const (
	OpAdded ChangeOp = iota + 1
	OpRemoved
	OpModified
)

func (ChangeOp) String

func (op ChangeOp) String() string

type Entry

type Entry struct {
	Hash   store.Hash
	Commit object.Commit
}

Entry is one commit in a log listing.

func Log

func Log(ctx context.Context, s store.Storage, head store.Hash, max int) ([]Entry, error)

Log walks the first-parent chain starting at head and returns up to max commits (oldest last). max <= 0 means unlimited.

First-parent walking matches git log's default behavior — for v0 we don't visit merge sub-history. Multi-parent traversal is a v1+ concern.

Jump to

Keyboard shortcuts

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