Skip to content
zit Artifact [0038063a72]
Login

Artifact [0038063a72]

Artifact 0038063a724dd61da383b46664856999f70e2f4a4150dc5d05f8d2f77684896a:


//! Repository State — draft-fossil-repo-state-00.
//!
//! Repository state is derived, not stored: branches, tags, leaves, closed
//! markers, and the current-trunk check-in are computed from the crosslinked
//! set of artifacts. This module owns that derivation over the parent DAG and
//! the tag records defined by the Artifact Format.

const std = @import("std");
const artifact = @import("artifact.zig");

/// A stored artifact's local integer identifier (Section 2). Local to a
/// repository; not part of the artifact model and not synchronised.
pub const Rid = u64;

pub const Error = error{ Ambiguous, NotFound, NotImplemented };

/// Resolve a symbolic name (a branch name, tag, or `trunk`) to a single
/// check-in. Resolution is a pure max-`mtime` selection among the check-ins
/// carrying the active `sym-<name>` tag (Section 8); open/closed state and
/// leaf-ness are NOT inputs. Exact-`mtime` ties are implementation-defined.
pub fn resolveName(rid_out: *Rid, name: []const u8) Error!void {
    _ = rid_out;
    _ = name;
    return Error.NotImplemented;
}

/// The current-trunk check-in. NOTE: not a pure function of the artifact set —
/// the branch name comes from the local `main-branch` setting (default
/// "trunk"), then resolves by max-`mtime` (Section 9).
pub fn currentTrunk(rid_out: *Rid, main_branch: []const u8) Error!void {
    _ = rid_out;
    _ = main_branch;
    return Error.NotImplemented;
}

test "repostate module compiles" {
    try std.testing.expect(@sizeOf(Rid) == 8);
}