Documentation
¶
Overview ¶
Package content provides a versioned content-pack loader: a manifest- indexed bundle of typed entries that loads at boot, validates checksums, supports diffing across versions, and offers hot-reload for dev loops.
Domain-agnostic; common applications:
- Game content (exported assets, level data, balance tables).
- Strategy or ML config bundles shipped alongside code.
- Static dataset releases consumed by data-driven services.
A pack is a directory (or .tar.gz archive) with a `manifest.json` describing the entries inside.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrManifestMissing = errors.New("content: manifest.json not found") ErrEntryMissing = errors.New("content: entry not in manifest") ErrHashMismatch = errors.New("content: entry SHA256 mismatch") ErrTypeMismatch = errors.New("content: typed view requested wrong type") )
Errors surfaced from this package.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder constructs content packs.
func NewBuilder ¶
NewBuilder returns a fresh Builder for the given pack id + version.
type DiffReport ¶
DiffReport summarises the changes between two Manifests.
func Diff ¶
func Diff(old, new Manifest) DiffReport
Diff returns the entries added, removed, or changed (by SHA256) between old and new manifests.
type Entry ¶
type Entry struct {
Path string `json:"path"`
Type string `json:"type"`
SHA256 string `json:"sha256"`
Size int64 `json:"size"`
}
Entry is one file inside the pack.
type Manifest ¶
type Manifest struct {
Pack PackID `json:"pack"`
Version Version `json:"version"`
BuiltAt time.Time `json:"built_at"`
Entries []Entry `json:"entries"`
}
Manifest describes the entries of a content pack.
type Pack ¶
type Pack struct {
// contains filtered or unexported fields
}
Pack is a loaded content pack on disk.
func Load ¶
Load opens the pack rooted at path and reads its manifest. Entry bytes are loaded lazily on first Read.
type TypedView ¶
type TypedView[T any] struct { // contains filtered or unexported fields }
TypedView provides typed access to the subset of pack entries of a given logical Type. Constructed once via TypedFor and reused for the pack's lifetime; cache misses load and decode lazily.
func TypedFor ¶
TypedFor returns a TypedView over entries of the given logical Type (matching Manifest.Entries.Type) decoded via loader.