volume

package
v0.0.0-...-9f60fe2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2023 License: MPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Driver

type Driver interface {
	Mount(ctx context.Context, volumeID, path string) error
	Unmount(ctx context.Context, volumeID, path string) error
}

type Provider

type Provider interface {
	// Name returns the name of the provider.
	Name() string
	// VolumeCreate creates a volume. The size is in GB.
	VolumeCreate(ctx context.Context, size int) (Volume, error)
	// VolumeDelete deletes the volume.
	VolumeDelete(ctx context.Context) error
	// VolumeGet gets the volume.
	VolumeGet(ctx context.Context, id string) (Volume, error)
	// VolumeList lists all volumes the provider has.
	VolumeList(ctx context.Context) ([]Volume, error)
	// VolumeResize resizes the volume to the given size in GB.
	VolumeResize(ctx context.Context, size int) error
}

Provider allows management of volumes from different providers (eg AWS, GCP).

type Service

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

func NewVolumeService

func NewVolumeService(namespace string, provider Provider, store Store) *Service

func (*Service) Create

func (s *Service) Create(ctx context.Context, size int) (types.Volume, error)

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, id string) error

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (types.Volume, error)

func (*Service) List

func (s *Service) List(ctx context.Context) ([]types.Volume, error)

func (*Service) Mount

func (s *Service) Mount(ctx context.Context, id, path string) error

func (*Service) UnMount

func (s *Service) UnMount(ctx context.Context, id, path string) error

type Store

type Store interface {
	Create(namespace string, id, provider string) (types.Volume, error)
	Get(namespace, id string) (types.Volume, error)
	List(namespace string) ([]types.Volume, error)
	Remove(namespace, id string) error
	Update(namespace string, volume types.Volume) error
}

Store is an interface that must be implemented any volume store.

type Volume

type Volume interface {
	// ID returns the ID of the volume.
	ID() string
	// Mount mounts the volume to the given path.
	Mount(ctx context.Context, path string) error
	// Unmount unmounts the volume from the given path.
	Unmount(ctx context.Context, path string) error
}

Volume is an interface that must be implemented by a volume. The implementation of the volume interface should have the ability/permissions to mount the volume onto a container inside a node. For instance, this could be an AWS EBS volume mounted onto a container inside an EC2 machine, a FUSE volume on top of S3/GCS, etc.

Jump to

Keyboard shortcuts

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