Documentation
¶
Overview ¶
Package meshclient is the Mesh team-sync client: the low-level RPC transport to a mesh-hub plus the high-level vault orchestration (join + reconcile) that reads and writes a vault's local sync state. It never runs git; it speaks the pull-based reconcile protocol over HTTPS. cmd/mesh drives it, and the future TUI RemoteBackend will reuse it.
Index ¶
- Variables
- func StreamEvents(ctx context.Context, vaultDir string, nudge chan<- struct{}) error
- type Client
- func (c *Client) CurationActivity(limit int) ([]syncproto.CurationJob, error)
- func (c *Client) CurationJob(id int64) (syncproto.CurationJob, error)
- func (c *Client) CurationJobs() ([]syncproto.CurationJob, error)
- func (c *Client) FailCuration(id int64, reason string) error
- func (c *Client) Join(invite string) (syncproto.JoinResponse, error)
- func (c *Client) ResolveCuration(id int64, resolvedHead string) error
- func (c *Client) Sync(req syncproto.SyncRequest) (syncproto.SyncResponse, error)
- func (c *Client) Vault() (syncproto.VaultInfo, error)
- type Summary
Constants ¶
This section is empty.
Variables ¶
var Logf = func(string, ...any) {}
Logf is an optional sink for non-fatal StreamEvents diagnostics (e.g. an auth-class rejection). Defaults to a no-op so the library stays quiet unless a caller (cmd/mesh) wires in a logger.
Functions ¶
func StreamEvents ¶
StreamEvents subscribes to the hub's SSE nudge stream for a joined vault and sends a (non-blocking) signal on nudge for every "head changed" event. It reconnects until ctx is cancelled, so a dropped stream self-heals. The nudge is stateless: the caller just runs a reconcile, so a missed or coalesced event is harmless (the periodic reconcile is the safety net). StreamEvents returns nil on ctx cancellation; it returns an error only if the vault is not joined (no credentials). A server-side rejection is not fatal here: an auth-class status (401/403/410) may be transient during a hub restart, so it backs off longer and logs rather than giving up, while the caller's periodic reconcile keeps the vault converging regardless.
Types ¶
type Client ¶
Client is the HTTP transport to one hub.
func ClientForVault ¶
ClientForVault builds an authed transport from a joined vault's stored credentials (.mesh/credentials). Used by the mesh-curator to call the hub's curation endpoints with the same token it syncs with.
func (*Client) CurationActivity ¶
func (c *Client) CurationActivity(limit int) ([]syncproto.CurationJob, error)
CurationActivity lists the hub's recent terminal curation jobs (resolved + failed), most-recent first, for the team-wide "what did the curator do" view. limit <= 0 uses the hub default.
func (*Client) CurationJob ¶
func (c *Client) CurationJob(id int64) (syncproto.CurationJob, error)
CurationJob fetches one job including its IncomingB64 (the losing version).
func (*Client) CurationJobs ¶
func (c *Client) CurationJobs() ([]syncproto.CurationJob, error)
CurationJobs lists the hub's pending curation markers (metadata only).
func (*Client) FailCuration ¶
FailCuration charges a failed attempt against a job; the hub marks it terminal at the attempt cap so a job the agent cannot satisfy stops being retried.
func (*Client) Join ¶
func (c *Client) Join(invite string) (syncproto.JoinResponse, error)
Join redeems a one-time invite for a client token (no bearer needed).
func (*Client) ResolveCuration ¶
ResolveCuration marks a job resolved, recording the HEAD the merge landed at.
func (*Client) Sync ¶
func (c *Client) Sync(req syncproto.SyncRequest) (syncproto.SyncResponse, error)
Sync runs one reconcile round (authed).
type Summary ¶
type Summary struct {
Pushed int
Pulled int
Conflicts int
Head string
ConflictSiblings []string // merge conflicts: our pushed version parked here
Protected []string // external-editor race: incoming hub version parked here
Dropped []string // full-reconcile: locals removed because deleted upstream
Rejected []string // hub refused these (viewer/ACL/scope/oversize); kept dirty to retry
}
Summary reports what a sync round did, for the CLI.