storage

package
v0.0.0-...-3ddbc71 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package storage keeps logic for volumes and snapshots info repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ph string) (*bolt.DB, error)

New creates a new connection to bolt database.

Types

type GarbageRepo

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

GarbageRepo keeps paths to old subvolumes after restore operation. Usually path looks like path.Join(domain.DeloreanMountPoint, fmt.Sprintf("%s.old", vol.Subvol)). We can remove old subvolume after reboot only. The solution is to keep path in storage and remove on the next application run after reboot. This logic works only with force reboot.

func NewGarbageRepo

func NewGarbageRepo(db *bolt.DB) (*GarbageRepo, error)

NewGarbageRepo creates a new snapshot repository.

func (*GarbageRepo) Delete

func (r *GarbageRepo) Delete(ph string) error

Delete path from database.

func (*GarbageRepo) List

func (r *GarbageRepo) List() ([]string, error)

List returns the list paths to old file systems.

func (*GarbageRepo) Put

func (r *GarbageRepo) Put(ph string) error

Put saves a path for old file system to data storage.

type SnapshotRepo

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

SnapshotRepo is a repository for snapshots.

func NewSnapshotRepo

func NewSnapshotRepo(db *bolt.DB) (*SnapshotRepo, error)

NewSnapshotRepo creates a new snapshot repository.

func (*SnapshotRepo) Delete

func (r *SnapshotRepo) Delete(ph string) error

Delete removes snapshot info record by path.

func (*SnapshotRepo) List

func (r *SnapshotRepo) List(ids []uint64) ([]domain.Snapshot, error)

List returns the list of snapshots filtered by volume ids.

func (*SnapshotRepo) Put

func (r *SnapshotRepo) Put(sn domain.Snapshot) error

Put creates a new snapshot info record.

type VolumeRepo

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

VolumeRepo is repository for subvolumes.

func NewVolumeRepo

func NewVolumeRepo(db *bolt.DB) *VolumeRepo

NewVolumeRepo creates a new VolumeRepo.

func (*VolumeRepo) Get

func (r *VolumeRepo) Get(id uint64) (domain.Volume, error)

Get returns volume by id if exists or error.

func (*VolumeRepo) List

func (r *VolumeRepo) List(activeOnly bool) ([]domain.Volume, error)

List returns the list of volumes in database.

func (*VolumeRepo) Put

func (r *VolumeRepo) Put(v domain.Volume) error

Put creates a new volume object in storage or updates an existing one.

Jump to

Keyboard shortcuts

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