Documentation
¶
Index ¶
- type BackoffStrategy
- type Client
- func (c *Client) ReadDelta(from, to string, acceptedAlgorithms []string) (*apicommon.ReadDeltaResponse, error)
- func (c *Client) ReadDeltaAsStream(from, to string, acceptedAlgorithms []string) (*v1.Descriptor, string, io.ReadCloser, error)
- func (c *Client) ReadDeltaAsync(from, to string, acceptedAlgorithms []string) (res *apicommon.ReadDeltaResponse, exists bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackoffStrategy ¶
type BackoffStrategy interface {
Wait() error
}
BackoffStrategy is used to avoid flooding the server with requests when clients are waiting for the delta request to be completed.
func DefaultBackoff ¶
func DefaultBackoff() BackoffStrategy
DefaultBackoff returns a sensible default BackoffStrategy (exponential with an upper bound).
func NewExponentialBackoffWithJitter ¶
func NewExponentialBackoffWithJitter(baseDelay, maxDelay time.Duration, maxAttempts uint) BackoffStrategy
NewExponentialBackoffWithJitter creates a new instance of exponentialBackoffWithJitter
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides the functionality to interact with the Doras server API.
func NewEdgeClient ¶
func NewEdgeClient(serverURL string, allowHttp bool, tokenProvider client.AuthProvider) (*Client, error)
NewEdgeClient returns a client that can be used to interact with the Doras server API.
func (*Client) ReadDelta ¶
func (c *Client) ReadDelta(from, to string, acceptedAlgorithms []string) (*apicommon.ReadDeltaResponse, error)
ReadDelta requests a delta between the two provided images and returns the server's response. Blocks until the delta has been created or an error is detected. The server supports non-blocking requests for deltas, to use them use the sibling function ReadDeltaAsync.
func (*Client) ReadDeltaAsStream ¶
func (c *Client) ReadDeltaAsStream(from, to string, acceptedAlgorithms []string) (*v1.Descriptor, string, io.ReadCloser, error)
ReadDeltaAsStream requests a delta between the two provided images and reads it as a stream.
func (*Client) ReadDeltaAsync ¶
func (c *Client) ReadDeltaAsync(from, to string, acceptedAlgorithms []string) (res *apicommon.ReadDeltaResponse, exists bool, err error)
ReadDeltaAsync requests a delta between the two provided images and returns the server's response. The function does not block if the delta is still being created. If the delta has been created exists will be set to true. If `err == nil && exists` is true then the request has been accepted by the server but the delta has not been created.