Documentation
¶
Index ¶
- Constants
- func FolderSize(path string) (size int64, err error)
- func ZipFolderPath(pathToZip string) (pr *io.PipeReader, err error)
- type Backup
- type BinlogEvent
- type ByTime
- type ByteEvent
- type ChannelWriter
- type Disk
- func (d *Disk) DownloadBackup(fullBackup Backup) (path string, err error)
- func (d *Disk) DownloadBackupWithLogPosition(fullBackupPath string, binlog string) (path string, err error)
- func (d *Disk) DownloadLatestBackup() (path string, err error)
- func (d *Disk) GetFullBackups() (bl []Backup, err error)
- func (d *Disk) GetIncBackupsFromDump(key string) (bl []Backup, err error)
- func (d *Disk) GetStatusError() map[string]string
- func (d *Disk) GetStatusErrorByKey(backupKey string) string
- func (d *Disk) GetStorageServiceName() (name string)
- func (d *Disk) GetTotalIncBackupsFromDump(key string) (t int, err error)
- func (d *Disk) Verify() bool
- func (d *Disk) WriteFolder(p string) (err error)
- func (d *Disk) WriteStream(fileName, mimeType string, body io.Reader, tags map[string]string, dlo bool) error
- type Error
- type IOClosers
- type IncBackup
- type Manager
- func (m *Manager) AddStorage(s Storage)
- func (m *Manager) DownloadBackup(storageService string, fullBackup Backup) (path string, err error)
- func (m *Manager) DownloadBackupWithLogPosition(storageService, fullBackupPath string, binlog string) (path string, err error)
- func (m *Manager) DownloadLatestBackup(storageService string) (path string, err error)
- func (m *Manager) GetFullBackups(storageService string) (bl []Backup, err error)
- func (m *Manager) GetIncBackupsFromDump(storageService, key string) (bl []Backup, err error)
- func (m *Manager) GetStorage(s string) Storage
- func (m *Manager) GetStorageServices() map[string]Storage
- func (m *Manager) GetStorageServicesKeys() (svc []string)
- func (m *Manager) WriteFolderAll(path string) (errs error)
- func (m *Manager) WriteStream(storageService, name, mimeType string, body io.Reader, tags map[string]string, ...) (errs error)
- func (m *Manager) WriteStreamAll(name, mimeType string, body <-chan StreamEvent, dlo bool) (errs error)
- type MariaDBStream
- func (m *MariaDBStream) DownloadBackup(fullBackup Backup) (path string, err error)
- func (m *MariaDBStream) DownloadBackupWithLogPosition(fullBackupPath string, binlog string) (path string, err error)
- func (m *MariaDBStream) DownloadLatestBackup() (path string, err error)
- func (m *MariaDBStream) GetFullBackups() (bl []Backup, err error)
- func (m *MariaDBStream) GetIncBackupsFromDump(key string) (bl []Backup, err error)
- func (m *MariaDBStream) GetStatusError() map[string]string
- func (m *MariaDBStream) GetStatusErrorByKey(backupKey string) string
- func (m *MariaDBStream) GetStorageServiceName() (name string)
- func (m *MariaDBStream) GetTotalIncBackupsFromDump(key string) (t int, err error)
- func (m *MariaDBStream) ProcessBinlogEvent(ctx context.Context, event *replication.BinlogEvent) (err error)
- func (m *MariaDBStream) Verify() bool
- func (m *MariaDBStream) WriteChannel(name, mimeType string, body <-chan StreamEvent, tags map[string]string, ...) (err error)
- func (m *MariaDBStream) WriteFolder(p string) (err error)
- func (m *MariaDBStream) WriteStream(fileName, mimeType string, body io.Reader, tags map[string]string, dlo bool) error
- type MockStorage
- func (s *MockStorage) DownloadBackup(fullBackup Backup) (path string, err error)
- func (s *MockStorage) DownloadBackupWithLogPosition(fullBackupPath string, binlog string) (path string, err error)
- func (s *MockStorage) DownloadLatestBackup() (path string, err error)
- func (s *MockStorage) GetFullBackups() (bl []Backup, err error)
- func (s *MockStorage) GetIncBackupsFromDump(key string) (bl []Backup, err error)
- func (s *MockStorage) GetStatusError() (m map[string]string)
- func (s *MockStorage) GetStatusErrorByKey(backupKey string) string
- func (s *MockStorage) GetStorageServiceName() (name string)
- func (s *MockStorage) GetTotalIncBackupsFromDump(key string) (t int, err error)
- func (s *MockStorage) Verify() bool
- func (s *MockStorage) WithError(e bool)
- func (s *MockStorage) WriteFolder(p string) (err error)
- func (s *MockStorage) WriteStream(name, mimeType string, body io.Reader, tags map[string]string, dlo bool) (err error)
- type NoBackupError
- type S3
- func (s *S3) DownloadBackup(fullBackup Backup) (path string, err error)
- func (s *S3) DownloadBackupWithLogPosition(fullBackupPath, binlog string) (backupPath string, err error)
- func (s *S3) DownloadLatestBackup() (path string, err error)
- func (s *S3) GetFullBackups() (bl []Backup, err error)
- func (s *S3) GetIncBackupsFromDump(key string) (bl []Backup, err error)
- func (s *S3) GetStatusError() map[string]string
- func (s *S3) GetStatusErrorByKey(backupKey string) string
- func (s *S3) GetStorageServiceName() (name string)
- func (s *S3) GetTotalIncBackupsFromDump(key string) (t int, err error)
- func (s *S3) Verify() bool
- func (s *S3) WriteFolder(p string) (err error)
- func (s *S3) WriteStream(fileName, mimeType string, body io.Reader, tags map[string]string, dlo bool) error
- type Storage
- type StreamEvent
- type Swift
- func (s *Swift) DownloadBackup(fullBackup Backup) (path string, err error)
- func (s *Swift) DownloadBackupWithLogPosition(fullBackupPath string, binlog string) (path string, err error)
- func (s *Swift) DownloadLatestBackup() (path string, err error)
- func (s *Swift) GetFullBackups() (b []Backup, err error)
- func (s *Swift) GetIncBackupsFromDump(key string) (bl []Backup, err error)
- func (s *Swift) GetStatusError() map[string]string
- func (s *Swift) GetStatusErrorByKey(backupKey string) string
- func (s *Swift) GetStorageServiceName() (storages string)
- func (s *Swift) GetTotalIncBackupsFromDump(key string) (t int, err error)
- func (s *Swift) Verify() bool
- func (s *Swift) WriteFolder(p string) (err error)
- func (s *Swift) WriteStream(name, mimeType string, body io.Reader, tags map[string]string, dlo bool) (err error)
- type Verify
Constants ¶
const LastSuccessfulBackupFile = "last_successful_backup"
LastSuccessfulBackupFile name of meta file that contains the information of the last successful backup
Variables ¶
This section is empty.
Functions ¶
func FolderSize ¶
FolderSize calcs a folders size
func ZipFolderPath ¶
func ZipFolderPath(pathToZip string) (pr *io.PipeReader, err error)
ZipFolderPath zips a folder
Types ¶
type Backup ¶
type Backup struct { Storage string Time time.Time Key string IncList []IncBackup VerifySuccess *Verify VerifyFail *Verify }
Backup storage struct
type BinlogEvent ¶
type BinlogEvent struct {
Value *replication.BinlogEvent
}
BinlogEvent holds a binlog event
func (*BinlogEvent) ToByte ¶
func (b *BinlogEvent) ToByte() []byte
ToByte returns the byte content of a binlog event
type ChannelWriter ¶
type ChannelWriter interface { // WriteChannel writes the contents of the channel to the storage WriteChannel(name, mimeType string, body <-chan StreamEvent, tags map[string]string, dlo bool) (err error) }
ChannelWriter for storages that do not support consuming io.Reader
type Disk ¶
type Disk struct {
// contains filtered or unexported fields
}
Disk struct is ...
func (*Disk) DownloadBackup ¶
DownloadBackup implements interface
func (*Disk) DownloadBackupWithLogPosition ¶
func (d *Disk) DownloadBackupWithLogPosition(fullBackupPath string, binlog string) (path string, err error)
DownloadBackupWithLogPosition implements interface
func (*Disk) DownloadLatestBackup ¶
DownloadLatestBackup implements interface
func (*Disk) GetFullBackups ¶
GetFullBackups implements interface
Walks the backup basepath and list all full backups. Only backups which contain a dump.tar are listed
func (*Disk) GetIncBackupsFromDump ¶
GetIncBackupsFromDump implements interface
func (*Disk) GetStatusError ¶
GetStatusError implements interface
func (*Disk) GetStatusErrorByKey ¶
GetStatusErrorByKey implements interface
func (*Disk) GetStorageServiceName ¶
GetStorageServiceName implements interface
func (*Disk) GetTotalIncBackupsFromDump ¶
GetTotalIncBackupsFromDump implements interface
func (*Disk) WriteFolder ¶
WriteFolder implements interface
func (*Disk) WriteStream ¶
func (d *Disk) WriteStream(fileName, mimeType string, body io.Reader, tags map[string]string, dlo bool) error
WriteStream implements interface.
Writes a file in the base directory defined in the config. If the fileName is `last_successful_backup` only the tags are written to the file but not its actual content In all other cases the tags are ignored and the body is written to the file
type Error ¶
type Error struct { Storage string // contains filtered or unexported fields }
Error with storage name and error message
type IOClosers ¶
type IOClosers struct {
// contains filtered or unexported fields
}
IOClosers holds all io closers
func NewIOClosers ¶
NewIOClosers creates a list of io closers
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager which manages the different storage services
func NewManager ¶
func NewManager(c config.StorageService, serviceName, restoreFolder, binLog string) (m *Manager, err error)
NewManager creates a new manager instance
func (*Manager) AddStorage ¶
AddStorage can add a specific storage service
func (*Manager) DownloadBackup ¶
DownloadBackup from a specific storage
func (*Manager) DownloadBackupWithLogPosition ¶
func (m *Manager) DownloadBackupWithLogPosition(storageService, fullBackupPath string, binlog string) (path string, err error)
DownloadBackupWithLogPosition from a specific storage and timestamp
func (*Manager) DownloadLatestBackup ¶
DownloadLatestBackup from a specific storage
func (*Manager) GetFullBackups ¶
GetFullBackups lists all available full backups from a specific storage
func (*Manager) GetIncBackupsFromDump ¶
GetIncBackupsFromDump lists all available incremental backups belonging to the full backup from a specific storage
func (*Manager) GetStorage ¶
GetStorage returns a specific storage service
func (*Manager) GetStorageServices ¶
GetStorageServices returns all storage services handled by this manager
func (*Manager) GetStorageServicesKeys ¶
GetStorageServicesKeys returns a list of all storage names
func (*Manager) WriteFolderAll ¶
WriteFolderAll writes a folder to all storages
func (*Manager) WriteStream ¶
func (m *Manager) WriteStream(storageService, name, mimeType string, body io.Reader, tags map[string]string, dlo bool) (errs error)
WriteStream writes a byte stream to a specific storage service
func (*Manager) WriteStreamAll ¶
func (m *Manager) WriteStreamAll(name, mimeType string, body <-chan StreamEvent, dlo bool) (errs error)
WriteStreamAll writes Events either as a byte stream or in channel to all available storage services
type MariaDBStream ¶
type MariaDBStream struct {
// contains filtered or unexported fields
}
MariaDBStream struct is ...
func NewMariaDBStream ¶
func NewMariaDBStream(c config.MariaDBStream, serviceName string) (m *MariaDBStream, err error)
NewMariaDBStream creates a new mariadbstream storage object
func (*MariaDBStream) DownloadBackup ¶
func (m *MariaDBStream) DownloadBackup(fullBackup Backup) (path string, err error)
DownloadBackup implements interface
func (*MariaDBStream) DownloadBackupWithLogPosition ¶
func (m *MariaDBStream) DownloadBackupWithLogPosition(fullBackupPath string, binlog string) (path string, err error)
DownloadBackupWithLogPosition implements interface
func (*MariaDBStream) DownloadLatestBackup ¶
func (m *MariaDBStream) DownloadLatestBackup() (path string, err error)
DownloadLatestBackup implements interface
func (*MariaDBStream) GetFullBackups ¶
func (m *MariaDBStream) GetFullBackups() (bl []Backup, err error)
GetFullBackups implements interface
func (*MariaDBStream) GetIncBackupsFromDump ¶
func (m *MariaDBStream) GetIncBackupsFromDump(key string) (bl []Backup, err error)
GetIncBackupsFromDump implements interface
func (*MariaDBStream) GetStatusError ¶
func (m *MariaDBStream) GetStatusError() map[string]string
GetStatusError implements interface
func (*MariaDBStream) GetStatusErrorByKey ¶
func (m *MariaDBStream) GetStatusErrorByKey(backupKey string) string
GetStatusErrorByKey implements interface
func (*MariaDBStream) GetStorageServiceName ¶
func (m *MariaDBStream) GetStorageServiceName() (name string)
GetStorageServiceName implements interface
func (*MariaDBStream) GetTotalIncBackupsFromDump ¶
func (m *MariaDBStream) GetTotalIncBackupsFromDump(key string) (t int, err error)
GetTotalIncBackupsFromDump implements interface
func (*MariaDBStream) ProcessBinlogEvent ¶
func (m *MariaDBStream) ProcessBinlogEvent(ctx context.Context, event *replication.BinlogEvent) (err error)
ProcessBinlogEvent processes the QueryEvents - Events other than QueryEvent or RowsEvents are ignored - Only replicates all schemas or those set in the config - If schemas are filtered and the schema is set the event will be ignored
func (*MariaDBStream) WriteChannel ¶
func (m *MariaDBStream) WriteChannel(name, mimeType string, body <-chan StreamEvent, tags map[string]string, dlo bool) (err error)
WriteChannel implements interface
func (*MariaDBStream) WriteFolder ¶
func (m *MariaDBStream) WriteFolder(p string) (err error)
WriteFolder implements interface
func (*MariaDBStream) WriteStream ¶
func (m *MariaDBStream) WriteStream(fileName, mimeType string, body io.Reader, tags map[string]string, dlo bool) error
WriteStream implements interface
type MockStorage ¶
type MockStorage struct {
// contains filtered or unexported fields
}
MockStorage struct for testing
func NewMockStorage ¶
func NewMockStorage(c config.Config, serviceName, restoreFolder, binLog string) (m *MockStorage)
NewMockStorage creates a mock storage instance
func (*MockStorage) DownloadBackup ¶
func (s *MockStorage) DownloadBackup(fullBackup Backup) (path string, err error)
DownloadBackup implements interface
func (*MockStorage) DownloadBackupWithLogPosition ¶
func (s *MockStorage) DownloadBackupWithLogPosition(fullBackupPath string, binlog string) (path string, err error)
DownloadBackupWithLogPosition implements interface
func (*MockStorage) DownloadLatestBackup ¶
func (s *MockStorage) DownloadLatestBackup() (path string, err error)
DownloadLatestBackup implements interface
func (*MockStorage) GetFullBackups ¶
func (s *MockStorage) GetFullBackups() (bl []Backup, err error)
GetFullBackups implements interface
func (*MockStorage) GetIncBackupsFromDump ¶
func (s *MockStorage) GetIncBackupsFromDump(key string) (bl []Backup, err error)
GetIncBackupsFromDump implements interface
func (*MockStorage) GetStatusError ¶
func (s *MockStorage) GetStatusError() (m map[string]string)
GetStatusError implements interface
func (*MockStorage) GetStatusErrorByKey ¶
func (s *MockStorage) GetStatusErrorByKey(backupKey string) string
GetStatusErrorByKey implements interface
func (*MockStorage) GetStorageServiceName ¶
func (s *MockStorage) GetStorageServiceName() (name string)
GetStorageServiceName implements interface
func (*MockStorage) GetTotalIncBackupsFromDump ¶
func (s *MockStorage) GetTotalIncBackupsFromDump(key string) (t int, err error)
GetTotalIncBackupsFromDump implements interface
func (*MockStorage) WithError ¶
func (s *MockStorage) WithError(e bool)
WithError implements interface
func (*MockStorage) WriteFolder ¶
func (s *MockStorage) WriteFolder(p string) (err error)
WriteFolder implements interface
func (*MockStorage) WriteStream ¶
func (s *MockStorage) WriteStream(name, mimeType string, body io.Reader, tags map[string]string, dlo bool) (err error)
WriteStream implements interface
type NoBackupError ¶
type NoBackupError struct {
// contains filtered or unexported fields
}
NoBackupError error when no backups are stored
func (*NoBackupError) Error ¶
func (d *NoBackupError) Error() string
type S3 ¶
type S3 struct {
// contains filtered or unexported fields
}
S3 struct is ...
func (*S3) DownloadBackup ¶
DownloadBackup implements interface
func (*S3) DownloadBackupWithLogPosition ¶
func (s *S3) DownloadBackupWithLogPosition(fullBackupPath, binlog string) (backupPath string, err error)
DownloadBackupWithLogPosition implements interface
func (*S3) DownloadLatestBackup ¶
DownloadLatestBackup implements interface
func (*S3) GetFullBackups ¶
GetFullBackups implements interface
func (*S3) GetIncBackupsFromDump ¶
GetIncBackupsFromDump implements interface
func (*S3) GetStatusError ¶
GetStatusError implements interface
func (*S3) GetStatusErrorByKey ¶
GetStatusErrorByKey implements interface
func (*S3) GetStorageServiceName ¶
GetStorageServiceName implements interface
func (*S3) GetTotalIncBackupsFromDump ¶
GetTotalIncBackupsFromDump implements interface
func (*S3) WriteFolder ¶
WriteFolder implements interface
type Storage ¶
type Storage interface { // WriteFolder writes a folder to the storage WriteFolder(p string) (err error) // WriteStream writes a byte stream to the storage WriteStream(name, mimeType string, body io.Reader, tags map[string]string, dlo bool) (err error) // DownloadLatestBackup downloads the latest available backup from a storage DownloadLatestBackup() (path string, err error) // GetFullBackups lists all available full backups per storage GetFullBackups() (bl []Backup, err error) // GetIncBackupsFromDump lists all available incremental backups that belong to a full backup from a storage GetIncBackupsFromDump(key string) (bl []Backup, err error) // DownloadBackupWithLogPosition downloads a specific backup until given binlog position from a storage DownloadBackupWithLogPosition(fullBackupPath string, binlog string) (path string, err error) // DownloadBackup downloads a specific backup from a storage DownloadBackup(b Backup) (path string, err error) // GetStorageServiceName lists all available storages from a service GetStorageServiceName() (name string) // GetStatusError gets the backup->error map GetStatusError() map[string]string // GetStatusErrorByKey returns error per backup GetStatusErrorByKey(backupKey string) string // GetTotalIncBackupsFromDump returns current total incremental backups in this dump GetTotalIncBackupsFromDump(key string) (t int, err error) // check if verify should be run with this Storage Verify() bool }
Storage interface
type StreamEvent ¶
type StreamEvent interface {
ToByte() []byte
}
StreamEvent used to send byte slices or binlog events to the storages
type Swift ¶
type Swift struct {
// contains filtered or unexported fields
}
Swift struct is ...
func (*Swift) DownloadBackup ¶
DownloadBackup implements interface
func (*Swift) DownloadBackupWithLogPosition ¶
func (s *Swift) DownloadBackupWithLogPosition(fullBackupPath string, binlog string) (path string, err error)
DownloadBackupWithLogPosition implements interface
func (*Swift) DownloadLatestBackup ¶
DownloadLatestBackup implements interface
func (*Swift) GetFullBackups ¶
GetFullBackups implements interface
func (*Swift) GetIncBackupsFromDump ¶
GetIncBackupsFromDump implements interface
func (*Swift) GetStatusError ¶
GetStatusError implements interface
func (*Swift) GetStatusErrorByKey ¶
GetStatusErrorByKey implements interface
func (*Swift) GetStorageServiceName ¶
GetStorageServiceName implements interface
func (*Swift) GetTotalIncBackupsFromDump ¶
GetTotalIncBackupsFromDump implements interface
func (*Swift) WriteFolder ¶
WriteFolder implements interface