volume

package
v0.0.0-...-81c6e22 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

Package volume provides volumes like Docker and Amazon ECS. Volumes are specicial directories that could be shared by multiple containers.

https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definition_parameters.html#volumes

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GuestVolumeImageInput

type GuestVolumeImageInput struct {
	From    string
	To      string
	Volumes []string
}

GuestVolumeImageInput is volume-init command's input.

type GuestVolumeImageOutput

type GuestVolumeImageOutput struct {
	Error string
}

GuestVolumeImageOutput is volume-init command's output.

type GuestVolumeImageProvider

type GuestVolumeImageProvider struct {
	// contains filtered or unexported fields
}

GuestVolumeImageProvider expose volumes from in-VM snapshotters.

func FromGuestImage

func FromGuestImage(client *containerd.Client, vmID, image, snapshot string, volumes []string, opts ...ImageOpt) *GuestVolumeImageProvider

FromGuestImage returns a new provider to that expose the volumes on the given image.

func (*GuestVolumeImageProvider) CreateVolumesUnder

func (p *GuestVolumeImageProvider) CreateVolumesUnder(ctx context.Context, tempDir string) ([]*Volume, error)

CreateVolumesUnder creates volumes under the given directory.

func (*GuestVolumeImageProvider) Delete

Delete all resources made by the provider.

func (*GuestVolumeImageProvider) Name

func (p *GuestVolumeImageProvider) Name() string

Name of the provider.

type ImageOpt

type ImageOpt func(*imageProviderConfig)

ImageOpt allows setting optional properties of the provider.

func WithPullOptions

func WithPullOptions(opts ...containerd.RemoteOpt) ImageOpt

WithPullOptions sets the snapshotter's pull options.

func WithSnapshotter

func WithSnapshotter(ss string) ImageOpt

WithSnapshotter sets the snapshotter to pull images.

type Mount

type Mount struct {
	// Source is the name of a volume.
	Source string
	// Destination is the path inside the container where the volume is mounted.
	Destination string
	// ReadOnly is true if the volume is mounted as read-only.
	ReadOnly bool
	// contains filtered or unexported fields
}

Mount is used to expose volumes to containers.

type Provider

type Provider interface {
	// Name of the provider.
	Name() string

	// CreateVolumesUnder creates volumes under the given directory.
	CreateVolumesUnder(ctx context.Context, tempDir string) ([]*Volume, error)

	// Delete all resources made by the provider.
	Delete(ctx context.Context) error
}

Provider provides volumes from different sources.

func FromImage

func FromImage(client *containerd.Client, image, snapshot string, opts ...ImageOpt) Provider

FromImage returns a new provider to that expose the volumes on the given image.

type Set

type Set struct {
	// contains filtered or unexported fields
}

Set is a set of volumes.

func NewSet

func NewSet(runtime string) *Set

NewSet returns a new volume set.

func NewSetWithTempDir

func NewSetWithTempDir(runtime, tempDir string) *Set

NewSetWithTempDir returns a new volume set and creates all temporary files under the tempDir.

func (*Set) Add

func (vs *Set) Add(v *Volume)

Add a volume to the set.

func (*Set) AddFrom

func (vs *Set) AddFrom(ctx context.Context, vp Provider) error

AddFrom adds volumes from the given provider.

func (*Set) PrepareDirectory

func (vs *Set) PrepareDirectory(ctx context.Context) (retErr error)

PrepareDirectory creates a directory that have volumes.

func (*Set) PrepareDriveMount

func (vs *Set) PrepareDriveMount(ctx context.Context, size int64) (dm *proto.FirecrackerDriveMount, retErr error)

PrepareDriveMount returns a FirecrackerDriveMount that could be used with CreateVM.

func (*Set) PrepareInGuest

func (vs *Set) PrepareInGuest(ctx context.Context, container string) error

PrepareInGuest prepares volumes inside the VM.

func (*Set) WithMounts

func (vs *Set) WithMounts(mountpoints []Mount) (oci.SpecOpts, error)

WithMounts expose given volumes to the container.

func (*Set) WithMountsFromProvider

func (vs *Set) WithMountsFromProvider(name string) (oci.SpecOpts, error)

WithMountsFromProvider exposes volumes from the provider.

type Volume

type Volume struct {
	// contains filtered or unexported fields
}

Volume is a special directory that could be shared between containers.

func FromHost

func FromHost(name, path string) *Volume

FromHost returns a volume which has the files from the given path.

func New

func New(name string) *Volume

New returns an empty volume.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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