pocketenv/volume

Manage persistent volumes mounted in a sandbox.

Volumes provide durable storage that survives sandbox restarts.

Types

A persistent volume mounted in a sandbox.

pub type Volume {
  Volume(
    id: String,
    name: String,
    path: String,
    created_at: String,
  )
}

Constructors

  • Volume(
      id: String,
      name: String,
      path: String,
      created_at: String,
    )

Values

pub fn create(
  sb: sandbox.ConnectedSandbox,
  name: String,
  path: String,
) -> Result(Nil, pocketenv.PocketenvError)

Creates a volume named name mounted at path.

Example

let assert Ok(Nil) = sb |> volume.create("data", "/mnt/data")
pub fn delete(
  sb: sandbox.ConnectedSandbox,
  id: String,
) -> Result(Nil, pocketenv.PocketenvError)

Deletes the volume identified by id.

pub fn list(
  sb: sandbox.ConnectedSandbox,
) -> Result(List(Volume), pocketenv.PocketenvError)

Lists all volumes attached to the sandbox.

Example

let assert Ok(vols) = sb |> volume.list()
pub fn volume_decoder() -> decode.Decoder(Volume)

JSON decoder for Volume.

Search Document