Documentation ¶
Index ¶
- func BackupNamesFromBackupTimes(backups []internal.BackupTime) []string
- func BackupNamesFromBackups(backups []*models.Backup) []string
- func LastKnownInBackupTS(backups []*models.Backup) (models.Timestamp, error)
- func MongoModelToTimedBackup(backups []*models.Backup) []internal.TimedBackup
- func NewBackupMongoMetaConstructor(ctx context.Context, mc client.MongoDriver, folder storage.Folder, ...) internal.MetaConstructor
- func OldestBackupAfterTime(backups []*models.Backup, after time.Time) (*models.Backup, error)
- func SelectPurgingOplogArchives(archives []models.Archive, backups []*models.Backup, ...) []models.Archive
- func SplitMongoBackups(backups []*models.Backup, purgeBackups, retainBackups map[string]bool) (purge, retain []*models.Backup)
- func SplitPurgingOplogArchivesByTS(archives []models.Archive, purgeBeforeTS models.Timestamp) []models.Archive
- type DiscardUploader
- type Downloader
- type MongoMetaConstructor
- type Purger
- type Sequence
- type StorageDownloader
- func (sd *StorageDownloader) BackupMeta(name string) (*models.Backup, error)
- func (sd *StorageDownloader) DownloadOplogArchive(arch models.Archive, writeCloser io.WriteCloser) error
- func (sd *StorageDownloader) LastBackupName() (string, error)
- func (sd *StorageDownloader) LastKnownArchiveTS() (models.Timestamp, error)
- func (sd *StorageDownloader) ListBackups() ([]internal.BackupTime, []string, error)
- func (sd *StorageDownloader) ListOplogArchives() ([]models.Archive, error)
- func (sd *StorageDownloader) LoadBackups(names []string) ([]*models.Backup, error)
- type StoragePurger
- type StorageSettings
- type StorageUploader
- type Uploader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackupNamesFromBackupTimes ¶
func BackupNamesFromBackupTimes(backups []internal.BackupTime) []string
BackupNamesFromBackupTimes forms list of backup names from BackupTime
func BackupNamesFromBackups ¶
BackupNamesFromBackups forms list of backup names from Backups
func LastKnownInBackupTS ¶
LastKnownInBackupTS returns begin_ts of oldest backup
func MongoModelToTimedBackup ¶
func MongoModelToTimedBackup(backups []*models.Backup) []internal.TimedBackup
func NewBackupMongoMetaConstructor ¶
func NewBackupMongoMetaConstructor(ctx context.Context, mc client.MongoDriver, folder storage.Folder, permanent bool) internal.MetaConstructor
func OldestBackupAfterTime ¶
OldestBackupAfterTime returns last backup after given time.
func SelectPurgingOplogArchives ¶
func SelectPurgingOplogArchives(archives []models.Archive, backups []*models.Backup, retainAfterTS *models.Timestamp) []models.Archive
SelectPurgingOplogArchives builds archive list to be deleted.
func SplitMongoBackups ¶
Types ¶
type DiscardUploader ¶
type DiscardUploader struct {
// contains filtered or unexported fields
}
DiscardUploader reads provided data and returns success
func NewDiscardUploader ¶
func NewDiscardUploader(compressor compression.Compressor, readerFrom io.ReaderFrom) *DiscardUploader
NewDiscardUploader builds DiscardUploader.
func (*DiscardUploader) UploadBackup ¶
func (d *DiscardUploader) UploadBackup(stream io.Reader, cmd internal.ErrWaiter, metaConstructor internal.MetaConstructor) error
UploadBackup is not implemented yet
func (*DiscardUploader) UploadGapArchive ¶
func (d *DiscardUploader) UploadGapArchive(err error, firstTS, lastTS models.Timestamp) error
UploadGapArchive returns nil error
func (*DiscardUploader) UploadOplogArchive ¶
func (d *DiscardUploader) UploadOplogArchive(archReader io.Reader, firstTS, lastTS models.Timestamp) error
UploadOplogArchive reads all data into memory, stream is compressed and encrypted if required
type Downloader ¶
type Downloader interface { BackupMeta(name string) (*models.Backup, error) DownloadOplogArchive(arch models.Archive, writeCloser io.WriteCloser) error ListOplogArchives() ([]models.Archive, error) LoadBackups(names []string) ([]*models.Backup, error) ListBackups() ([]internal.BackupTime, []string, error) LastKnownArchiveTS() (models.Timestamp, error) }
Downloader defines interface to fetch mongodb oplog archives
type MongoMetaConstructor ¶
type MongoMetaConstructor struct {
// contains filtered or unexported fields
}
func (*MongoMetaConstructor) Finalize ¶
func (m *MongoMetaConstructor) Finalize(backupName string) error
func (*MongoMetaConstructor) Init ¶
func (m *MongoMetaConstructor) Init() error
func (*MongoMetaConstructor) Meta ¶
func (m *MongoMetaConstructor) Meta() models.BackupMeta
func (*MongoMetaConstructor) MetaInfo ¶
func (m *MongoMetaConstructor) MetaInfo() interface{}
type Sequence ¶
Sequence represents serial archive route
func SequenceBetweenTS ¶
SequenceBetweenTS builds archive order between since and until timestamps archives can be written since multiple nodes and overlap each over, some timestamps may be lost, we should detect these cases
type StorageDownloader ¶
type StorageDownloader struct {
// contains filtered or unexported fields
}
StorageDownloader extends base folder with mongodb specific.
func NewStorageDownloader ¶
func NewStorageDownloader(opts StorageSettings) (*StorageDownloader, error)
NewStorageDownloader builds mongodb downloader.
func (*StorageDownloader) BackupMeta ¶
func (sd *StorageDownloader) BackupMeta(name string) (*models.Backup, error)
BackupMeta downloads sentinel contents.
func (*StorageDownloader) DownloadOplogArchive ¶
func (sd *StorageDownloader) DownloadOplogArchive(arch models.Archive, writeCloser io.WriteCloser) error
DownloadOplogArchive downloads, decompresses and decrypts (if needed) oplog archive.
func (*StorageDownloader) LastBackupName ¶
func (sd *StorageDownloader) LastBackupName() (string, error)
LastBackupName get last backup
func (*StorageDownloader) LastKnownArchiveTS ¶
func (sd *StorageDownloader) LastKnownArchiveTS() (models.Timestamp, error)
LastKnownArchiveTS returns the most recent existed timestamp in storage folder.
func (*StorageDownloader) ListBackups ¶
func (sd *StorageDownloader) ListBackups() ([]internal.BackupTime, []string, error)
ListBackups lists backups in folder
func (*StorageDownloader) ListOplogArchives ¶
func (sd *StorageDownloader) ListOplogArchives() ([]models.Archive, error)
ListOplogArchives fetches all oplog archives existed in storage.
func (*StorageDownloader) LoadBackups ¶
func (sd *StorageDownloader) LoadBackups(names []string) ([]*models.Backup, error)
LoadBackups downloads backups metadata
type StoragePurger ¶
type StoragePurger struct {
// contains filtered or unexported fields
}
StoragePurger deletes files in storage.
func NewStoragePurger ¶
func NewStoragePurger(opts StorageSettings) (*StoragePurger, error)
NewStoragePurger builds mongodb StoragePurger.
func (*StoragePurger) DeleteBackups ¶
func (sp *StoragePurger) DeleteBackups(backups []*models.Backup) error
DeleteBackups purges given backups files TODO: extract BackupLayout abstraction and provide DataPath(), SentinelPath(), Exists() methods
func (*StoragePurger) DeleteGarbage ¶
func (sp *StoragePurger) DeleteGarbage(garbage []string) error
DeleteGarbage purges given garbage keys
func (*StoragePurger) DeleteOplogArchives ¶
func (sp *StoragePurger) DeleteOplogArchives(archives []models.Archive) error
DeleteOplogArchives purges given oplogs files
type StorageSettings ¶
type StorageSettings struct {
// contains filtered or unexported fields
}
StorageSettings defines storage relative paths
func NewDefaultStorageSettings ¶
func NewDefaultStorageSettings() StorageSettings
NewDefaultStorageSettings builds default storage settings struct
type StorageUploader ¶
StorageUploader extends base uploader with mongodb specific. is NOT thread-safe
func NewStorageUploader ¶
func NewStorageUploader(upl internal.Uploader) *StorageUploader
NewStorageUploader builds mongodb uploader.
func (*StorageUploader) UploadBackup ¶
func (su *StorageUploader) UploadBackup(stream io.Reader, cmd internal.ErrWaiter, metaConstructor internal.MetaConstructor) error
UploadBackup compresses a stream and uploads it.
func (*StorageUploader) UploadGapArchive ¶
func (su *StorageUploader) UploadGapArchive(archErr error, firstTS, lastTS models.Timestamp) error
UploadGap uploads mark indicating archiving gap.
func (*StorageUploader) UploadOplogArchive ¶
func (su *StorageUploader) UploadOplogArchive(stream io.Reader, firstTS, lastTS models.Timestamp) error
UploadOplogArchive compresses a stream and uploads it with given archive name.
type Uploader ¶
type Uploader interface { UploadOplogArchive(stream io.Reader, firstTS, lastTS models.Timestamp) error // TODO: rename firstTS UploadGapArchive(err error, firstTS, lastTS models.Timestamp) error UploadBackup(stream io.Reader, cmd internal.ErrWaiter, metaConstructor internal.MetaConstructor) error }
Uploader defines interface to store mongodb backups and oplog archives