backup

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TypeJSON = "json"
	TypeYAML = "yaml"

	LimitPerFile         = 50
	EntityNameIndexSplit = "__"
	DateSuffixLayout     = "20060102_150405"

	DefaultStorageExporter = "default_storage_exporter"
	BackupDetailsFilename  = "backup.yaml"

	// storage backup directory name
	StorageBackupDirectoryName = "storage"
)

global backup/restore constants

Variables

This section is empty.

Functions

func CopyFiles

func CopyFiles(logger *zap.Logger, sourceDir, dstDir string, overwrite bool) error

copies files from a location to another location

Types

type Backup

type Backup interface {
	Import(data interface{}) error
	List(filters []storageTY.Filter, pagination *storageTY.Pagination) (*storageTY.Result, error)
	GetEntityInterface() interface{}
}

used to import and export data to database via existing api

type BackupDetails

type BackupDetails struct {
	Filename          string            `json:"filename" yaml:"filename"`
	StorageExportType string            `json:"storage_export_type" yaml:"storage_export_type"`
	CreatedOn         time.Time         `json:"created_on" yaml:"created_on"`
	Version           version.Version   `json:"version" yaml:"version"`
	Directories       map[string]string `json:"directories" yaml:"directories"`
}

BackupDetails of a export

type BackupFile

type BackupFile struct {
	ID           string    `json:"id" yaml:"id"`
	LocationName string    `json:"locationName" yaml:"locationName"`
	ProviderType string    `json:"providerType" yaml:"providerType"`
	Directory    string    `json:"directory" yaml:"directory"`
	FileName     string    `json:"fileName" yaml:"fileName"`
	FileSize     int64     `json:"fileSize" yaml:"fileSize"`
	FullPath     string    `json:"fullPath" yaml:"fullPath"`
	ModifiedOn   time.Time `json:"modifiedOn" yaml:"modifiedOn"`
}

BackupFile details

type BackupLocationDisk

type BackupLocationDisk struct {
	TargetDirectory string
}

BackupLocationDisk details

type BackupRestore

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

func New

func New(ctx context.Context, directories map[string]string) (*BackupRestore, error)

func (*BackupRestore) ExecuteImportStorage

func (br *BackupRestore) ExecuteImportStorage(apiMap map[string]Backup, sourceDir, fileType string, ignoreEmptyDir bool) error

ExecuteImportStorage update data into database

func (*BackupRestore) ExecuteRestore

func (br *BackupRestore) ExecuteRestore(storage storageTY.Plugin, apiMap map[string]Backup, extractedDir string, updateRestoreApiMapFn updateRestoreApiMap) error

func (*BackupRestore) ExportStorage

func (br *BackupRestore) ExportStorage(exportMap map[string]Backup, transformerFunc DataTransformerFunc, targetDir, exportFormat string) error

exports data from database to disk

func (*BackupRestore) ExtractExportedZipFile

func (br *BackupRestore) ExtractExportedZipFile(exportedZipFile, targetDir, restoreReferenceDir, restoreReferenceFilename string) error

type DataTransformerFunc

type DataTransformerFunc func(logger *zap.Logger, entityName string, data interface{}, storageExportType string) (interface{}, error)

data transformer used to modify entity data

type OnDemandBackupConfig

type OnDemandBackupConfig struct {
	Prefix            string `json:"prefix" yaml:"prefix"`
	StorageExportType string `json:"storageExportType" yaml:"storageExportType"`
	TargetLocation    string `json:"targetLocation" yaml:"targetLocation"`
	Handler           string `json:"handler" yaml:"handler"`
}

OnDemandBackupConfig config

Jump to

Keyboard shortcuts

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