forked from iabudiab/ObjectiveRocks
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRocksDBBackupEngine.h
95 lines (72 loc) · 3.29 KB
/
RocksDBBackupEngine.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
//
// RocksDBBackupEngine.h
// ObjectiveRocks
//
// Created by Iska on 28/12/14.
// Copyright (c) 2014 BrainCookie. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "RocksDB.h"
@class RocksDBBackupInfo;
NS_ASSUME_NONNULL_BEGIN
/**
The `RocksDBBackupEngine` provides backup and restore functionality for RocksDB. Backups are incremental and
each backup receives an ID, which can be used to restore that specific backup. Backups can also be deleted to
reduce the total size and reduce restoration times.
*/
@interface RocksDBBackupEngine : NSObject
/**
Initializes a new Backup Enginge with the given path as a destination directory.
@param path The destination path for the new Backup Engine.
@return The newly-created Backup Engine with the given destination path.
*/
- (instancetype)initWithPath:(NSString *)path;
/**
Creates a new backup of the given database instance.
@param database The database instance for which a backup is to be created.
@param error If an error occurs, upon return contains an `NSError` object that describes the problem.
@return `YES` if the backup succeeded, `NO` otherwise.
*/
- (BOOL)createBackupForDatabase:(RocksDB *)database error:(NSError * _Nullable *)error;
/**
Restores the latest backup of this Backup Engine to the given destination path.
@param destination The destination path where the last backup is to be restored to.
@param error If an error occurs, upon return contains an `NSError` object that describes the problem.
@return `YES` if the restore succeeded, `NO` otherwise.
*/
- (BOOL)restoreBackupToDestinationPath:(NSString *)destination error:(NSError * _Nullable *)error;
/**
Restores the backup with the given ID in this Backup Engine to the given destination path.
@param backupId The backup ID to restore.
@param destination The destination path where the last backup is to be restored to.
@param error If an error occurs, upon return contains an `NSError` object that describes the problem.
@return `YES` if the restore succeeded, `NO` otherwise.
*/
- (BOOL)restoreBackupWithId:(uint32_t)backupId toDestinationPath:(NSString *)destination error:(NSError * _Nullable *)error;
/**
Deleted all backups from this Backup Engine keeping the last N backups.
@param countBackups The count of backaups to keep in this Backup Engine.
@param error If an error occurs, upon return contains an `NSError` object that describes the problem.
@return `YES` if the purge succeeded, `NO` otherwise.
*/
- (BOOL)purgeOldBackupsKeepingLast:(uint32_t)countBackups error:(NSError * _Nullable *)error;
/**
Deletes a specific backup from this Backup Engine.
@param backupId The ID of the backaup to delete from this Backup Engine.
@param error If an error occurs, upon return contains an `NSError` object that describes the problem.
@return `YES` if the delete succeeded, `NO` otherwise.
*/
- (BOOL)deleteBackupWithId:(uint32_t)backupId error:(NSError * _Nullable *)error;
/**
Returns a list of backups in this Backup Engine together with information on timestamp of the backups
and their sizes.
@return An array containing `RocksDBBackupInfo` objects with informations about the backups.
@see RocksDBBackupInfo
*/
- (NSArray<RocksDBBackupInfo *> *)backupInfo;
/**
@brief Closes this Backup Engine instance.
*/
- (void)close;
@end
NS_ASSUME_NONNULL_END