Skip to content
Development GuidesAna Software Architecture

Package Volumes

Volumes are used to store large asset files to keep the Docker images for channels small, which translates to faster startup times for the channel. Volumes are specified in a Package using the package.yml file. The below package.yml file is from the example package in the example channel.

yaml
volumes:
  example: 'e66b164e-8796-48aa-8597-636d85bec240'

objects:
  YoYo:
    filename: example:YoYo.blend
  BubbleBottle:
    filename: example:BubbleBottle.blend
  Skateboard:
    filename: example:Skateboard.blend
  Cube:
    filename: example:Cube.blend
  Light Wooden Box:
    filename: example:Containers/LightWoodenBox.blend

When specifying a volume, you must use a key, value pair where the key is a unique name used locally for the volume and the value is the Volume ID on the platform. Volume IDs are generated when the volume is created via anatools' create_managed_volume(name, *organizationId*) SDK call or through the web interface. See the anatools SDK documentation for more details on creating volumes.

Accessing Volume Files

Files are referenced from the volume using the get_volume_path(package, rel_path) function where the package parameter is the name of the package, i.e. "example", and the rel_path is the volume:pathinvolume. To get the file path for the blender file containing the YoYo object this call would be get_volume_path('example', 'example:LowPoly.blend'). Anatools has a helper function for creating object generators from blender files, this is an example of loading the YoYo object from the blender file and wrapping it in a YoYoObject class: get_blendfile_generator("example", YoyoObject, "YoYo").

Local Development with anamount

Volumes can be mounted during local development using the anamount command. Calling anamount from the workspace directory of the development container will mount the package volumes in the workspace directory at "data/volumes/<volume-id>", but only if the user has read or write permissions to the volume.