datamodule

package
v0.140.4 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package datamodule is the kitchen sink's synthetic dataset provider and managed target. It owns only data_example_* tables in a dedicated SQLite file. The generic lifecycle service owns operations, receipts and generations.

Index

Constants

View Source
const OrdersReportSurface = "synthetic-orders-report"
View Source
const TargetID = "kitchen-sink"

Variables

This section is empty.

Functions

func Hash

func Hash(value string) string

func RenderOrdersReport

func RenderOrdersReport(report OrdersReport) ([]byte, error)

RenderOrdersReport renders the report view fragment. Values are escaped by html/template; the fragment carries no document, script, form or link.

Types

type OrdersReport

type OrdersReport struct {
	Orders      []Record `json:"orders"`
	OrderCount  int      `json:"order_count"`
	AmountTotal int      `json:"amount_total"`
	Unit        string   `json:"unit"`
}

OrdersReport is the ordinary application report read model, shared by active and preview views. It is not an explorer sample envelope. Queries use an explicit physical stage and never a production/default connection.

type Record

type Record struct {
	ID       string `json:"id"`
	Amount   int    `json:"amount"`
	LocalDay string `json:"local_day"`
}

type Runtime

type Runtime struct {
	Store *sqlitestore.Store
	// contains filtered or unexported fields
}

Runtime is both the provider and target adapter. SQLite immediate transactions serialize physical effects with the management store's lease acquisition in the same database. CheckLease runs after taking that write lock, so a newer management fence cannot commit between checking authority and writing rows.

func Open

func Open(filename string) (*Runtime, error)

func OpenWithOptions

func OpenWithOptions(filename string, options RuntimeOptions) (*Runtime, error)

func (*Runtime) ActiveOrdersReport

func (r *Runtime) ActiveOrdersReport(ctx context.Context, target data.TargetKey) (OrdersReport, error)

func (*Runtime) ActiveRecords

func (r *Runtime) ActiveRecords(ctx context.Context, target data.TargetKey) ([]Record, error)

ActiveRecords is an application read of the physical route, useful to prove a scenario switch changes the query result rather than only the console label.

func (*Runtime) Allocate

func (r *Runtime) Allocate(ctx context.Context, work data.Work) error

func (*Runtime) AuthorizeExplore

func (*Runtime) AuthorizeExplore(ctx context.Context, p data.Principal, a data.ExploreAccess) error

func (*Runtime) Capabilities

func (*Runtime) Capabilities() data.TargetCapabilities

func (*Runtime) Catalog

func (r *Runtime) Catalog(_ context.Context, _ data.Principal, target data.TargetKey, limit int) ([]data.DatasetRef, error)

func (*Runtime) Close

func (r *Runtime) Close() error

func (*Runtime) Commit

func (r *Runtime) Commit(ctx context.Context, work data.Work, intent data.Intent) error

func (*Runtime) Describe

func (*Runtime) DrainCleanup

func (r *Runtime) DrainCleanup(ctx context.Context, work data.Work, stage string) error

func (*Runtime) EndPreview

func (r *Runtime) EndPreview(ctx context.Context, id, state string) error

func (*Runtime) ExploreInsights

func (*Runtime) ExploreMetadata

func (r *Runtime) ExploreMetadata(ctx context.Context, p data.Principal, read data.ExploreRead) (data.ExploreMetadata, error)

func (*Runtime) ExploreRelated

func (*Runtime) ExploreSamples

func (*Runtime) InsightAuthorizationRevision

func (*Runtime) InsightAuthorizationRevision(ctx context.Context, _ data.Principal) (string, error)

Synthetic domain policy is immutable: all isolated fields/metrics are allowed by the fixed allowlists in AuthorizeExplore. Host grants are checked separately.

func (*Runtime) InsightMetricSets

func (r *Runtime) InsightMetricSets(ctx context.Context, p data.Principal, read data.ExploreRead) ([]data.InsightMetricSet, error)

func (*Runtime) InspectIntent

func (r *Runtime) InspectIntent(ctx context.Context, intent data.Intent) (data.Observation, error)

func (*Runtime) InspectPreview

func (r *Runtime) InspectPreview(ctx context.Context, w data.PreviewRecord) error

func (*Runtime) InspectReceipt

func (r *Runtime) InspectReceipt(ctx context.Context, receipt data.PreparationReceipt) error

func (*Runtime) LookupPreview

func (r *Runtime) LookupPreview(ctx context.Context, id string) (data.PreviewRecord, error)

func (*Runtime) OpenPreview

func (r *Runtime) OpenPreview(ctx context.Context, w data.PreviewRecord, quota int) (data.PreviewRecord, error)

func (*Runtime) Plan

func (r *Runtime) Plan(ctx context.Context, p data.Principal, kind data.Kind, input data.Input) ([]data.Check, error)

func (*Runtime) Prepare

func (r *Runtime) Prepare(ctx context.Context, work data.Work) (data.PreparationReceipt, error)

func (*Runtime) PreviewGuarantees

func (*Runtime) PreviewGuarantees() data.PreviewGuarantees

func (*Runtime) PreviewOrdersReport

func (r *Runtime) PreviewOrdersReport(ctx context.Context, read data.PreviewReadContext) (OrdersReport, error)

func (*Runtime) PreviewReadiness

func (r *Runtime) PreviewReadiness(ctx context.Context, p data.Principal, read data.ExploreRead) error

func (*Runtime) PrunePreviews

func (r *Runtime) PrunePreviews(ctx context.Context, limit int) error

func (*Runtime) Refresh

func (r *Runtime) Refresh(ctx context.Context, work data.Work) (data.PreparationReceipt, error)

func (*Runtime) Validate

func (r *Runtime) Validate(ctx context.Context, _ data.Principal, input data.Input) ([]data.Check, error)

func (*Runtime) Verify

type RuntimeOptions

type RuntimeOptions struct {
	Store                  sqlitestore.Options
	PreviewCleanupInterval time.Duration
}

RuntimeOptions supplies one clock to the durable adapter and service tests. Cleanup is always enabled; the interval is bounded to at most one minute.

Jump to

Keyboard shortcuts

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