clusterprojection

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package clusterprojection owns the dependency-neutral contracts for the durable duplicate-cluster projection.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Commit

type Commit struct {
	Repo               domain.RepoRef
	ExpectedSource     string
	ExpectedGovernance uint64
	RuleVersion        similarity.RuleVersion
	Clusters           []clustering.Cluster
	Stats              RefreshStats
	MaxCandidates      int
}

Commit contains a fully reconciled projection plus the exact source, governance, and rule inputs used to compute it. Corpus persistence rejects incomplete identities and rechecks source and governance before writing.

type CommitDisposition

type CommitDisposition string

CommitDisposition describes whether this caller advanced the projection.

const (
	// Committed means this caller atomically advanced the current projection.
	Committed CommitDisposition = "committed"
	// AlreadyCurrent means an equivalent concurrent or earlier refresh won.
	AlreadyCurrent CommitDisposition = "already_current"
)

type CommitResult

type CommitResult struct {
	Disposition     CommitDisposition
	Projection      Identity
	WriteStatements int
}

CommitResult is the atomic persistence result.

type Identity

type Identity struct {
	SourceRevision     string
	GovernanceRevision uint64
	RuleVersion        similarity.RuleVersion
	RunID              int64
}

Identity names the complete input and rule set that produced a projection.

func (Identity) Matches

func (i Identity) Matches(source string, governance uint64, rule similarity.RuleVersion) bool

Matches reports whether the source, governance, and rule inputs are equal.

type List

type List struct {
	Repo       domain.RepoRef
	Projection *Identity
	Clusters   []clustering.Cluster
	Total      int
	Truncated  bool
}

List is a bounded stored projection read. A nil identity means the repository has never completed a refresh.

type RefreshSnapshot

type RefreshSnapshot struct {
	Repo               domain.RepoRef
	Candidates         []clustering.Candidate
	ExistingClusters   []clustering.Cluster
	OverridesByCluster map[string][]clustering.MembershipOverride
	SourceRevision     string
	GovernanceRevision uint64
	CurrentProjection  *Identity
	ReadStatements     int
}

RefreshSnapshot is every input needed for one refresh, read from a single repository snapshot. Callers must close the storage transaction before exact pair evaluation and pass the revisions back unchanged at commit time.

type RefreshStats

type RefreshStats struct {
	CandidateCount  int    `json:"candidate_count"`
	PossiblePairs   uint64 `json:"possible_pairs"`
	ScoredPairs     uint64 `json:"scored_pairs"`
	ClusterCount    int    `json:"cluster_count"`
	SnapshotQueries int    `json:"snapshot_queries"`
	CommitQueries   int    `json:"commit_queries"`
}

RefreshStats records output cardinalities and work counts for one successful refresh. ClusterCount is the current non-retired projection count even when an unchanged refresh skips pair evaluation and commit work.

type StaleInputError

type StaleInputError struct {
	ExpectedSource        string
	ActualSource          string
	ExpectedGovernance    uint64
	ActualGovernance      uint64
	CurrentCandidateCount int
}

StaleInputError reports changed source or governance inputs at commit time.

func (*StaleInputError) Error

func (e *StaleInputError) Error() string

Error describes the source or governance revision that changed.

Jump to

Keyboard shortcuts

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