volume

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package volume provides a client for E2B persistent volumes.

A Volume is independent of a specific sandbox: it can be mounted via e2b.VolumeMount during Sandbox.Create. Content operations (read/write/ list) talk to the volume-content REST API and authenticate with a per-volume JWT issued by the control plane.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Info

type Info struct {
	ID    string
	Name  string
	Token string
}

Info captures volume metadata.

func List

func List(ctx context.Context, opts Options) ([]Info, error)

List returns all volumes visible to the authenticated caller.

type Options

type Options struct {
	Config e2b.Config
}

Options configure a single volume call.

type Volume

type Volume struct {
	ID   string
	Name string
	// contains filtered or unexported fields
}

Volume is a handle for one persistent volume.

func Connect

func Connect(ctx context.Context, volumeID, token string, opts Options) (*Volume, error)

Connect attaches to an existing volume using a pre-issued token.

func Create

func Create(ctx context.Context, name string, opts Options) (*Volume, error)

Create provisions a new volume.

func (*Volume) Delete

func (v *Volume) Delete(ctx context.Context) error

Delete removes this volume permanently.

func (*Volume) MakeDir

func (v *Volume) MakeDir(ctx context.Context, path string) error

MakeDir creates a directory (including parents) at path.

func (*Volume) ReadFile

func (v *Volume) ReadFile(ctx context.Context, path string) ([]byte, error)

ReadFile downloads the file at path into memory.

func (*Volume) Remove

func (v *Volume) Remove(ctx context.Context, path string) error

Remove deletes a file or directory from the volume.

func (*Volume) Token

func (v *Volume) Token() string

Token returns the auth token for this volume. Callers can persist it and later pass it to Connect.

func (*Volume) WriteFile

func (v *Volume) WriteFile(ctx context.Context, path string, content []byte) error

WriteFile uploads content to path inside the volume.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL