Documentation
¶
Overview ¶
Package storage provides local file storage for sandbox execution outputs.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type File ¶
type File struct {
Key string `json:"key"`
Size int64 `json:"size"`
LastModified string `json:"last_modified,omitempty"`
URL string `json:"url,omitempty"`
}
File represents a stored file's metadata.
type Scope ¶ added in v0.37.0
Scope identifies the storage namespace for an execution's files. When a session is active, files are grouped under the session so a multi-turn session's outputs share one parent directory (<session>/<execution>/); otherwise they fall back to the execution ID alone.
type Service ¶
type Service interface {
// Upload stores a file scoped to a session/execution and returns its key,
// public URL, and path on the server host.
Upload(scope Scope, name string, body io.Reader) (UploadResult, error)
// List returns files scoped to a session/execution, optionally filtered by prefix.
List(scope Scope, prefix string) ([]File, error)
// GetURL returns the public URL for a file scoped to a session/execution.
GetURL(scope Scope, key string) string
// ServeFile serves a stored file over HTTP.
ServeFile(w http.ResponseWriter, r *http.Request, filePath string)
}
Service provides file storage backed by an afero filesystem.
type UploadResult ¶ added in v0.37.0
UploadResult describes a stored file. Path is the file's location on the server host's filesystem — only directly openable when the server runs on the same host as the caller (e.g. the local CLI), not when storage lives in a container volume.