snapshotter

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2023 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DumpObject

func DumpObject(resource client.Object, logPath string, logger logr.Logger) error

DumpObject is a helper function to generically dump resource definition given the resource reference and file path for dumping location.

func GetClient

func GetClient() *deployer

GetClient return a deployer client, implementing the DeployerInterface

func InitializeClient

func InitializeClient(ctx context.Context, l logr.Logger, c client.Client, numOfWorker int)

InitializeClient initializes a snapshot client implementing the SnapshotInterface

Types

type Result

type Result struct {
	ResultStatus
	Err error
}

type ResultStatus

type ResultStatus int64
const (
	Collected ResultStatus = iota
	InProgress
	Failed
	Unavailable
)

func (ResultStatus) String

func (r ResultStatus) String() string

type SnapshotInterface

type SnapshotInterface interface {
	// Collect creates a request to take a snapshot.
	// When worker is available to fulfill such request, RequestHandler
	// will be invoked in the worker context.
	// snapshotName is the name of the Snaphost instance making this request.
	Collect(ctx context.Context, snapshotName string) error

	// IsInProgress returns true, request to take a snaphost currently in progress.
	IsInProgress(snapshot string) bool

	// GetResult returns result for a given request.
	GetResult(ctx context.Context, snapshostName string) Result

	// ListSnapshots returns list all snapshots taken for a given Snapshot instance
	ListSnapshots(snapshotInstance *utilsv1alpha1.Snapshot,
		logger logr.Logger) ([]string, error)

	// GetCollectedSnapshotFolder returns the artifact folder where snapshots are
	// collected for a given Snapshot instance
	GetCollectedSnapshotFolder(snapshotInstance *utilsv1alpha1.Snapshot,
		logger logr.Logger) (*string, error)

	// GetNamespacedResources returns all namespaced resources contained in the
	// snapshotFoler.
	// Returns a map with:
	// - key: <namespace name>
	// - value: list of resources of the Kind specified
	GetNamespacedResources(snapshotFolder, kind string, logger logr.Logger,
	) (map[string][]*unstructured.Unstructured, error)

	// CleanupEntries removes any entry (from any internal data structure) for
	// given snapshot request
	CleanupEntries(snapshotInstance *utilsv1alpha1.Snapshot) error
}

Jump to

Keyboard shortcuts

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