Skip to main content
A volume is a tenant-owned blob (gzip-compressed tar archive) that lives in Declaw’s object store. You upload a volume once with CreateVolume() and attach it to any number of sandboxes at create time via WithVolumes(). On boot, Declaw streams the blob from object storage and materializes its regular-file entries under the attachment’s MountPath before the first command runs.

declaw.CreateVolume()

Upload a tar.gz and register it.
string
required
Human-readable name. The server returns a stable VolumeID.
[]byte
required
The gzip-compressed tar archive. Must start with gzip magic bytes (0x1F 0x8B). Pass nil or empty for an empty volume.
Returns (*VolumeInfo, error)

declaw.ListVolumes()

List all volumes owned by the caller.
Returns ([]VolumeInfo, error)

declaw.GetVolume()

Fetch metadata for a single volume.
Returns (*VolumeInfo, error)

declaw.DownloadVolume()

Download the contents of a volume as raw bytes.
Returns ([]byte, error)

declaw.DeleteVolume()

Delete a volume by its ID.
Returns error

Attaching to a sandbox

Pass WithVolumes() to Create():
The same VolumeID can appear in many sandbox-create calls in parallel; each sandbox gets its own materialized copy.

File-granular volumes (live mounts)

The volumes above are copy-mode: a tar.gz hydrated into the sandbox at boot, with writes private to each sandbox. A file-granular volume is different — you can edit its files directly from the SDK (no sandbox), and live-mount it into a sandbox so reads and writes go straight to the shared volume. File-granular volumes have a flat 64 GiB capacity cap.

Create a file-granular volume

Edit files without a sandbox — VolumeFilesFor()

files.Info(ctx, path) returns a Version token; pass it via a WriteFileOption for an optimistic compare-and-set write (a 409 means the file changed underneath you).

Live-mount into a sandbox

Use declaw.VolumeModeMountRO for a read-only mount — guest writes are rejected with a read-only-filesystem error. Live mounts require a file-granular volume; copy-mode volumes can only use declaw.VolumeModeCopy.

Mount a sub-path

Mount just part of a volume with Subpath (live-mount only — the server rejects it on a copy attach):

Snapshot a sandbox’s files into a volume

Capture filesystem state from a running sandbox into a new volume — the source is never modified:
SnapshotVolume captures any in-sandbox path; CommitVolume captures the mount path of an already-attached volume. Both return a new *VolumeInfo; pass "" for name to let the server default it. Synthetic paths (/proc, /sys, /dev) are rejected.

Advisory locks

Coordinate writers to a shared (live-mounted) volume with advisory leases over a (volume, path) pair. Acquire returns a token you must present to Renew / Release:
Locks are advisory — they coordinate cooperating writers; they don’t block I/O from code that ignores them.

Data models

VolumeInfo

VolumeAttachment