crossref

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

@index Cross-namespace reference sync: materializes @see ccg:// annotation tags into cross_refs rows.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnnotationRef

type AnnotationRef struct {
	NodeID uint
	Value  string
}

AnnotationRef pairs one ccg:// @see tag value with the node that declared it. @intent carry the minimal source facts needed to materialize a cross-namespace reference.

type Service

type Service struct {
	Store  Store
	Logger *slog.Logger
}

Service rebuilds cross-namespace reference state after a namespace ingest. @intent keep cross_refs derived state consistent with annotations and both namespaces' current nodes.

func New

func New(store Store) *Service

New constructs a cross-ref sync service. @intent bind the sync policy to one persistence port instance.

func (*Service) SyncNamespace

func (s *Service) SyncNamespace(ctx context.Context) error

SyncNamespace rebuilds outbound cross refs of the context namespace and re-resolves inbound ones. @intent run after a build/update commit so cross-namespace links reflect the namespace's new node identity. @domainRule outbound rows are fully replaced from current @see tags; malformed refs are skipped (lint owns reporting). @domainRule inbound rows are re-resolved because a replace-style build regenerates the target node ids. @sideEffect deletes, inserts, and updates cross_refs rows.

type Store

type Store interface {
	ListAnnotationCCGRefs(ctx context.Context, namespace string) ([]AnnotationRef, error)
	ResolveCCGRef(ctx context.Context, ref reference.Ref) (uint, bool, error)
	ReplaceCrossRefsFrom(ctx context.Context, fromNamespace string, refs []graph.CrossRef) error
	ListInboundCrossRefs(ctx context.Context, toNamespace string) ([]graph.CrossRef, error)
	UpdateCrossRefResolution(ctx context.Context, id uint, resolvedNodeID *uint, status graph.CrossRefStatus) error
}

Store exposes the persistence operations cross-ref sync needs. @intent keep the sync policy independent from GORM by owning a minimal consumer-side port.

Jump to

Keyboard shortcuts

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