[RFC] CubeVolume — Persistent Storage for CubeSandbox #470
Replies: 3 comments 1 reply
-
|
· Does the E2B-compatible API shape make sense to you? |
Beta Was this translation helpful? Give feedback.
-
|
Hi maintainers, thanks for sharing this design. I’m interested in helping with the Persistent Storage for CubeSandbox and would like to understand the current development status before starting work. Could you clarify:
If there is no active implementation yet, I’d be happy to start with a small scoped PR, for example defining the shared VolumeInfo / VolumeMount data structures and wiring the sandbox creation path first. Please let me know the preferred starting point and any contribution guidelines I should follow. |
Beta Was this translation helpful? Give feedback.
-
|
Current E2B template only has 1 container. For better flexibility, it's better to allow multiple volume spec inside sandbox spec, and multiple volumeMount spec inside container spec. The VolumeInfo API described above doesn't fit into case of multiple containers. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
[RFC] CubeVolume — Persistent Storage for CubeSandbox
Implemented approach (high level)
Goal: e2b-compatible Volume API with pluggable storage backends. The platform owns lifecycle, identity, and refcount; plugins own backend create/destroy and host mount/unmount.
Layering
cubesandbox>= 0.6.0 (Volume,Sandbox.create(volume_mounts=...)) or raw REST/volumesCRUD; sandbox create carriesvolumeMountst_cube_volume; run Controller hooks (Create / Destroy); cross-node refcount; reject delete while in usehostPathinto the microVM via virtiofsDual-role plugin model (CSI-like)
Plugins support binary (fork + CLI / stdout JSON) and rpc (gRPC). The same four hooks either way;
driveris selected from config before the hook runs.Mount path (sketch)
Volume.create("my-data"), thenSandbox.create(volume_mounts={"/workspace": vol})plugin-volume-*annotationshostPathundervolume_plugin_base_dir, then bind into the sandboxsb.files.*); there is no Volume content REST API in the platform todayRefcount (two layers)
refCount == 0means first Attach / last Detach on that node)t_cube_volume.refcount): number of nodes holding the Volume;DELETE /volumesreturns 409 while non-zeroWhat changed vs. the earlier RFC
/volumesCRUD; plugins do the backend workexamples/volume/cos/{binary,rpc})VolumeInfo(including credentials) flows on sandbox createtokenonlyfilesAPIMinimal SDK usage
Requires platform >= 0.6.0 and
cubesandbox>= 0.6.0. The official e2b Python SDK is not supported against CubeSandbox.Docs & examples
docs/guide/volume-plugin.mdexamples/volume/cos/coolli/volume-plugin-frameworkOriginal RFC draft (historical — superseded by the implementation above)
Goal
A storage-backend-agnostic Volume API. Different backends (COS/S3, NFS, local disk) each derive from a common abstract config and implement a shared interface.
Core Concept
A Volume outlives any individual sandbox. Data is retained after a sandbox is destroyed. The same Volume can be mounted into multiple sandboxes.
Original layering (superseded)
The implemented design moved Volume CRUD into CubeAPI/CubeMaster and split Controller/Node plugin hooks — see the summary above.
Beta Was this translation helpful? Give feedback.
All reactions