syncer

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Jul 2, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package syncer combines resolution and upload for a single session file. Both the one-shot sync command and the watch loop drive files through it, so the "resolve to a project, then push the gap" logic lives in one place.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result

type Result struct {
	File          discover.File
	Kind          resolve.Kind
	ProjectKey    string
	LocalRoot     string
	Cwd           string
	Skipped       bool
	Reason        string
	Err           error
	Action        upload.Action
	UploadedBytes int64
	MessageCount  int
}

Result is the outcome of syncing one file: a skip with a reason, an error, or a successful upload action. Kind classifies how the session resolved; Reason carries the detail behind a standalone or orphaned classification (or a skip).

func (Result) Destination

func (r Result) Destination() string

Destination is a short label for where the file was backed up, for logs and summaries. A remote session shows its project key; a standalone session backed by a live worktree shows the repo root it grouped under; any other local session shows its kind and working directory, since it has no remote.

type Syncer

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

Syncer resolves files and uploads them to one server as one machine. When finalize is set, every file it syncs is uploaded as terminal: a Codex session's withheld trailing turn is flushed now rather than after the idle settle window, for ephemeral hosts (CI, cloud sandboxes) whose window never elapses.

func New

func New(r fileResolver, u fileUploader, machine string, finalize bool) *Syncer

New builds a Syncer. finalize forces every synced session's trailing turn to be treated as settled (see Syncer); the watch loop and devseed pass false, only `akari sync --finalize` passes true.

func (*Syncer) SyncOne

func (s *Syncer) SyncOne(ctx context.Context, f discover.File) Result

SyncOne resolves a file to its project and uploads any new bytes. It never returns an error directly; failures are reported in Result.Err so a caller processing many files can record and continue.

Jump to

Keyboard shortcuts

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