schemareader

package
v1.0.63 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package schemareader composes authenticated cache I/O with the shared typed Schema decoder. It owns no declarations, process globals, repair or rendering policy; the CLI consumes these immutable identities.

Package schemareader composes authenticated cache I/O with the shared typed Schema decoder. It owns no declarations, process globals, repair or rendering policy; the CLI consumes these immutable identities.

Index

Constants

View Source
const CatalogSnapshotVersion = 1

Variables

View Source
var ErrInvalidIdentity = errors.New("invalid_schema_identity")

ErrInvalidIdentity is the stable boundary classification for an injected cache identity that is present but incomplete or malformed.

Functions

func Descriptor

Descriptor selects only a range from previously authenticated Meta.

func IndexLocator

func IndexLocator(index schemaruntime.DecodedSchemaPayloadIndex, raw string) (string, bool)

IndexLocator resolves a raw query path to its product through the payload index, accepting the same spellings as Locator.

func Locator

func Locator(meta schemaruntime.DecodedSchemaMeta, raw string) (string, bool)

func PayloadDescriptor

PayloadDescriptor selects one product's command payload range from an authenticated payload index.

func ReadCommandPayload

func ReadCommandPayload(cache *schemacache.Cache, identity Identity, index schemaruntime.DecodedSchemaPayloadIndex, productID string) (schemaruntime.DecodedCommandPayloads, error)

ReadCommandPayload authenticates and decodes one product's command payload header (complete CommandMeta rows plus the rendered leaf index), located through the pinned payload index. The payload file is deliberately independent of the registry so a corrupted registry cannot affect it.

func ReadCommandPayloadRange

func ReadCommandPayloadRange(payloads *schemacache.Registry, identity Identity, index schemaruntime.DecodedSchemaPayloadIndex, productID string) (schemaruntime.DecodedCommandPayloads, error)

ReadCommandPayloadRange is ReadCommandPayload on an already authenticated handle.

func ReadMeta

func ReadMeta(cache *schemacache.Cache, identity Identity) (schemaruntime.DecodedSchemaMeta, error)

ReadMeta only decodes bytes authenticated against the binary's expectation. It also binds the DTO's Registry descriptor to that same pinned identity.

func ReadPayloadIndex

func ReadPayloadIndex(cache *schemacache.Cache, identity Identity) (schemaruntime.DecodedSchemaPayloadIndex, error)

ReadPayloadIndex reads and authenticates the payload file's self-describing index region using only the binary-pinned identity; Meta is never involved.

func ReadPayloadIndexRange

func ReadPayloadIndexRange(payloads *schemacache.Registry, identity Identity) (schemaruntime.DecodedSchemaPayloadIndex, error)

ReadPayloadIndexRange is ReadPayloadIndex on an already authenticated handle.

func ReadProduct

ReadProduct authenticates the selected range before any protobuf decoding. Meta must come from ReadMeta; callers must never supply disk-learned identity.

func ReadRenderedLeaf

func ReadRenderedLeaf(cache *schemacache.Cache, identity Identity, index schemaruntime.DecodedSchemaPayloadIndex, productID string, ref schemaruntime.RenderedLeafRef) ([]byte, error)

ReadRenderedLeaf reads one pre-rendered leaf blob from the product's payload shard blob region. The ref comes from the already authenticated shard header.

func ReadRenderedLeafRange

func ReadRenderedLeafRange(payloads *schemacache.Registry, identity Identity, index schemaruntime.DecodedSchemaPayloadIndex, productID string, ref schemaruntime.RenderedLeafRef) ([]byte, error)

ReadRenderedLeafRange is ReadRenderedLeaf on an already authenticated handle.

Types

type Identity

type Identity struct {
	Edition                string
	CatalogSnapshotVersion uint32
	SourceSHA256           [sha256.Size]byte
	SurfaceSHA256          [sha256.Size]byte
	BuildID                [sha256.Size]byte
	Meta                   schemacache.ArtifactExpectation
	Registry               schemacache.ArtifactExpectation
	Payload                schemacache.ArtifactExpectation
	// PayloadIndex pins the payload file's self-describing index region (its
	// 4-byte length prefix plus the SchemaPayloadIndex proto), so command
	// lookups can authenticate it without reading Meta.
	PayloadIndexLength uint64
	PayloadIndexSHA256 [sha256.Size]byte
}

func ParseIdentity

func ParseIdentity(raw RawIdentity) (Identity, error)

func ParseOptionalIdentity

func ParseOptionalIdentity(raw RawIdentity) (*Identity, error)

ParseOptionalIdentity distinguishes an intentionally disabled build (every field is empty) from a partially injected or malformed identity. A broken identity must never be treated as an ordinary cache miss.

func (Identity) ExpectedIdentity

func (identity Identity) ExpectedIdentity() schemacache.ExpectedIdentity

func (Identity) Validate

func (i Identity) Validate() error

type RawIdentity

type RawIdentity struct {
	Edition, SourceSHA256, SurfaceSHA256, BuildID                        string
	MetaLength, MetaSHA256, RegistryLength, RegistrySHA256               string
	PayloadLength, PayloadSHA256, PayloadIndexLength, PayloadIndexSHA256 string
}

RawIdentity contains injected identity fields, never file or environment data.

Jump to

Keyboard shortcuts

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