Documentation
¶
Overview ¶
Package download provides validated full and ranged streams.
Index ¶
Constants ¶
const ( // DefaultPartSize keeps a 100 MiB object near 13 requests while capping replay at 8 MiB. DefaultPartSize = int64(8 * 1024 * 1024) // DefaultPartRetries tolerates three transient failures without prolonged retrying. DefaultPartRetries = 3 // DefaultRetryDelay keeps three local backoffs below one second before jitter. DefaultRetryDelay = 100 * time.Millisecond // DefaultRetryWaitBudget caps cumulative local sleep for interactive callers. DefaultRetryWaitBudget = 3 * time.Second // DefaultIdleTimeout detects a dead connection within a minute without limiting slow progress. DefaultIdleTimeout = 60 * time.Second )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIStreamFunc ¶
type APIStreamFunc func(context.Context, *larkcore.ApiReq, ...client.Option) (*http.Response, error)
APIStreamFunc is the OAPI streaming capability used by Transport.
type ByteRange ¶
ByteRange is an inclusive HTTP byte range.
func (ByteRange) HeaderValue ¶
HeaderValue returns the value for an HTTP Range header.
type OAPI ¶
type OAPI struct {
// contains filtered or unexported fields
}
OAPI builds authenticated download transports.
func NewOAPI ¶
func NewOAPI(doStream APIStreamFunc) OAPI
NewOAPI creates an authenticated transport factory.
type OAPIRequestOption ¶
type OAPIRequestOption func(*oapiRequestSpec)
OAPIRequestOption configures one declarative OAPI endpoint.
func PathParam ¶
func PathParam(name, value string) OAPIRequestOption
PathParam binds one SDK path placeholder.
func QueryIf ¶
func QueryIf(name, value string) OAPIRequestOption
QueryIf binds a query parameter when value is non-empty.
type Options ¶
type Options struct {
PartSize int64
MaxResponses int
// MaxPartRetries bounds retries per range. Zero selects the default.
MaxPartRetries int
// RetryDelay is the base exponential backoff. Zero selects the default.
RetryDelay time.Duration
// RetryWaitBudget bounds cumulative retry sleeps. Zero selects the default.
RetryWaitBudget time.Duration
// IdleTimeout bounds waiting for response headers or one body read. Time
// between caller reads does not count. Zero selects the default.
IdleTimeout time.Duration
// DisableMultipart forces one full response.
DisableMultipart bool
}
Options controls multipart behavior. Zero values select production defaults.
type Source ¶
type Source struct {
// contains filtered or unexported fields
}
Source binds a transport to its representation stability.
func ImmutableSource ¶
ImmutableSource allows multipart reads without a validator.
func MutableSource ¶
MutableSource requires a strong ETag before combining responses.
type Stream ¶
type Stream struct {
Body io.ReadCloser
Header http.Header
ContentLength int64
}
Stream is one logical full or multipart response.