Documentation
¶
Overview ¶
Package client is the daemon's HTTP client for the Braid server.
Index ¶
- Variables
- type Backoff
- type Client
- func (c *Client) Files(ctx context.Context) ([]protocol.RemoteFile, error)
- func (c *Client) Ingest(ctx context.Context, req protocol.IngestRequest) (protocol.IngestResponse, error)
- func (c *Client) Revoke(ctx context.Context) error
- func (c *Client) StatsSelf(ctx context.Context, session string) (Self, error)
- type PermanentError
- type ProtocolMismatchError
- type RetryableError
- type Self
- type SelfLimit
- type SelfSession
- type SelfToday
Constants ¶
This section is empty.
Variables ¶
ErrUnauthorized means the server rejected the device token (401).
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
type Backoff struct {
Min, Max time.Duration
Rand func() float64 // [0,1); defaults to math/rand/v2
}
Backoff computes jittered exponential delays.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client talks to the Braid server.
func (*Client) Files ¶
Files lists the files the server knows for this device, following the cursor through all pages.
func (*Client) Ingest ¶
func (c *Client) Ingest(ctx context.Context, req protocol.IngestRequest) (protocol.IngestResponse, error)
Ingest uploads a batch of file changes.
type PermanentError ¶
PermanentError is any other non-success status.
func (*PermanentError) Error ¶
func (e *PermanentError) Error() string
type ProtocolMismatchError ¶
type ProtocolMismatchError struct{ Server, Min int }
ProtocolMismatchError is returned on 426.
func (*ProtocolMismatchError) Error ¶
func (e *ProtocolMismatchError) Error() string
type RetryableError ¶
RetryableError covers network errors, 408, 429 and 5xx.
func (*RetryableError) Error ¶
func (e *RetryableError) Error() string
func (*RetryableError) Unwrap ¶
func (e *RetryableError) Unwrap() error
type Self ¶
type Self struct {
Today SelfToday `json:"today"`
Session *SelfSession `json:"session"`
Limit *SelfLimit `json:"limit"`
}
Self is the subset of GET /v1/stats/self the CLI uses; unknown fields are ignored.
type SelfSession ¶
type SelfSession struct {
CostUSD float64 `json:"cost_usd"`
Tokens int64 `json:"tokens"`
Failures int64 `json:"failures"`
}
SelfSession is one session's figures.