aboutsummaryrefslogtreecommitdiffhomepage
path: root/Firestore/Source/Local/FSTLevelDB.mm
diff options
context:
space:
mode:
Diffstat (limited to 'Firestore/Source/Local/FSTLevelDB.mm')
-rw-r--r--Firestore/Source/Local/FSTLevelDB.mm13
1 files changed, 12 insertions, 1 deletions
diff --git a/Firestore/Source/Local/FSTLevelDB.mm b/Firestore/Source/Local/FSTLevelDB.mm
index 83b932c..d163ed5 100644
--- a/Firestore/Source/Local/FSTLevelDB.mm
+++ b/Firestore/Source/Local/FSTLevelDB.mm
@@ -20,6 +20,7 @@
#import "FIRFirestoreErrors.h"
#import "Firestore/Source/Core/FSTDatabaseInfo.h"
+#import "Firestore/Source/Local/FSTLevelDBMigrations.h"
#import "Firestore/Source/Local/FSTLevelDBMutationQueue.h"
#import "Firestore/Source/Local/FSTLevelDBQueryCache.h"
#import "Firestore/Source/Local/FSTLevelDBRemoteDocumentCache.h"
@@ -36,6 +37,7 @@ static NSString *const kReservedPathComponent = @"firestore";
using leveldb::DB;
using leveldb::Options;
+using leveldb::ReadOptions;
using leveldb::Status;
using leveldb::WriteOptions;
@@ -50,6 +52,15 @@ using leveldb::WriteOptions;
@implementation FSTLevelDB
+/**
+ * For now this is paranoid, but perhaps disable that in production builds.
+ */
++ (const ReadOptions)standardReadOptions {
+ ReadOptions options;
+ options.verify_checksums = true;
+ return options;
+}
+
- (instancetype)initWithDirectory:(NSString *)directory
serializer:(FSTLocalSerializer *)serializer {
if (self = [super init]) {
@@ -115,8 +126,8 @@ using leveldb::WriteOptions;
if (!database) {
return NO;
}
-
_ptr.reset(database);
+ [FSTLevelDBMigrations runMigrationsOnDB:_ptr];
return YES;
}