reconcile

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package reconcile owns the bounded multi-source synchronization service.

The service composes validated application ports behind exact scope/source keyed nonblocking leases. Its stage engine is delivered incrementally by the reconciliation stage tasks; until composed, public entrypoints perform full input validation, leasing, and aggregation without mutating durable state.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSyncInProgress reports an overlapping invocation for one exact scope/source.
	ErrSyncInProgress = errors.New("source sync already in progress")
	// ErrSyncPartial reports that SyncAll or Recover completed while at least one source failed.
	ErrSyncPartial = errors.New("source sync completed with source failures")
	// ErrRecoveryFailed reports readiness restoration or resumable-run inspection
	// failure without exposing storage internals.
	ErrRecoveryFailed = errors.New("workspace recovery failed")
)

Stable, redacted service outcomes.

Functions

This section is empty.

Types

type AllResult

type AllResult struct {
	Results []Result
}

AllResult aggregates one deterministic result per attempted source.

type Clock

type Clock func() time.Time

Clock supplies deterministic time to durable transitions.

type Dependencies

type Dependencies struct {
	Adapters      map[knowl.SourceType]app.SourceAdapter
	State         app.SourceStateStore
	Content       app.ContentStore
	SourceContent app.SourceContentStore
	Search        app.SearchIndex
	Maintenance   app.SourceMaintenanceQueue
}

Dependencies binds the validated application ports consumed by the service.

type Options

type Options struct {
	MaxSyncAllSources int
	MaxScanPages      int
	MaxScanDocuments  int
	MaxMutations      int
	MaxRawBytes       int
	MaxRecoveryRuns   int
	Clock             Clock
	NewRunID          RunIDGenerator
}

Options carries conservative validated service bounds and injected clocks.

type Result

type Result struct {
	SourceID     knowl.SourceID
	Run          knowl.SyncRun
	Changed      bool
	FailureClass string
	Diagnostics  []knowl.SourceDiagnostic
}

Result is the redacted observable outcome of one source synchronization attempt.

type RunIDGenerator

type RunIDGenerator func() knowl.SyncRunID

RunIDGenerator supplies bounded opaque durable run identifiers.

type Service

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

Service coordinates bounded idempotent source reconciliation.

func NewService

func NewService(dependencies Dependencies, options Options) (*Service, error)

NewService validates dependencies and options and returns a composed service.

func (*Service) Recover

func (service *Service) Recover(ctx context.Context, scope knowl.ScopeRef, sources []knowl.Source) ([]Result, error)

Recover restores workspace readiness, then resumes every bounded nonterminal run belonging to the configured sources.

func (*Service) SyncAll

func (service *Service) SyncAll(ctx context.Context, scope knowl.ScopeRef, sources []knowl.Source) (AllResult, error)

SyncAll synchronizes enabled deduplicated sources sequentially and deterministically, isolating one source failure from another source's state.

func (*Service) SyncSource

func (service *Service) SyncSource(ctx context.Context, scope knowl.ScopeRef, source knowl.Source) (Result, error)

SyncSource synchronizes exactly one enabled configured source under its lease.

Jump to

Keyboard shortcuts

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