mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
f8de85ac42
It was deadlocking because we had a transaction inside another transaction. To stop this we can pass in the parent transaction when setting or removing bundles, as well as generating PreKeyBundle from the proto message.
45 lines
1.7 KiB
Objective-C
45 lines
1.7 KiB
Objective-C
//
|
|
// Copyright (c) 2019 Open Whisper Systems. All rights reserved.
|
|
//
|
|
|
|
#import <YapDatabase/YapDatabaseTransaction.h>
|
|
|
|
@class ECKeyPair;
|
|
@class PreKeyRecord;
|
|
@class PreKeyBundle;
|
|
@class SignedPreKeyRecord;
|
|
|
|
NS_ASSUME_NONNULL_BEGIN
|
|
|
|
@interface YapDatabaseReadTransaction (OWS)
|
|
|
|
- (BOOL)boolForKey:(NSString *)key inCollection:(NSString *)collection defaultValue:(BOOL)defaultValue;
|
|
- (int)intForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
- (nullable NSDate *)dateForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
- (nullable NSDictionary *)dictionaryForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
- (nullable NSString *)stringForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
- (nullable NSData *)dataForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
- (nullable ECKeyPair *)keyPairForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
- (nullable PreKeyRecord *)preKeyRecordForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
- (nullable PreKeyBundle *)preKeyBundleForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
- (nullable SignedPreKeyRecord *)signedPreKeyRecordForKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
@end
|
|
|
|
#pragma mark -
|
|
|
|
@interface YapDatabaseReadWriteTransaction (OWS)
|
|
|
|
#pragma mark - Debug
|
|
|
|
#if DEBUG
|
|
- (void)snapshotCollection:(NSString *)collection snapshotFilePath:(NSString *)snapshotFilePath;
|
|
- (void)restoreSnapshotOfCollection:(NSString *)collection snapshotFilePath:(NSString *)snapshotFilePath;
|
|
#endif
|
|
|
|
- (void)setBool:(BOOL)value forKey:(NSString *)key inCollection:(NSString *)collection;
|
|
- (void)setDate:(NSDate *)value forKey:(NSString *)key inCollection:(NSString *)collection;
|
|
|
|
@end
|
|
|
|
NS_ASSUME_NONNULL_END
|