Remove YDB usage.
This commit is contained in:
parent
08ae5c8ecc
commit
f4b8dc06d2
@ -263,45 +263,28 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
|
||||
(unsigned long)self.timestamp];
|
||||
}
|
||||
|
||||
// GRDB TODO: Remove.
|
||||
- (void)ydb_saveWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
[self ensureIdsWithTransaction:transaction];
|
||||
|
||||
[super ydb_saveWithTransaction:transaction];
|
||||
|
||||
[self updateLastMessageWithTransaction:transaction.asAnyWrite];
|
||||
}
|
||||
|
||||
// GRDB TODO: Remove.
|
||||
- (void)ydb_removeWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
[super ydb_removeWithTransaction:transaction];
|
||||
|
||||
[self touchThreadWithTransaction:transaction.asAnyWrite];
|
||||
}
|
||||
|
||||
#pragma mark - Any Transaction Hooks
|
||||
|
||||
- (void)anyWillInsertWithTransaction:(SDSAnyWriteTransaction *)transaction
|
||||
{
|
||||
// GRDB TODO: Remove this condition once we migrate interaction writes to use
|
||||
// any transactions. We just don't want to do this work twice.
|
||||
if (transaction.transitional_yapWriteTransaction != nil) {
|
||||
[self ensureIdsWithTransaction:transaction.transitional_yapWriteTransaction];
|
||||
}
|
||||
|
||||
[super anyWillInsertWithTransaction:transaction];
|
||||
|
||||
[self ensureIdsWithTransaction:transaction];
|
||||
}
|
||||
|
||||
- (void)ensureIdsWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
- (void)ensureIdsWithTransaction:(SDSAnyWriteTransaction *)transaction
|
||||
{
|
||||
if (transaction.transitional_yapWriteTransaction == nil) {
|
||||
return;
|
||||
}
|
||||
if (self.uniqueId.length < 1) {
|
||||
OWSFailDebug(@"Missing uniqueId.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.sortId == 0) {
|
||||
self.sortId = [SSKIncrementingIdFinder nextIdWithKey:[TSInteraction collection] transaction:transaction];
|
||||
self.sortId = [SSKIncrementingIdFinder nextIdWithKey:[TSInteraction collection]
|
||||
transaction:transaction.transitional_yapWriteTransaction];
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,26 +292,18 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
|
||||
{
|
||||
[super anyDidInsertWithTransaction:transaction];
|
||||
|
||||
// GRDB TODO: Remove this condition once we migrate interaction writes to use
|
||||
// any transactions. We just don't want to do this work twice.
|
||||
if (transaction.transitional_yapWriteTransaction == nil) {
|
||||
[self updateLastMessageWithTransaction:transaction];
|
||||
[self updateLastMessageWithTransaction:transaction];
|
||||
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
}
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
}
|
||||
|
||||
- (void)anyDidUpdateWithTransaction:(SDSAnyWriteTransaction *)transaction
|
||||
{
|
||||
[super anyDidUpdateWithTransaction:transaction];
|
||||
|
||||
// GRDB TODO: Remove this condition once we migrate interaction writes to use
|
||||
// any transactions. We just don't want to do this work twice.
|
||||
if (transaction.transitional_yapWriteTransaction == nil) {
|
||||
[self updateLastMessageWithTransaction:transaction];
|
||||
[self updateLastMessageWithTransaction:transaction];
|
||||
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
}
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
}
|
||||
|
||||
- (void)touchThreadWithTransaction:(SDSAnyWriteTransaction *)transaction
|
||||
@ -347,11 +322,7 @@ NSString *NSStringFromOWSInteractionType(OWSInteractionType value)
|
||||
{
|
||||
[super anyDidRemoveWithTransaction:transaction];
|
||||
|
||||
// GRDB TODO: Remove this condition once we migrate interaction writes to use
|
||||
// any transactions. We just don't want to do this work twice.
|
||||
if (transaction.transitional_yapWriteTransaction == nil) {
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
}
|
||||
[self touchThreadWithTransaction:transaction];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
@ -484,57 +484,33 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
|
||||
}
|
||||
}
|
||||
|
||||
// GRDB TODO: Convert to Any.
|
||||
- (void)ydb_saveWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
- (void)anyWillInsertWithTransaction:(SDSAnyWriteTransaction *)transaction
|
||||
{
|
||||
[super anyWillInsertWithTransaction:transaction];
|
||||
|
||||
// StickerManager does reference counting of "known" sticker packs.
|
||||
if (self.messageSticker != nil) {
|
||||
BOOL willInsert = (self.uniqueId.length < 1
|
||||
|| nil == [TSMessage anyFetchWithUniqueId:self.uniqueId transaction:transaction.asAnyWrite]);
|
||||
|| nil == [TSMessage anyFetchWithUniqueId:self.uniqueId transaction:transaction]);
|
||||
|
||||
if (willInsert) {
|
||||
[StickerManager addKnownStickerInfo:self.messageSticker.info transaction:transaction.asAnyWrite];
|
||||
[StickerManager addKnownStickerInfo:self.messageSticker.info transaction:transaction];
|
||||
}
|
||||
}
|
||||
|
||||
[super ydb_saveWithTransaction:transaction];
|
||||
}
|
||||
|
||||
// GRDB TODO: Convert to Any.
|
||||
- (void)ydb_removeWithTransaction:(YapDatabaseReadWriteTransaction *)transaction
|
||||
{
|
||||
// StickerManager does reference counting of "known" sticker packs.
|
||||
if (self.messageSticker != nil) {
|
||||
BOOL willDelete = (self.uniqueId.length > 0
|
||||
&& nil != [TSMessage anyFetchWithUniqueId:self.uniqueId transaction:transaction.asAnyWrite]);
|
||||
|
||||
// StickerManager does reference counting of "known" sticker packs.
|
||||
if (willDelete) {
|
||||
[StickerManager removeKnownStickerInfo:self.messageSticker.info transaction:transaction.asAnyWrite];
|
||||
}
|
||||
}
|
||||
|
||||
[super ydb_removeWithTransaction:transaction];
|
||||
|
||||
[self removeAllAttachmentsWithTransaction:transaction.asAnyWrite];
|
||||
}
|
||||
|
||||
- (void)anyWillRemoveWithTransaction:(SDSAnyWriteTransaction *)transaction
|
||||
{
|
||||
[super anyWillRemoveWithTransaction:transaction];
|
||||
|
||||
// GRDB TODO: Remove this condition once we migrate interaction writes to use
|
||||
// any transactions. We just don't want to do this work twice.
|
||||
if (transaction.transitional_yapWriteTransaction == nil) {
|
||||
// StickerManager does reference counting of "known" sticker packs.
|
||||
if (self.messageSticker != nil) {
|
||||
BOOL willDelete = (self.uniqueId.length > 0
|
||||
&& nil != [TSMessage anyFetchWithUniqueId:self.uniqueId transaction:transaction]);
|
||||
// StickerManager does reference counting of "known" sticker packs.
|
||||
if (self.messageSticker != nil) {
|
||||
BOOL willDelete = (self.uniqueId.length > 0
|
||||
&& nil != [TSMessage anyFetchWithUniqueId:self.uniqueId transaction:transaction]);
|
||||
|
||||
// StickerManager does reference counting of "known" sticker packs.
|
||||
if (willDelete) {
|
||||
[StickerManager removeKnownStickerInfo:self.messageSticker.info transaction:transaction];
|
||||
}
|
||||
// StickerManager does reference counting of "known" sticker packs.
|
||||
if (willDelete) {
|
||||
[StickerManager removeKnownStickerInfo:self.messageSticker.info transaction:transaction];
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -543,11 +519,7 @@ static const NSUInteger OWSMessageSchemaVersion = 4;
|
||||
{
|
||||
[super anyDidRemoveWithTransaction:transaction];
|
||||
|
||||
// GRDB TODO: Remove this condition once we migrate interaction writes to use
|
||||
// any transactions. We just don't want to do this work twice.
|
||||
if (transaction.transitional_yapWriteTransaction == nil) {
|
||||
[self removeAllAttachmentsWithTransaction:transaction];
|
||||
}
|
||||
[self removeAllAttachmentsWithTransaction:transaction];
|
||||
}
|
||||
|
||||
- (void)removeAllAttachmentsWithTransaction:(SDSAnyWriteTransaction *)transaction
|
||||
|
||||
Loading…
Reference in New Issue
Block a user