Documentation
¶
Overview ¶
Package upload drives the ingest protocol from the client side, statelessly. The server is authoritative for how many bytes of each file it holds, so the client persists nothing: it announces, reconciles against the server's cursor and content hash, and streams the gap in newline-terminated chunks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to one akari server with one bearer token.
func (*Client) SyncFile ¶
SyncFile announces a file, reconciles against the server's cursor, and uploads any new complete lines. It is safe to call repeatedly: an up-to-date file moves no bytes.
A mid-stream offset conflict (HTTP 409) means the server's cursor moved out from under us, so the prefix verified at announce is stale. Rather than trust the conflict's reported cursor blindly (which could append onto a divergent prefix), SyncFile re-announces and re-verifies the prefix from scratch, up to maxConflictRetries times.
type Target ¶
type Target struct {
Agent string
Path string
SourceID string
Kind string
ProjectKey string
LocalRoot string
GitBranch string
Cwd string
Machine string
}
Target is everything needed to upload one resolved session file. Kind is the session's classification ("remote", "standalone", or "orphaned"). ProjectKey is set only for a remote session; for standalone and orphaned sessions the server derives the project key from Machine and the local location. LocalRoot, set only for a standalone session in a live worktree, is the repo root shared by every worktree; the server keys on it so a local-only repo's worktrees collapse into one project. When it is empty the server falls back to Cwd.