Documentation
¶
Overview ¶
Package normalize renders filesystem wiki documents into canonical source mirrors.
Index ¶
Constants ¶
const ( // FormatVersion identifies the deterministic generic filesystem rendering contract. FormatVersion = "filesystem-wiki-v2" // OKFFormatVersion identifies the strict OKF filesystem rendering contract. OKFFormatVersion = "filesystem-okf-v1" )
Variables ¶
var ( // ErrInvalid reports malformed catalog or render identity input. ErrInvalid = errors.New("invalid source normalization input") // ErrLimit reports bounded normalizer input or output overflow. ErrLimit = errors.New("source normalization exceeds a limit") )
Functions ¶
func MirrorDigest ¶
func MirrorDigest(identity MirrorIdentity) (string, error)
MirrorDigest returns the canonical digest for one rendered source document.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements app.SourceNormalizer over the catalog and render core.
func NewAdapter ¶
NewAdapter returns a bounded application normalizer adapter.
func NewDefaultAdapter ¶
func NewDefaultAdapter() *Adapter
NewDefaultAdapter returns an adapter with conservative default bounds.
func (*Adapter) NormalizeSource ¶
func (adapter *Adapter) NormalizeSource(ctx context.Context, input app.SourceNormalizationInput) (app.SourceNormalizationResult, error)
NormalizeSource renders one raw document deterministically into detached canonical write mutations and independent format, catalog, and mirror identities. Context is validated before and after the bounded work.
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is an immutable deterministic resolution index for one source scan.
func BuildCatalog ¶
func BuildCatalog(refs []knowl.DocumentRef, limits Limits) (Catalog, error)
BuildCatalog validates, sorts, and indexes one complete descriptor set.
func (Catalog) ResolveAsset ¶
ResolveAsset resolves an exact or unique-basename asset reference to its source-relative target path.
type Entry ¶
type Entry struct {
DocumentID knowl.DocumentID `json:"document_id"`
Path string `json:"path"`
Kind EntryKind `json:"kind"`
}
Entry is one canonical source-local catalog member.
type Limits ¶
Limits bounds catalog construction and rendered values.
func DefaultLimits ¶
func DefaultLimits() Limits
DefaultLimits returns conservative source normalizer bounds.
type MirrorIdentity ¶
type MirrorIdentity struct {
FormatVersion string
SourceID knowl.SourceID
DocumentID knowl.DocumentID
Revision string
RawSource knowl.AcceptedSource
CatalogDigest string
Files []RenderedFile
}
MirrorIdentity contains every independent input to a mirror digest.
type RenderInput ¶
type RenderInput struct {
Source knowl.Source
Document knowl.Document
RawSource knowl.AcceptedSource
Catalog Catalog
}
RenderInput contains one fetched or restored raw document and its complete source-local catalog.
type RenderedFile ¶
type RenderedFile struct {
// contains filtered or unexported fields
}
RenderedFile is one immutable deterministic normalizer output.
func NewRenderedFile ¶
func NewRenderedFile(filePath string, content []byte, limits Limits) (RenderedFile, error)
NewRenderedFile validates and copies one rendered output.
func (RenderedFile) Content ¶
func (file RenderedFile) Content() []byte
Content returns a detached copy of the rendered bytes.
func (RenderedFile) Digest ¶
func (file RenderedFile) Digest() string
Digest returns the rendered content SHA-256.
func (RenderedFile) Path ¶
func (file RenderedFile) Path() string
Path returns the canonical rendered target path.
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result is one immutable deterministic normalization result.
func Render ¶
func Render(input RenderInput, limits Limits) (Result, error)
Render normalizes one Markdown page or auxiliary asset without mutating a workspace or source.
func (Result) CatalogDigest ¶
CatalogDigest returns the catalog identity used for rendering.
func (Result) Diagnostics ¶
func (result Result) Diagnostics() []knowl.SourceDiagnostic
Diagnostics returns detached, bounded non-fatal compatibility observations.
func (Result) Files ¶
func (result Result) Files() []RenderedFile
Files returns detached immutable rendered file values.
func (Result) FormatVersion ¶
FormatVersion returns the rendering contract version.
func (Result) MirrorDigest ¶
MirrorDigest returns the independent mirror render identity.