Documentation
¶
Overview ¶
Package media provides helpers for offloading large streaming payloads to shared object storage while keeping small payloads inline.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadBlob ¶
func ReadBlob(ctx context.Context, sm *storage.StorageManager, ref *StorageReference) ([]byte, error)
ReadBlob loads raw bytes for the given reference.
Types ¶
type StorageReference ¶
type StorageReference struct {
// Path is the object path inside the configured shared storage backend.
Path string `json:"path"`
// ContentType is the MIME type recorded for the stored object.
ContentType string `json:"contentType,omitempty"`
// SizeBytes is the stored blob size when known.
SizeBytes int `json:"sizeBytes,omitempty"`
}
StorageReference describes an object persisted to the shared storage backend.
func MaybeOffloadBlob ¶
func MaybeOffloadBlob( ctx context.Context, sm *storage.StorageManager, data []byte, opts WriteOptions, ) (*StorageReference, error)
MaybeOffloadBlob stores the provided data if it exceeds the inline limit. Returns a storage reference when offload happens; otherwise nil.
type WriteOptions ¶
type WriteOptions struct {
// Namespace scopes the object path to the owning runtime namespace.
Namespace string
// StoryRun scopes the object path to the owning StoryRun.
StoryRun string
// Step scopes the object path to the owning step.
Step string
// Scope appends additional caller-defined path segments.
Scope []string
// ContentType records the MIME type written for the object.
ContentType string
// InlineLimit overrides the default inline/offload threshold.
InlineLimit int
}
WriteOptions control how object paths are composed when offloading payloads.
Click to show internal directories.
Click to hide internal directories.