generator

package
v0.35.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: Apache-2.0 Imports: 16 Imported by: ? 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: tests/generator / testkit type: tool job: Generate — build a deterministic kitchen-sink Ranke-Archive from a Spec, driving the dev Sequencer's write path; return a Manifest naming every corner limits: builds via the public ranke API + the dev testkit adapters; the caller supplies the Universe (-> adapter); asserts nothing (-> tests).

package: tests/generator / testkit type: tool job: deterministic "kitchen-sink" Ranke-Graph generator for integration + conformance testing — one size knob, every corner baked in limits: builds via the public ranke API; the caller supplies the Universe to store into (-> adapter); does not assert (-> tests)

package: tests/generator / testkit type: tool job: Spec — the full knob set the generator builds from, plus SpecForSize which derives every knob from a single `size` limits: pure configuration + derivation, no building (-> generate.go); knobs the ranke API cannot yet express are marked BLOCKED and ignored by the builder

package: tests/generator / testkit type: tool job: the toy specs — each the SMALLEST archive exhibiting one corner, so a test asserting on that corner has nothing else in the graph to explain limits: specs only, built by the same builder as the sized graphs (-> generate.go); for breadth at scale use SpecForSize instead

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Clock

type Clock struct {
	// contains filtered or unexported fields
}

Clock hands out increasing timestamps from a fixed base, so created_at (which feeds the id) is reproducible and satisfies the §Claims monotonicity rule. One Clock is the time source for the generator and Sequencer alike.

func NewClock

func NewClock(base time.Time, step time.Duration) *Clock

NewClock returns a Clock at base advancing by step per tick.

func (*Clock) Now

func (c *Clock) Now() time.Time

Now returns the current time without advancing.

func (*Clock) Tick

func (c *Clock) Tick() time.Time

Tick returns the current time and advances the clock by one step.

type Manifest

type Manifest struct {
	Spec Spec

	Head         ranke.Id   // archive head k′ — open with ranke.NewArchive(ctx, u, Head)
	Contributors []ranke.Id // the signing contributors (index 0 is the operator)
	Sources      []ranke.Id
	Derivations  []ranke.Id
	Entities     []ranke.Id
	HandMade     []ranke.Id // entity claims carrying no derivation edge
	Relations    []ranke.Id

	DiffChainHead ranke.Id   // head of the longest contribution/diff chain
	ExternalBlobs []ranke.Id // source claims whose content is external (hash-addressed)
	TinyBlob      ranke.Id   // the source whose content is TinyBlobBytes long
	HighDegree    ranke.Id   // the derivation citing the most sources
	Expiries      []ranke.Id // contribution/expiry claims (key expiry)
	Deletes       []ranke.Id // contribution/delete tombstones

	ClaimCount int      // claims contributed (excludes Sequencer-minted heads/tables)
	Revisions  int      // contributions merged = branch-table revisions
	Branches   []string // branch names the archive carries
}

Manifest is the map of a generated archive: the head to open it at, plus the ids of the notable claims, so a test can target one corner directly.

func Generate

func Generate(ctx context.Context, u ranke.Universe, spec Spec) (*Manifest, error)

Generate builds the archive described by spec into u over the dev testkit (deterministic clock, blocking Sequencer), returning its Manifest. Same (u-kind, spec) → identical ids on every run.

type Spec

type Spec struct {
	// Seed fixes every derived key (via keyForIndex), every blob, and every id.
	Seed int64
	// Size is the headline knob SpecForSize scales the rest from, kept for the
	// manifest; the builder reads the derived fields.
	Size int

	// Base is the clock's starting instant, fixed for reproducibility.
	Base time.Time
	// Step is how far the clock advances per claim.
	Step time.Duration

	// Contributors is how many distinct signing contributors author claims
	// (besides the operator the Sequencer signs branch tables with).
	Contributors int
	// Sources is the count of source/* claims (ingested artifacts).
	Sources int
	// Derivations is the count of derivation/* claims, each citing one or more
	// sources via derivation edges.
	Derivations int
	// Entities is the count of entity/* claims, each citing a source.
	Entities int
	// HandMadeEntities is the count of entity/* claims carrying NO derivation
	// edge — what a person typing an entity in produces, with nothing to cite.
	HandMadeEntities int
	// Relations is the count of relation/* claims, each wiring two entities
	// with a from/to edge pair.
	Relations int

	// DiffChainLen is the length of the longest contribution/diff chain: one
	// base source plus this many revisions overlaying it.
	DiffChainLen int
	// ExternalBlobs is how many source claims carry external (hash-addressed)
	// content in the Universe rather than inline bytes.
	ExternalBlobs int
	// TinyBlobBytes / LargeBlobBytes bound the inline content sizes, so the
	// archive holds both a tiny-blob and a large-blob corner.
	TinyBlobBytes  int
	LargeBlobBytes int
	// OversizedFieldBytes is the length of a large field value placed on one
	// claim (0 disables the corner), within the ADT's 64 KiB field-value cap.
	OversizedFieldBytes int
	// DatedSources is how many of the leading source/note claims carry `dated`
	// (`V-DATED`), an EDTF Level 1 value; 0 leaves every claim without one.
	DatedSources int
	// MaxEdgeDegree is the fan-out of the highest-degree derivation.
	MaxEdgeDegree int

	// KeyExpiries is how many contribution/expiry claims to mint, each with an
	// edge to a contributor and a pubkey_expires_after field (paper §Types).
	KeyExpiries int
	// Deletes is how many contribution/delete tombstones to mint, each naming a
	// claim by id as a removed-bytes gap (paper §Types).
	Deletes int

	// Branches is how many named branches the contributions spread across;
	// 0 derives a count from the claim total. "main" is always the first.
	Branches int
}

Spec is the complete, fine-tunable description of a graph to generate; the same Spec yields the same archive, ids included. Start from SpecForSize and override single fields to stress one corner — every other corner stays in.

func SpecForNodes

func SpecForNodes(seed int64, nodes int) Spec

SpecForNodes scales an archive to roughly nodes total claims, as the CLI's --size (1k, 1m, …) does: content claims run ~5.2× the size unit, plus spine. The divisor below stays 5, so the count overshoots by about 4% — Size is a dimension, not a promise (-> tests/performance/harness.go).

func SpecForSize

func SpecForSize(seed int64, size int) Spec

SpecForSize derives a full Spec from one size knob, linearly, with every corner present at either scale. Shape knobs grow sublinearly, so a large archive is mostly breadth.

func ToyBranches

func ToyBranches(seed int64) Spec

ToyBranches is the smallest archive spread over two branches, so a branch-scoped read has another branch's claims to leave out.

func ToyDated

func ToyDated(seed int64) Spec

ToyDated is the smallest archive with a `dated` (`V-DATED`) node: one source carrying it, one without — so a `compare: temporal` read has a field-absent claim to sort last against.

func ToyDiff

func ToyDiff(seed int64) Spec

ToyDiff is the smallest archive with a content-inheriting diff overlay: one source, one base derivation carrying content, one delta over it. The delta restates a field only, so its effective content is the base's.

func ToyExternalContent

func ToyExternalContent(seed int64) Spec

ToyExternalContent is the smallest archive whose source content lives in the Universe by hash rather than inline — the content a projection layer must serve from a durable tier.

func ToyHandMadeEntity

func ToyHandMadeEntity(seed int64) Spec

ToyHandMadeEntity is the smallest archive holding an entity that cites nothing — no derivation edge, only the contributor edge every claim carries. A read looking for provenance-by-derivation finds none here and the claim is still valid.

func ToyRelation

func ToyRelation(seed int64) Spec

ToyRelation is the smallest archive with a semantic relation: two entities and one relation claim wiring them, carrying both relation_direction polarities.

func ToyUnwiredEntity

func ToyUnwiredEntity(seed int64) Spec

ToyUnwiredEntity adds a third entity the single relation leaves alone, so a hop range tells the wired pair from the whole entity set.

Jump to

Keyboard shortcuts

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