Documentation
¶
Overview ¶
Package artifact is the snapshot/artifact pipeline (roadmap E4): it turns a product-rendered dataset into an IMMUTABLE, versioned artifact — content plus its sha256, a structured sidecar, and the template version/effective date it was produced under. The framework owns immutability (append-only grants), per-(tenant,kind) versioning, hashing, and tamper-verification; the product supplies the rendered bytes (e.g. a PDF/A from its own renderer), so no document-format library enters the kernel.
Index ¶
- type Artifact
- type Input
- type Pipeline
- func (p *Pipeline) Generate(ctx context.Context, db database.TenantDB, in Input) (Artifact, error)
- func (p *Pipeline) Get(ctx context.Context, db database.TenantDB, id uuid.UUID) (Artifact, error)
- func (p *Pipeline) List(ctx context.Context, db database.TenantDB, kind string) ([]Artifact, error)
- func (p *Pipeline) Verify(ctx context.Context, db database.TenantDB, id uuid.UUID) (bool, error)
- type TemplateVersion
- type Templates
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Artifact ¶
type Artifact struct {
ID uuid.UUID
Kind string
Version int
ContentHash string
ContentType string
Sidecar map[string]any
TemplateVersion string
Content []byte
}
Artifact is a stored artifact's metadata (Content is included only by Get).
type Input ¶
type Input struct {
Kind string // 'receipt', 'certificate', …
Content []byte
ContentType string // default application/pdf
Sidecar map[string]any
TemplateVersion string
EffectiveDate time.Time // zero → NULL
}
Input describes one artifact to generate. Content is the product-rendered bytes (the framework hashes and stores them verbatim — it never re-encodes them).
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
Pipeline generates and reads artifacts.
func (*Pipeline) Generate ¶
Generate hashes and stores an immutable artifact in the caller's tenant tx, assigning the next per-(tenant,kind) version. Content is required. A concurrent generate of the same kind that collides on version returns KindConflict (retry).
func (*Pipeline) List ¶
List returns a kind's artifacts newest-version first (metadata only, no content).
type TemplateVersion ¶
TemplateVersion identifies a template revision and the instant from which it takes effect. Artifacts record which version they were produced under, so a document can always be regenerated or explained against the rules that applied on its effective date (roadmap E4: "templates versioned by effective date").
type Templates ¶
type Templates struct {
// contains filtered or unexported fields
}
Templates resolves which template version applies at a given date. It is an in-memory registry populated at boot (the versions themselves — the actual rendering assets — live wherever the product keeps them).
func (*Templates) Register ¶
Register adds a template version for a kind, effective from the given instant. Registering the same version again updates its effective date.