backup

package
v1.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package backup contains OpenCloud backup functionality.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckProviderConsistency

func CheckProviderConsistency(storagepath string, lbs ListBlobstore, fail bool) error

CheckProviderConsistency checks the consistency of a space

Types

type BlobData

type BlobData struct {
	BlobPath string
}

BlobData about the blobs in the blobstore

type Consistency

type Consistency struct {
	// Storing the data like this might take a lot of memory
	// we might need to optimize this if we run into memory issues
	Nodes          map[string][]Inconsistency
	LinkedNodes    map[string][]Inconsistency
	BlobReferences map[string][]Inconsistency
	Blobs          map[string][]Inconsistency
	// contains filtered or unexported fields
}

Consistency holds the node and blob data of a storage provider

func NewConsistency

func NewConsistency() *Consistency

NewConsistency creates a new Consistency object

func (*Consistency) GatherData

func (c *Consistency) GatherData(events <-chan interface{})

GatherData gathers and evaluates data produced by the DataProvider

func (*Consistency) PrintResults

func (c *Consistency) PrintResults(discpath string, fail bool) error

PrintResults prints the results of the evaluation

type DataProvider

type DataProvider struct {
	Events chan interface{}
	// contains filtered or unexported fields
}

DataProvider provides data for the consistency check

func NewProvider

func NewProvider(fsys fs.FS, discpath string, lbs ListBlobstore) *DataProvider

NewProvider creates a new DataProvider object

func (*DataProvider) ProduceData

func (dp *DataProvider) ProduceData() error

ProduceData produces data for the consistency check Spawns 4 go-routines at the moment. If needed, this can be optimized.

type Inconsistency

type Inconsistency string

Inconsistency describes the type of inconsistency

var (
	// InconsistencyBlobMissing is an inconsistency where a blob is missing in the blobstore
	InconsistencyBlobMissing Inconsistency = "blob missing"
	// InconsistencyBlobOrphaned is an inconsistency where a blob in the blobstore has no reference
	InconsistencyBlobOrphaned Inconsistency = "blob orphaned"
	// InconsistencyNodeMissing is an inconsistency where a symlink points to a non-existing node
	InconsistencyNodeMissing Inconsistency = "node missing"
	// InconsistencyMetadataMissing is an inconsistency where a node is missing metadata
	InconsistencyMetadataMissing Inconsistency = "metadata missing"
	// InconsistencySymlinkMissing is an inconsistency where a node is missing a symlink
	InconsistencySymlinkMissing Inconsistency = "symlink missing"
	// InconsistencyFilesMissing is an inconsistency where a node is missing metadata files like .mpk or .mlock
	InconsistencyFilesMissing Inconsistency = "files missing"
	// InconsistencyMalformedFile is an inconsistency where a node has a malformed metadata file
	InconsistencyMalformedFile Inconsistency = "malformed file"
)

type LinkData

type LinkData struct {
	LinkPath string
	NodePath string
}

LinkData about the symlinks

type ListBlobstore

type ListBlobstore interface {
	List() ([]*node.Node, error)
	Path(node *node.Node) string
}

ListBlobstore required to check blob consistency

type NodeData

type NodeData struct {
	NodePath        string
	BlobPath        string
	RequiresSymlink bool
	Inconsistencies []Inconsistency
}

NodeData holds data about the nodes

Jump to

Keyboard shortcuts

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