Documentation
¶
Overview ¶
Package patterns implements bounded, pure Pattern package and record codecs. It has no storage, service, execution, ownership or device behavior.
Index ¶
Constants ¶
const ( SchemaVersion = 1 SnapshotKind = "nb1-pattern-snapshot" RevisionDomain = "nb1-pattern-record/v1" CompileContract = "nb1-program-effect/v1" MaxRecords = 128 MaxPackageBytes = 1 << 20 MaxCanonicalBytes = 1 << 20 )
Variables ¶
This section is empty.
Functions ¶
func CanonicalRecordJSON ¶
CanonicalRecordJSON returns only the verified record's hash-domain JSON. Revision and the domain/LF prefix are excluded; there is no trailing newline.
func EncodeSnapshot ¶
EncodeSnapshot validates every record and returns the exact frozen wire bytes. Caller order is retained, input values are not mutated, and nil means an empty library rather than a JSON null array.
Types ¶
type Record ¶
type Record struct {
ID string `json:"id"`
Title string `json:"title"`
Source Source `json:"source"`
CompiledProgram control.Program `json:"compiled_program"`
CompileContract string `json:"compile_contract"`
Revision string `json:"revision"`
}
func DecodePackage ¶
DecodePackage accepts one complete authoring or frozen package. Errors never expose a partially accepted slice; the canonical full export is also bounded.
func NewRecord ¶
NewRecord freezes a normalized source and an independent Program snapshot. It never changes caller-owned slices, pointers, ID or title text.
func NormalizeRecord ¶
NormalizeRecord validates a frozen record under its declared supported contract and returns a canonical deep copy with the same verified revision. Equivalent source/compiled defaults are normalized; the contract is not upgraded, and an inconsistent or unverified snapshot is never returned.