Documentation ¶
Index ¶
- func ComputeMongoStartTimeout(backupUncompressedSize int64) time.Duration
- func EnsureCompatibilityToRestoreMongodVersions(backupMongodVersion, restoreMongodVersion string) error
- func GenerateNewBackupName() string
- func MajorMinorVersion(version string) string
- func MajorVersion(version string) string
- func NextMajorVersion(version string) string
- type BackupCursor
- func (backupCursor *BackupCursor) Close()
- func (backupCursor *BackupCursor) LoadBackupCursorFiles() (backupFiles []*BackupFileMeta, err error)
- func (backupCursor *BackupCursor) LoadExtendedBackupCursorFiles() (backupFiles []*BackupFileMeta, err error)
- func (backupCursor *BackupCursor) StartKeepAlive()
- type BackupCursorFile
- type BackupCursorMeta
- type BackupCursorOplogTS
- type BackupFileMeta
- func (backupFileMeta *BackupFileMeta) IsDir() bool
- func (backupFileMeta *BackupFileMeta) ModTime() time.Time
- func (backupFileMeta *BackupFileMeta) Mode() os.FileMode
- func (backupFileMeta *BackupFileMeta) Name() string
- func (backupFileMeta *BackupFileMeta) Size() int64
- func (backupFileMeta *BackupFileMeta) Sys() any
- type BackupService
- func (backupService *BackupService) DoBackup(backupName string, permanent bool) error
- func (backupService *BackupService) Finalize(uploader *ConcurrentUploader, backupCursorMeta *BackupCursorMeta) error
- func (backupService *BackupService) InitializeMongodBackupMeta(backupName string, permanent bool) error
- type ConcurrentDownloader
- type ConcurrentUploader
- type LocalStorage
- type MongodConfig
- type MongodFileConfig
- type MongodProcess
- type MongodService
- func (mongodService *MongodService) FixSystemDataAfterRestore(rsConfig RsConfig) error
- func (mongodService *MongodService) GetBackupCursor() (cursor *mongo.Cursor, err error)
- func (mongodService *MongodService) GetBackupCursorExtended(backupCursorMeta *BackupCursorMeta) (*mongo.Cursor, error)
- func (mongodService *MongodService) GetReplSetName() (string, error)
- func (mongodService *MongodService) MongodConfig() (*MongodConfig, error)
- func (mongodService *MongodService) MongodVersion() (string, error)
- func (mongodService *MongodService) Shutdown() error
- type RestoreService
- type RsConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComputeMongoStartTimeout ¶
ComputeMongoStartTimeout compute timeout with formula max(10min, UncompressedSizeTb * 40min)
func GenerateNewBackupName ¶
func GenerateNewBackupName() string
func MajorMinorVersion ¶
MajorMinorVersion return version in format '<MajorVersion>.<MinorVersion>' (without patch, prerelease, build, ...)
func MajorVersion ¶
MajorVersion return version in format '<MajorVersion>' (without minor, patch, prerelease, build, ...)
func NextMajorVersion ¶
NextMajorVersion return next major version in format '<MajorVersion> + 1' (without minor, patch, prerelease, build, ...)
Types ¶
type BackupCursor ¶
type BackupCursor struct { *mongo.Cursor BackupCursorMeta *BackupCursorMeta // contains filtered or unexported fields }
func CreateBackupCursor ¶
func CreateBackupCursor(mongodService *MongodService) (*BackupCursor, error)
func (*BackupCursor) Close ¶
func (backupCursor *BackupCursor) Close()
func (*BackupCursor) LoadBackupCursorFiles ¶
func (backupCursor *BackupCursor) LoadBackupCursorFiles() (backupFiles []*BackupFileMeta, err error)
func (*BackupCursor) LoadExtendedBackupCursorFiles ¶
func (backupCursor *BackupCursor) LoadExtendedBackupCursorFiles() (backupFiles []*BackupFileMeta, err error)
func (*BackupCursor) StartKeepAlive ¶
func (backupCursor *BackupCursor) StartKeepAlive()
type BackupCursorFile ¶
type BackupCursorMeta ¶
type BackupCursorMeta struct { ID primitive.Binary `bson:"backupId"` DBPath string `bson:"dbpath"` OplogStart BackupCursorOplogTS `bson:"oplogStart"` OplogEnd BackupCursorOplogTS `bson:"oplogEnd"` CheckpointTS primitive.Timestamp `bson:"checkpointTimestamp"` DisableIncrementalBackup bool `bson:"disableIncrementalBackup"` IncrementalBackup bool `bson:"incrementalBackup"` BlockSize int64 `bson:"blockSize"` }
type BackupCursorOplogTS ¶
type BackupFileMeta ¶
func (*BackupFileMeta) IsDir ¶
func (backupFileMeta *BackupFileMeta) IsDir() bool
func (*BackupFileMeta) ModTime ¶
func (backupFileMeta *BackupFileMeta) ModTime() time.Time
func (*BackupFileMeta) Mode ¶
func (backupFileMeta *BackupFileMeta) Mode() os.FileMode
func (*BackupFileMeta) Name ¶
func (backupFileMeta *BackupFileMeta) Name() string
func (*BackupFileMeta) Size ¶
func (backupFileMeta *BackupFileMeta) Size() int64
func (*BackupFileMeta) Sys ¶
func (backupFileMeta *BackupFileMeta) Sys() any
type BackupService ¶
type BackupService struct { Context context.Context MongodService *MongodService Uploader *internal.Uploader Sentinel models.Backup }
func CreateBackupService ¶
func CreateBackupService(ctx context.Context, mongodService *MongodService, uploader *internal.Uploader, ) (*BackupService, error)
func (*BackupService) DoBackup ¶
func (backupService *BackupService) DoBackup(backupName string, permanent bool) error
func (*BackupService) Finalize ¶
func (backupService *BackupService) Finalize(uploader *ConcurrentUploader, backupCursorMeta *BackupCursorMeta) error
func (*BackupService) InitializeMongodBackupMeta ¶
func (backupService *BackupService) InitializeMongodBackupMeta(backupName string, permanent bool) error
type ConcurrentDownloader ¶
type ConcurrentDownloader struct {
// contains filtered or unexported fields
}
func CreateConcurrentDownloader ¶
func CreateConcurrentDownloader(uploader *internal.Uploader) *ConcurrentDownloader
func (*ConcurrentDownloader) Download ¶
func (downloader *ConcurrentDownloader) Download(backupName, localDirectory string) error
type ConcurrentUploader ¶
type ConcurrentUploader struct { UncompressedSize int64 CompressedSize int64 // contains filtered or unexported fields }
func CreateConcurrentUploader ¶
func CreateConcurrentUploader(uploader *internal.Uploader, backupName, directory string) (*ConcurrentUploader, error)
func (*ConcurrentUploader) Finalize ¶
func (concurrentUploader *ConcurrentUploader) Finalize() error
func (*ConcurrentUploader) Upload ¶
func (concurrentUploader *ConcurrentUploader) Upload(backupFile *BackupFileMeta) error
func (*ConcurrentUploader) UploadBackupFiles ¶
func (concurrentUploader *ConcurrentUploader) UploadBackupFiles(backupFiles []*BackupFileMeta) error
type LocalStorage ¶
type LocalStorage struct {
MongodDBPath string
}
func CreateLocalStorage ¶
func CreateLocalStorage(mongodDBPath string) *LocalStorage
func (*LocalStorage) CleanupMongodDBPath ¶
func (localStorage *LocalStorage) CleanupMongodDBPath() error
func (*LocalStorage) EnsureEmptyDBPath ¶
func (localStorage *LocalStorage) EnsureEmptyDBPath() error
func (*LocalStorage) EnsureMongodFsLockFileIsEmpty ¶
func (localStorage *LocalStorage) EnsureMongodFsLockFileIsEmpty() error
type MongodConfig ¶
type MongodFileConfig ¶
type MongodFileConfig struct {
// contains filtered or unexported fields
}
func CreateMongodConfig ¶
func CreateMongodConfig(path string) (*MongodFileConfig, error)
func (*MongodFileConfig) Get ¶
func (mongodFileConfig *MongodFileConfig) Get(key string) any
func (*MongodFileConfig) GetDBPath ¶
func (mongodFileConfig *MongodFileConfig) GetDBPath() string
func (*MongodFileConfig) SaveConfigToTempFile ¶
func (mongodFileConfig *MongodFileConfig) SaveConfigToTempFile(keys ...string) (string, error)
type MongodProcess ¶
type MongodProcess struct {
// contains filtered or unexported fields
}
func StartMongo ¶
func StartMongo(minimalConfigPath string, parameters ...string) (*MongodProcess, error)
func StartMongodWithDisableLogicalSessionCacheRefresh ¶
func StartMongodWithDisableLogicalSessionCacheRefresh(minimalConfigPath string) (*MongodProcess, error)
func StartMongodWithRecoverFromOplogAsStandalone ¶
func StartMongodWithRecoverFromOplogAsStandalone(minimalConfigPath string) (*MongodProcess, error)
func (*MongodProcess) Close ¶
func (mongodProcess *MongodProcess) Close()
func (*MongodProcess) GetHostWithPort ¶
func (mongodProcess *MongodProcess) GetHostWithPort() string
func (*MongodProcess) GetURI ¶
func (mongodProcess *MongodProcess) GetURI() string
func (*MongodProcess) Wait ¶
func (mongodProcess *MongodProcess) Wait() error
type MongodService ¶
func CreateMongodService ¶
func (*MongodService) FixSystemDataAfterRestore ¶
func (mongodService *MongodService) FixSystemDataAfterRestore(rsConfig RsConfig) error
func (*MongodService) GetBackupCursor ¶
func (mongodService *MongodService) GetBackupCursor() (cursor *mongo.Cursor, err error)
func (*MongodService) GetBackupCursorExtended ¶
func (mongodService *MongodService) GetBackupCursorExtended(backupCursorMeta *BackupCursorMeta) (*mongo.Cursor, error)
func (*MongodService) GetReplSetName ¶
func (mongodService *MongodService) GetReplSetName() (string, error)
func (*MongodService) MongodConfig ¶
func (mongodService *MongodService) MongodConfig() (*MongodConfig, error)
func (*MongodService) MongodVersion ¶
func (mongodService *MongodService) MongodVersion() (string, error)
func (*MongodService) Shutdown ¶
func (mongodService *MongodService) Shutdown() error
type RestoreService ¶
type RestoreService struct { Context context.Context LocalStorage *LocalStorage Uploader *internal.Uploader // contains filtered or unexported fields }
func CreateRestoreService ¶
func CreateRestoreService(ctx context.Context, localStorage *LocalStorage, uploader *internal.Uploader, minimalConfigPath string) (*RestoreService, error)
Click to show internal directories.
Click to hide internal directories.