Migrate more key-value stores.

This commit is contained in:
Matthew Chen 2019-06-18 11:21:30 -04:00
parent 172b993508
commit ccf217bade
3 changed files with 9 additions and 8 deletions

View File

@ -43,7 +43,7 @@ $REPO_ROOT/Scripts/sds_codegen/sds_parse_objc.py --src-path Signal --swift-bridg
# We generate Swift extensions to handle serialization, etc. for models.
RECORD_TYPE_SWIFT="SignalServiceKit/src/Storage/Database/SDSRecordType.swift"
RECORD_TYPE_JSON="$REPO_ROOT/Scripts/sds_codegen/sds_config/sds_record_type_map.json"
CONFIG_JSON="$REPO_ROOT/Scripts/sds_codegen/sds-config/sds-config.json"
CONFIG_JSON="$REPO_ROOT/Scripts/sds_codegen/sds_config/sds-config.json"
$REPO_ROOT/Scripts/sds_codegen/sds_generate.py --src-path SignalServiceKit/ --search-path . --record-type-swift-path $RECORD_TYPE_SWIFT --record-type-json-path $RECORD_TYPE_JSON --config-json-path $CONFIG_JSON
$REPO_ROOT/Scripts/sds_codegen/sds_generate.py --src-path SignalShareExtension/ --search-path . --record-type-swift-path $RECORD_TYPE_SWIFT --record-type-json-path $RECORD_TYPE_JSON --config-json-path $CONFIG_JSON
$REPO_ROOT/Scripts/sds_codegen/sds_generate.py --src-path SignalMessaging/ --search-path . --record-type-swift-path $RECORD_TYPE_SWIFT --record-type-json-path $RECORD_TYPE_JSON --config-json-path $CONFIG_JSON

View File

@ -901,20 +901,21 @@ NSError *OWSBackupErrorWithDescription(NSString *description)
{
OWSLogInfo(@"");
[dbConnection readWithBlock:^(YapDatabaseReadTransaction *transaction) {
[transaction enumerateKeysAndObjectsInCollection:[OWSBackupFragment collection]
usingBlock:^(NSString *key, OWSBackupFragment *fragment, BOOL *stop) {
[self.databaseStorage readWithBlock:^(SDSAnyReadTransaction *transaction) {
[OWSBackupFragment anyVisitAllWithTransaction:transaction
visitor:^BOOL(OWSBackupFragment *fragment) {
OWSLogVerbose(@"fragment: %@, %@, %lu, %@, %@, %@, %@",
key,
fragment.uniqueId,
fragment.recordName,
(unsigned long)fragment.encryptionKey.length,
fragment.relativeFilePath,
fragment.attachmentId,
fragment.downloadFilePath,
fragment.uncompressedDataLength);
return YES;
}];
OWSLogVerbose(@"Number of fragments: %lu",
(unsigned long)[transaction numberOfKeysInCollection:[OWSBackupFragment collection]]);
OWSLogVerbose(
@"Number of fragments: %lu", (unsigned long)[OWSBackupFragment anyCountWithTransaction:transaction]);
}];
}

View File

@ -162,7 +162,7 @@ public extension SDSKeyValueStore {
}
@objc
public func removeValue(forKey: String) {
func removeValue(forKey key: String) {
return databaseStorage.write { (transaction) in
return self.removeValue(forKey: key, transaction: transaction)
}