client

package
v0.1.0-M4 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2023 License: Apache-2.0, EPL-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// BackupDirProperty represents a constant for backup directory flag
	BackupDirProperty = "backup.dir"

	// LastOperationProperty represents a constant for lastOperation property of BackupAndRestore feature
	LastOperationProperty = "lastOperation"
)
View Source
const (
	BackupStarted  = "BACKUP_STARTED"
	BackupFinished = "BACKUP_FINISHED"
	BackupFailed   = "BACKUP_FAILED"

	RestoreStarted  = "RESTORE_STARTED"
	RestoreFinished = "RESTORE_FINISHED"
	RestoreFailed   = "RESTORE_FAILED"
)

Constants for the BackupAndRestore states

View Source
const (
	OperationBackup  = "backup"
	OperationRestore = "restore"
)

Constants for BackupAndRestore feature operations

View Source
const (
	ErrNoDownloadURL     = "Download URL not specified!"
	ErrNoBackupDir       = "backup directory not specified"
	ErrBackupDirNotFound = "backup directory '%s' not found"
	ErrAccessForbidden   = "accessing directory '%s' is not permitted under mode '%v'"
)

Error messages constants

View Source
const (
	BackupAndRestoreFeatureID = "BackupAndRestore"
)

Constant for BackupAndRestore feature ID

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupAndRestore

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

BackupAndRestore feature implementation

func NewBackupAndRestore

func NewBackupAndRestore(backupCfg *BackupAndRestoreConfig) (*BackupAndRestore, error)

NewBackupAndRestore constructs backup and restore feature from the provided configuration

func (*BackupAndRestore) Connect

func (br *BackupAndRestore) Connect(mqttClient MQTT.Client, edgeCfg *upload.EdgeConfiguration)

Connect connects backup and restore to the ditto endpoint

func (*BackupAndRestore) Disconnect

func (br *BackupAndRestore) Disconnect()

Disconnect disconnects backup and restore from the ditto endpoint

func (*BackupAndRestore) DoTrigger

func (br *BackupAndRestore) DoTrigger(correlationID string, options map[string]string) error

DoTrigger triggers a backup operation, sending a file upload request

func (*BackupAndRestore) HandleOperation

func (br *BackupAndRestore) HandleOperation(operation string, payload []byte) *upload.ErrorResponse

HandleOperation invokes an operation, using the provided payload data

func (*BackupAndRestore) OnTick

func (br *BackupAndRestore) OnTick()

OnTick periodically invokes an operation on backup and restore feature

type BackupAndRestoreConfig

type BackupAndRestoreConfig struct {
	upload.UploadableConfig

	Dir     string `json:"dir,omitempty" descr:"Directory to be backed up"`
	Storage string `json:"storage,omitempty" def:"./storage" descr:"Directory where backups and downloads will be stored"`

	BackupCmd  command `` /* 186-byte string literal not displayed */
	RestoreCmd command `` /* 161-byte string literal not displayed */

	KeepUploaded bool `json:"keepUploaded,omitempty" def:"false" descr:"Keep locally successfully uploaded backups"`

	Mode upload.AccessMode `json:"mode,omitempty" def:"strict" descr:"{mode}"`
	// contains filtered or unexported fields
}

BackupAndRestoreConfig contains configuration for BackupAndRestore feature

func (*BackupAndRestoreConfig) Validate

func (cfg *BackupAndRestoreConfig) Validate()

Validate checks if backup and restore feature configuration is valid

Jump to

Keyboard shortcuts

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