volume

package
v0.0.0-...-90deddd Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package volume implements support for maintaining (EBS) volumes on an EC2 instance by watching the disk usage of the underlying disk device and resizing the EBS volumes whenever necessary based on provided parameters.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Device

type Device interface {
	// FSSize returns the total amount of disk space in the filesystem.
	FSSize() (data.Size, error)

	// FSUsage returns the percentage of disk space in-use in the filesystem.
	FSUsage() (float64, error)

	// ResizeFS resizes the filesystem.
	ResizeFS() error
}

Device is an abstraction of a physical or logical device.

type Volume

type Volume interface {
	Device

	// EBSSize returns the sum of the size of all EBS volumes.
	EBSSize(ctx context.Context) (size data.Size, err error)

	// ResizeEBS resizes the EBS volumes such that their sizes add up to newSize.
	ResizeEBS(ctx context.Context, newSize data.Size) error

	// EBSIds returns the IDs of all EBS volumes.
	EBSIds() []string
}

Volume is an abstraction of a disk device backed by an EC2 instance's EBS volumes.

func NewEbsLvmVolume

func NewEbsLvmVolume(sess *session.Session, log *log.Logger, path string) (Volume, error)

NewEbsLvmVolume returns a Volume backed by EC2 EBS volumes grouped together in an LVM device. Enforces that all backing EBS volumes are of equal size and of the same type. Size modifications are done such that the size is distributed equally across all volumes.

type Watcher

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

Watcher has the capability of watching a volume and resizing it if and when necessary based on configured set of parameters.

func NewWatcher

func NewWatcher(v Volume, w infra.VolumeWatcher, log *log.Logger) (*Watcher, error)

NewWatcher creates a new watcher.

func (*Watcher) Watch

func (w *Watcher) Watch(ctx context.Context)

Watch watches the underlying volume and resizes it whenever necessary. Watch will not return until the provided context is done.

Jump to

Keyboard shortcuts

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