migration

package
v0.0.0-...-ca3ac9b Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package migration this package holds a async service for doing some tenant related migration tasks, like backup, restore, check

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateBackup

func MigrateBackup(tntsrv interfaces.TenantManager, stgf interfaces.StorageFactory) error

MigrateBackup migrates all blobs in the main storage for all tenants into the backup storage, if not already present

Types

type BackupCheck

type BackupCheck struct {
	Tenant string
}

BackupCheck the struct for doing a backup

type CheckContext

type CheckContext struct {
	TenantID string
	CheckID  string
	Started  time.Time
	Finished time.Time
	Cache    interfaces.BlobStorage
	Primary  interfaces.BlobStorage
	Backup   interfaces.BlobStorage
	Running  bool
	Filename string
	BlobID   string

	Message string
	// contains filtered or unexported fields
}

CheckContext struct for the running check

func (*CheckContext) CheckStorage

func (c *CheckContext) CheckStorage() (string, error)

CheckStorage checks the storage to find inconsistencies. It will write a audit file with a line for every blob in the storage, including name, hash, and state

func (*CheckContext) IsRunning

func (c *CheckContext) IsRunning() bool

IsRunning checking if this task is running

type CheckResultLine

type CheckResultLine struct {
	ID            string
	Filename      string
	InCache       bool
	InBackup      bool
	PrimaryHashOK bool
	BackupHashOK  bool
	HasError      bool
	Messages      []string
}

CheckResultLine on entry for the result of the check, usually converted into one report output line

type Management

type Management struct {
	StorageFactory interfaces.StorageFactory
	// contains filtered or unexported fields
}

Management this service takes control over several async migration parts, as backup, checks ...

func (*Management) Close

func (m *Management) Close() error

Close closing this service

func (*Management) GetResult

func (m *Management) GetResult(tenant string) (Result, error)

GetResult getting the result of the last migration task

func (*Management) Init

func (m *Management) Init() error

Init creates a new migration service

func (*Management) IsRunning

func (m *Management) IsRunning(tenant string) bool

IsRunning checking if a migration task is running for a tenant

func (*Management) StartCheck

func (m *Management) StartCheck(tenant string) (string, error)

StartCheck starting a check of all blob for a tenant

func (*Management) StartRestore

func (m *Management) StartRestore(tenant string) (string, error)

StartRestore starting a restore task for a tenant

type RestoreContext

type RestoreContext struct {
	TenantID  string
	ID        string
	Started   time.Time
	Finnished time.Time
	Primary   interfaces.BlobStorage
	Backup    interfaces.BlobStorage
	Running   bool
	// contains filtered or unexported fields
}

RestoreContext struct for the running a full restore of the tenant

func MigrateRestore

func MigrateRestore(tenant string, stgf interfaces.StorageFactory) (*RestoreContext, error)

MigrateRestore migrates all blobs in the backup storage for a tenant into the main storage, if not already present

func (*RestoreContext) IsRunning

func (r *RestoreContext) IsRunning() bool

IsRunning checking if a full restore is running

func (*RestoreContext) Restore

func (r *RestoreContext) Restore()

Restore starting a full restore of a tenant

type Result

type Result struct {
	ID        string
	Startet   time.Time
	Finnished time.Time
	Running   bool
	BlobID    string
	Command   string
}

Result is the result of a async migration task

Jump to

Keyboard shortcuts

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