client

package
v0.20.0 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: AGPL-3.0 Imports: 5 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 client is the controller side of the sync endpoint protocol. It decides every action; the endpoint executes and computes nothing.

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 speaks to one endpoint over one stream. The protocol is strictly one request in flight, so a Client is not safe for concurrent use.

func New

func New(in io.Reader, out io.Writer) *Client

func (*Client) Handshake

func (c *Client) Handshake(markerMode syncv1.MarkerMode, expectedSessionID string) (*syncv1.HandshakeResponse, error)

Handshake opens the session. markerMode decides whether the endpoint may create a root marker: sync does, cp never does.

func (*Client) Scan

func (c *Client) Scan(cache []*syncv1.CachedDigest) (*syncv1.ScanResponse, error)

func (*Client) StagePut

func (c *Client) StagePut(digest string, size int64, src io.Reader) error

StagePut streams one file into the endpoint's staging directory and verifies the digest it computed over what actually arrived.

func (*Client) StageQuery

func (c *Client) StageQuery(digests []string) (*syncv1.StageQueryResponse, error)

StageQuery reports which of the digests the endpoint does not already hold. Content it has from an earlier cycle is never sent twice.

func (*Client) Supply

func (c *Client) Supply(path, expectedDigest string, dst io.Writer) (*syncv1.SupplyResponse, error)

Supply streams one file out of the endpoint into dst. expectedDigest is what the controller believes the scan found; the endpoint refuses rather than sending different content under that name.

func (*Client) Transition

func (c *Client) Transition(changes []*syncv1.Change) ([]*syncv1.Result, error)

type Error

type Error struct {
	Code    syncv1.ErrorCode
	Message string
}

Error is a failure the endpoint reported for a request, as opposed to a transport failure. The code is what the caller branches on — a root outside the workspace is a user error, an internal failure is not.

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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