Documentation
¶
Overview ¶
Package client calls a live worker: the supervisor a stream origin talks to, or (inside the supervisor) one of its worker processes, which answer the same API over a Unix socket.
Index ¶
- Constants
- func ClassOf(err error) string
- type Client
- func (c *Client) CloseIdle()
- func (c *Client) Do(ctx context.Context, path string, body []byte) (*Reply, error)
- func (c *Client) GetJSON(ctx context.Context, path string, v any) (int, error)
- func (c *Client) Init(ctx context.Context, req api.Request) (*Output, error)
- func (c *Client) Segment(ctx context.Context, req api.Request) (*Output, error)
- func (c *Client) Subtitle(ctx context.Context, req api.SubtitleRequest) ([]byte, error)
- type Error
- type Output
- type Reply
Constants ¶
const MaxBody = 256 << 20
MaxBody bounds a response body read into memory (a 20-s segment of a high-bitrate rung, with room to spare).
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is one live worker's API.
func New ¶
New is a client of the worker at base (http://host:port), sending token as a bearer token when it is not empty. hc nil: a client with keep-alive connections and no overall timeout (each call's context bounds it).
func (*Client) CloseIdle ¶
func (c *Client) CloseIdle()
CloseIdle closes the client's idle connections.
func (*Client) Do ¶
Do posts body (JSON) to path and reads the answer, whatever its status. An error is a transport error.
func (*Client) GetJSON ¶
GetJSON gets a JSON endpoint (/healthz, /v1/status, /v1/jobs) into v and returns the status.