remotesync

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package remotesync imports committed node facts without owning execution.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Connection

type Connection interface {
	Remote
	GetJob(context.Context, string) (jobcontract.Snapshot, error)
	ListJobs(context.Context, uint64, uint32) (jobhost.JobPage, error)
	Close() error
}

type Dependencies

type Dependencies struct {
	Repository remoteresults.Repository
	Documents  DocumentCache
}

type DocumentCache

type DocumentCache interface {
	Read(context.Context, jobcontract.ReportReference, func(context.Context, io.ReadWriteSeeker) error) ([]byte, error)
}

type DocumentOutcome

type DocumentOutcome struct {
	Imported bool
}

type DocumentRequest

type DocumentRequest struct {
	Request  Request
	Document remoteresults.DocumentReference
}

type Node

type Node struct {
	Origin   remoteresults.Origin
	Revision uint64
}

type NodeStatus

type NodeStatus struct {
	ConfigurationID string    `json:"configuration_id"`
	State           string    `json:"state"`
	ErrorCode       string    `json:"error_code"`
	ObservedAt      time.Time `json:"observed_at"`
	AppliedAt       time.Time `json:"applied_at"`
}

type Outcome

type Outcome struct {
	Mirror remoteresults.Mirror
	// MoreEvents describes the observed page tail, not execution settlement or
	// a final artifact manifest. A later pass may discover newly committed facts.
	MoreEvents bool
}

type Request

type Request struct {
	Origin remoteresults.Origin
	JobID  string
	Remote Remote
}

type Synchronizer

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

func New

func New(dependencies Dependencies) (*Synchronizer, error)

func (*Synchronizer) ImportDocument

func (synchronizer *Synchronizer) ImportDocument(
	ctx context.Context,
	input DocumentRequest,
) (DocumentOutcome, error)

ImportDocument authenticates one persisted immutable reference before reading bytes. Candidate pages are hints, never authority to download another owner.

func (*Synchronizer) Observe

func (synchronizer *Synchronizer) Observe(ctx context.Context, request Request) (Outcome, error)

Observe imports bounded event pages without waiting for any document. Cancellation stops observation only; committed per-job cursors remain durable.

type Watcher

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

func NewWatcher

func NewWatcher(ctx context.Context, dependencies WatcherDependencies) (*Watcher, error)

func (*Watcher) Close

func (watcher *Watcher) Close() error

func (*Watcher) Run

func (watcher *Watcher) Run() error

Run owns bounded per-node observers. Admission discovery keeps its tail; a separate history scan revisits earlier jobs for late facts and reports.

func (*Watcher) Snapshot

func (watcher *Watcher) Snapshot() WatcherSnapshot

func (*Watcher) SubscribeChanges

func (watcher *Watcher) SubscribeChanges(observer func()) func()

SubscribeChanges signals committed local mirror/report changes. Notifications carry no remote payload; consumers re-read their bounded local projections. Observers must return promptly and may unsubscribe from their own callback.

type WatcherDependencies

type WatcherDependencies struct {
	Synchronizer     *Synchronizer
	Nodes            func(context.Context) ([]Node, error)
	Connect          func(context.Context, Node) (Connection, error)
	FactPriorityJobs func(context.Context, remoteresults.Origin, string, uint32) (remoteresults.PriorityPage, error)
	DocumentWork     func(context.Context, remoteresults.DocumentQuery) (remoteresults.DocumentPage, error)
}

type WatcherSnapshot

type WatcherSnapshot struct {
	Running   bool         `json:"running"`
	ErrorCode string       `json:"error_code"`
	Nodes     []NodeStatus `json:"nodes"`
}

Jump to

Keyboard shortcuts

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