Help us shape the future of Go! Take the 2026 Go Developer Survey

dataengine

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package dataengine coordinates durable processing through semantic storage operations. Storage owns transactions, dataset selection and revision fences; the engine owns interpretation, worker serialization and wakeup lifecycle.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backend

type Backend interface {
	// One process owns scheduling. LoadWork is selection, not a durable claim
	// for independent processes; multi-server leases require a separate contract.
	// LoadWork returns no work only when no eligible component exists. On a
	// failure it preserves dataset/root identity when already known for retry.
	LoadWork(context.Context) (Work, bool, error)
	// PublishProjection atomically fences and publishes. Stale work returns
	// false without mutation; the engine decides when to retry fresh work.
	PublishProjection(context.Context, Work, evidence.Projection) (bool, error)
	// RecordFailure keeps the component pending with durable bounded backoff.
	RecordFailure(context.Context, Work)
}

type ConcurrentBackend

type ConcurrentBackend interface {
	Backend
	LoadWorkExcluding(context.Context, []Work, int64) (Work, bool, error)
}

ConcurrentBackend selects a complete component disjoint from all exclusions. Exclusions include active claims and briefly delayed stale components; only their dataset and scope membership are needed, not records or byte estimates. A positive byte limit excludes components larger than the remaining budget; zero allows a large component to run alone rather than starve indefinitely.

type Metadata

type Metadata struct {
	DatabaseID, DatasetID, Kind                                         string
	Generation, InputRevision, Revision, LastIngestionAtMs, CreatedAtMs int64
	TargetGeneration                                                    int64
}

Metadata identifies one dataset and its accepted/published processing revisions.

type Work

type Work struct {
	DatasetID            string
	Revision, Generation int64
	Root                 string
	// Bytes is the size of stored sanitized JSON, used for bounded admission.
	Bytes   int64
	Scopes  map[string]int64
	Records []evidence.Stored
}

Work is a consistent dataset-scoped connected component. Publication must fence its generation, membership and every scope revision in one transaction.

type Worker

type Worker struct {
	// contains filtered or unexported fields
}

func NewWorker

func NewWorker() *Worker

func (*Worker) ProcessNext

func (w *Worker) ProcessNext(ctx context.Context, backend Backend) (worked bool, failure error)

func (*Worker) Run

func (w *Worker) Run(ctx context.Context, backend Backend, report func(error))

func (*Worker) Wake

func (w *Worker) Wake()

Jump to

Keyboard shortcuts

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