disks

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MkfsEXT4

func MkfsEXT4(ctx context.Context, dev string) error

Types

type DevicePool

type DevicePool interface {
	CreateDevice(id string, size uint64) (string, error)
	DeleteDevice(id string) error
	Snapshot(id, snapshot string) error
	DeleteSnapshot(id, snapshot string) error
}

type Disk

type Disk struct {
	Id               string    `json:"id"`
	SizeMB           uint64    `json:"size_mb"`
	CreatedAt        time.Time `json:"created_at"`
	AttachedInstance string    `json:"attached_instance"`
	Path             string    `json:"path"`
}

type DiskSnapshot

type DiskSnapshot struct {
	Id        string    `json:"id"`
	DiskId    string    `json:"disk_id"`
	CreatedAt time.Time `json:"created_at"`
}

type DiskTX

type DiskTX interface {
	Commit() error
	Rollback() error
	ListDisks() ([]Disk, error)
	GetDisk(id string) (*Disk, error)
	PutDisk(disk *Disk) error
	DeleteDisk(id string) error
}

type Service

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

func NewService

func NewService(store Store, pool DevicePool) *Service

func (*Service) AttachInstance

func (s *Service) AttachInstance(instance string, disks ...string) error

func (*Service) CreateDisk

func (s *Service) CreateDisk(id string, sizeMB uint64) (*Disk, error)

func (*Service) DestroyDisk

func (s *Service) DestroyDisk(id string) error

func (*Service) DetachInstance

func (s *Service) DetachInstance(disk ...string) error

func (*Service) GetDisk

func (s *Service) GetDisk(id string) (*Disk, error)

func (*Service) GetDisks

func (s *Service) GetDisks(ids ...string) ([]Disk, error)

func (*Service) ListDisks

func (s *Service) ListDisks() ([]Disk, error)

type Store

type Store interface {
	BeginDiskTX(writable bool) (DiskTX, error)
}

type ZFSPool

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

func NewZFSPool

func NewZFSPool(pool string) *ZFSPool

func (*ZFSPool) CreateDevice

func (z *ZFSPool) CreateDevice(id string, size uint64) (string, error)

func (*ZFSPool) DeleteDevice

func (z *ZFSPool) DeleteDevice(id string) error

func (*ZFSPool) DeleteSnapshot

func (z *ZFSPool) DeleteSnapshot(id, snapshot string) error

func (*ZFSPool) Snapshot

func (z *ZFSPool) Snapshot(id, snapshot string) error

Jump to

Keyboard shortcuts

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