Documentation
¶
Overview ¶
Package http connects typed HTTP file inputs and responses to storage disks. Authorization and file validation remain the consuming endpoint's policies.
Index ¶
- func Download(disk *storage.Disk, key storage.ObjectKey, options storage.ReadOptions) foundryhttp.Download
- func ResponseError(err error) error
- func StoreUpload(ctx context.Context, disk *storage.Disk, key storage.ObjectKey, ...) (storage.StoredObject, error)
- func Stream(disk *storage.Disk, key storage.ObjectKey, options storage.ReadOptions) foundryhttp.Stream
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Download ¶
func Download(disk *storage.Disk, key storage.ObjectKey, options storage.ReadOptions) foundryhttp.Download
Download defers opening until the typed HTTP handler and authorization succeed. It reuses Foundry's download response, including HEAD, conditional requests, byte ranges, presentation validation and automatic reader cleanup. Seeking streams provider ranges; no complete-object buffer or temporary download file is needed. Signed HTTP endpoints can protect local downloads with the existing URL signer. Never serve a managed local store with a filesystem file server.
func ResponseError ¶ added in v0.8.0
ResponseError maps storage failures to the shared HTTP envelope. Capacity exhaustion (fault.Overloaded, LimitExceeded), disk shutdown and deadlines are retryable 503 responses, not 500s; unclassified adapter failures remain 500. Use it after an application-level storage or attachment read, inside a deferred http.StreamFrom or http.DownloadFrom source. Handle application/domain errors separately first. A nil error returns nil; unclassified errors map to InternalError. The original cause is retained.
func StoreUpload ¶
func StoreUpload(ctx context.Context, disk *storage.Disk, key storage.ObjectKey, file foundryhttp.UploadedFile, options storage.PutOptions) (storage.StoredObject, error)
StoreUpload persists a captured request-owned upload before the request ends. It uses the supplied key, never the client's filename. Existing HTTP upload limits, validation, bounded spooling and request cleanup remain in force. Detected media type is a default only; it is not proof of a valid file format. A successful StoredObject can be retained; UploadedFile cannot outlive requests.
func Stream ¶
func Stream(disk *storage.Disk, key storage.ObjectKey, options storage.ReadOptions) foundryhttp.Stream
Stream works with any storage backend and defers opening to the response phase. It describes a finite stream with a known length; HTTP byte-range and validator negotiation require Download. WithName controls presentation, not object keys.
Types ¶
This section is empty.