syncer

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package syncer is the daemon's sync engine: scan, spool, read, batch, upload; state advances only on ACK.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	Root          string // Claude projects dir
	State         *state.DB
	Spool         *spool.Spool
	Up            Uploader
	MaxBatchBytes int // uncompressed line bytes per request, default 4 MiB
	MaxBatchLines int // default 5000
	Now           func() time.Time
	MaxLine       int // lines and snapshots above this many bytes are never uploaded, only recorded as skipped; default protocol.MaxLineBytes
	// contains filtered or unexported fields
}

Engine runs sync passes.

func (*Engine) Pass

func (e *Engine) Pass(ctx context.Context) (res Result, err error)

Pass runs until everything currently on disk is acked or an error occurs. Errors from Up are returned unchanged. A partial scan error is returned (wrapped) only when the pass otherwise succeeded.

type Result

type Result struct {
	Uploaded     int64 // bytes acked in this pass
	PendingFiles int   // files still behind
}

Result summarises a pass.

type Uploader

type Uploader interface {
	Ingest(ctx context.Context, req protocol.IngestRequest) (protocol.IngestResponse, error)
	Files(ctx context.Context) ([]protocol.RemoteFile, error)
}

Uploader is the server API the engine needs (satisfied by client.Client).

Jump to

Keyboard shortcuts

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