Documentation
¶
Overview ¶
Package cloudstorage issues unauthenticated, idempotent HTTP requests to cloud object storage (S3, Azure Blob, GCS) using short-lived presigned URLs. The URLs are self-authenticating, so the client deliberately carries no Databricks credentials. It owns the inactivity-stall and exact-length guards and a capped retry-with-backoff policy; callers supply the bytes via a Body and interpret the returned Response.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsRetriable ¶
IsRetriable reports whether an error from Attempt is worth retrying: a stalled attempt is, a short read (deterministic) is not, a retryable HTTP status (as an APIError) is, and any other failure is retried only if it is a transient network error (which excludes context cancellation and deadline). It is exported for callers (such as a resumable upload) that run their own resume-aware retry loop over Attempt.
func IsRetryableStatus ¶
IsRetryableStatus reports whether an HTTP status code should be retried. It is exported for callers (such as a resumable upload) that run their own resume-aware retry loop over Attempt rather than using Send.
func IsURLExpired ¶
IsURLExpired reports whether err (as returned by Send) is one of the known cloud-provider "presigned URL expired" errors: a 403 with the AWS or Azure signature-expiry body.
Types ¶
type Body ¶
type Body interface {
// Reader returns a reader over the body positioned at the start. It is called
// once per attempt.
Reader() (io.Reader, error)
// Size reports the body length in bytes, for Content-Length and the
// short-read guard.
Size() int64
}
Body supplies a request's bytes and can re-supply them for each retry attempt, so a request is retried without the caller buffering it again.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client issues requests to cloud object storage over presigned URLs. It holds only an *http.Client: no Databricks credentials, no config.
func New ¶
New returns a Client that sends over the given HTTP client. The caller owns the client's transport, timeouts, and connection-pool sizing; it must not attach Databricks credentials, and should not set a whole-request http.Client.Timeout (it would abort a legitimately long transfer; bound the operation with the request context instead).
func (*Client) Attempt ¶
func (c *Client) Attempt(ctx context.Context, method, url string, headers map[string]string, body Body) (*Response, error)
Attempt performs a single request and returns the raw response. body may be nil for a bodyless request (a status query or an abort).
func (*Client) Send ¶
func (c *Client) Send(ctx context.Context, method, url string, headers map[string]string, body Body) (*Response, error)
Send performs Attempt with capped retries: transient network errors, the retryable statuses in retryStatusCodes (honoring Retry-After), and stalled attempts are retried with exponential backoff. A fresh request and body reader are built per attempt, so no explicit rewind is needed. Exhausting retries on a retryable status returns that status as an error.