Documentation ¶
Index ¶
- Constants
- type BackupAndRestore
- func (br *BackupAndRestore) Connect(mqttClient MQTT.Client, edgeCfg *upload.EdgeConfiguration)
- func (br *BackupAndRestore) Disconnect()
- func (br *BackupAndRestore) DoTrigger(correlationID string, options map[string]string) error
- func (br *BackupAndRestore) HandleOperation(operation string, payload []byte) *upload.ErrorResponse
- func (br *BackupAndRestore) OnTick()
- type BackupAndRestoreConfig
Constants ¶
const ( // BackupDirProperty represents a constant for backup directory flag BackupDirProperty = "backup.dir" // LastOperationProperty represents a constant for lastOperation property of BackupAndRestore feature LastOperationProperty = "lastOperation" )
const ( BackupStarted = "BACKUP_STARTED" BackupFinished = "BACKUP_FINISHED" BackupFailed = "BACKUP_FAILED" RestoreStarted = "RESTORE_STARTED" RestoreFinished = "RESTORE_FINISHED" RestoreFailed = "RESTORE_FAILED" )
Constants for the BackupAndRestore states
const ( OperationBackup = "backup" OperationRestore = "restore" )
Constants for BackupAndRestore feature operations
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
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