Compare commits

..

62 Commits

Author SHA1 Message Date
Robbie Hanson
772efef2ed Incrementing podspec version. 2018-07-22 12:59:03 -04:00
Robbie Hanson
e8c4021aa1
Merge pull request #458 from wjmelements/ydcu-import-foundation
Add missing foundation import
2018-07-12 12:00:58 -04:00
William Morriss
5fa11c84d3 <> 2018-07-04 02:21:55 -07:00
William Morriss
190cbb6c98 add foundation import 2018-07-03 14:42:09 -07:00
Robbie Hanson
31475d08ff Bug fix for previous commit. 2018-06-28 16:05:50 -04:00
Robbie Hanson
81c2f830d4 Adding new insertedKeys set to YapDatabaseModifiedNotification. 2018-06-28 12:36:44 -04:00
Robbie Hanson
a2fa29e545 Merge branch 'master' of https://github.com/yapstudios/YapDatabase 2018-06-20 15:18:31 -04:00
Robbie Hanson
4e59aff974 Adding convenience method to detect when all previous asyncRegisterExtension requests have completed. 2018-06-20 15:18:25 -04:00
Robbie Hanson
cf9692ebea
Update README.md 2018-06-15 09:54:51 -04:00
Robbie Hanson
7e0919da7c Incrementing podspec version. 2018-06-14 22:18:28 -04:00
Robbie Hanson
fcfda4e5f0 Improving documentation in ConnectionProxy, and adding another reset-like method. 2018-05-23 19:09:49 -04:00
Robbie Hanson
5f480844db Fixing more compiler warnings for issue #444 2018-05-23 19:07:34 -04:00
Robbie Hanson
b5c42db8c6 Minor changes recommended by analyzer. 2018-05-23 17:31:07 -04:00
Robbie Hanson
ca0cb15154 Fix for issue #444 - Compiler warnings in Xcode 9 2018-05-23 17:30:28 -04:00
Robbie Hanson
5d3ea2e97b Adding NS_ASSUME_NONNULL header/footer to YapManyToManyCache.h, and fixing some nullability annotations. Also removing the nullability annotations from private header files, as the compiler throws a fit about all the other missing annotations within the file. (And because the private header files are only used by Obj-C.) 2018-04-05 10:17:37 -07:00
Denis Zubkov
4a207244ae Added __nullable to metadata in headers to make sure Swift 4.1 doesn't throw EXC_BAD_ACCESS 2018-04-05 15:25:14 +10:00
Robbie Hanson
cc678addef Updating YDBRelationship delete rules for files, to match recent changes for delete rules for nodes. Addresses issue #148 2018-04-04 10:56:58 -07:00
Robbie Hanson
88adbb028f
Merge pull request #447 from EnvionSoftwareMobile/master
Edges processing updated to fix #148
2018-04-03 18:20:52 -07:00
Artem Kirienko
66568fedc2 CocoaLumberjack pod updated 2018-03-28 21:41:17 +03:00
Artem Kirienko
fc3b157c0e Travis CI config updated 2018-03-28 21:37:16 +03:00
Artem Kirienko
9bf0ddf311 Edges processing updated to fix #148
Edge count query doesn't include edge name anymore.
2018-03-28 20:08:42 +03:00
Robbie Hanson
2947fda783 Potential bug fix for issues #437 and #441 2018-03-27 11:18:11 -07:00
Robbie Hanson
5b3f5030e7 Adding hook to additionally configure newly created connections in a connection pool. This is useful for configuring things such as permittedTransactions. 2018-03-19 15:00:56 -06:00
Robbie Hanson
b9d9fe42f6 Adding ConnectionPool to CocoaPods & Carthage. 2018-03-19 14:01:44 -06:00
Robbie Hanson
e26639737d New utility class: YapDatabaseConnectionPool. A simple load balancer designed for background (non-main-thread) tasks that perform read-only transactions. 2018-03-19 13:30:56 -06:00
Robbie Hanson
e59d5fb5f9 Adding new property on YapDatabaseConnection: pendingTransactionCount 2018-03-19 12:02:11 -06:00
Robbie Hanson
27b32aa3ea Minor optimization - check completionBlock for NULL once, instead of twice. 2018-03-19 12:00:12 -06:00
Robbie Hanson
30b053c000 Explicitly marking dynamic properties dynamic. This makes it easier to find spelling mistakes in function names. 2018-03-19 11:57:56 -06:00
Robbie Hanson
114d371b7a Adding ability to create a databaseConnection with a pre-configured set of configuration options. 2018-03-19 11:56:41 -06:00
Robbie Hanson
102a3436b9 Deprecating the defaultX properties in YapDatabase, in favor of the new(ish) YapDatabaseConnectionConfig class. 2018-03-18 13:41:13 -06:00
Robbie Hanson
05a3bbf01d Updating unit test project via 'pod install'. 2018-03-18 12:44:31 -06:00
Robbie Hanson
5969174262 Updating macOS deployment target from 10.9 to 10.10. The primary motivation for this is to silence the hundreds of compiler warnings about CloudKit not being available in 10.9. 2018-03-18 12:43:42 -06:00
Robbie Hanson
5df37ee440 Fixing compiler warning & bug in YDBCloudCore. 2018-03-18 12:28:46 -06:00
Robbie Hanson
ec857d7021
Merge pull request #439 from signalapp/charlesmchen/unencryptedHeaders
Charlesmchen/unencrypted headers
2018-03-18 12:18:59 -06:00
Robbie Hanson
d07f12b50d
Merge pull request #443 from mathieualvado/fix_nullability_annotations
Fix missing nullability annotation in backup methods
2018-03-15 14:07:56 -06:00
Mathieu Alvado
3174f45e67 Fix missing nullability annotation in backup methods
Missing annotations were causing a crash in Swift when accessing error argument.
2018-03-09 01:17:13 -05:00
Robbie Hanson
9f97fed893 Bug fix: enumeration code was skipping inserted operations in the last commit. 2018-03-08 15:38:10 -07:00
Robbie Hanson
f91e7a191e Adding a few convenience methods to YapDatabaseCloudCoreTransaction. 2018-03-08 15:35:51 -07:00
Robbie Hanson
a19f0d29e4 Fixing a crash that was described in issue #399 but this time with protocolEdges instead of manualEdges. Added corresponding unit test as well. 2018-03-08 15:32:14 -07:00
Robbie Hanson
9ac1bce51a
Merge pull request #440 from rupertdaniel/fts-add-transaction-to-handler-block
Fts add transaction to handler blocks
2018-03-08 17:43:55 -03:00
Robbie Hanson
15c3145e21
Merge pull request #442 from marcpalmer/marcpalmer-patch-1
Fix for _enumerateRowidsForKeys only working for 1 key
2018-03-08 17:38:16 -03:00
Marc Palmer
d9199ca084
Fix for _enumerateRowidsForKeys only working for 1 key
If the fast path for 1 key lookup is not taken because there are > 1 keys, the `keyIndexDict` is never allocated a value due to a logic bug. Objective-C then conspired to hide this problem from us thanks to messaging of nil.
2018-03-08 14:45:54 +00:00
Matthew Chen
373f0d4de7 Clean up ahead of PR. 2018-01-25 10:56:59 -05:00
Matthew Chen
3ed77a8f38 Clean up ahead of PR. 2018-01-25 10:43:33 -05:00
Matthew Chen
fcc56870be Clean up ahead of PR. 2018-01-25 10:22:08 -05:00
Matthew Chen
a57b0c1adb Add database conversion class. 2018-01-24 17:10:59 -05:00
Matthew Chen
40ab4d2fe2 Add support for key specs. 2018-01-24 16:05:18 -05:00
Matthew Chen
302a1c86e4 Fix tests broken on device. 2018-01-24 10:00:42 -05:00
Rupert Daniel
db05d876f7 Updated FTS unit tests. 2018-01-24 11:29:57 +00:00
Rupert Daniel
1aac5034f8 Pass the database transaction as a parameter to FTS extension handler
blocks.
2018-01-24 11:21:45 +00:00
Matthew Chen
9ef73cbc91 Clean up ahead of PR. 2018-01-23 17:11:40 -05:00
Matthew Chen
27019b5260 Clean up ahead of PR. 2018-01-23 16:57:10 -05:00
Matthew Chen
91cb9f50c1 Modify YapDatabase to read converted database. 2018-01-23 16:40:35 -05:00
Matthew Chen
3941d566a6 Modify YapDatabase to read converted database. 2018-01-23 09:49:16 -05:00
Matthew Chen
72e05df4cd Support unencrypted headers and manual salts. 2018-01-19 18:15:55 -05:00
Robbie Hanson
6dce343afb Bug fix for issue #433 - Initialisers are marked non-nullable in header, but can return nil 2018-01-02 13:10:47 -05:00
Robbie Hanson
65cb53830f Bug fix for issue #437 - Possible deadlock in [YapDatabaseConnection dealloc] 2018-01-02 12:57:50 -05:00
Robbie Hanson
cc73216ebf
Merge pull request #435 from ksuther/fts-upgrade
Fixed FTS extension repeatedly reindexing
2018-01-02 12:34:24 -05:00
Robbie Hanson
f0016bcc0a
Merge pull request #438 from ksuther/remove-crossprocess-logs
Adjusted logging in CrossProcessNotification extension
2018-01-02 12:32:04 -05:00
Robbie Hanson
8714d467ef Decreasing default log level for YDBActionManager. 2018-01-02 12:28:26 -05:00
Kent Sutherland
66dfd5d809 Adjusted logging in CrossProcessNotification extension
Remove NSLogging when creating and destroying the cross process notification extension.
Changed cross-process notification log to use YDBLog.
2017-12-23 14:44:24 -05:00
Kent Sutherland
ae814eaa89 Fixed FTS extension repeatedly reindexing if the original database was created with the version of the extension that didn't save ftsVersion to the database. 2017-12-05 17:01:02 -06:00
120 changed files with 6721 additions and 4491 deletions

View File

@ -1,5 +1,5 @@
language: objective-c
osx_image: xcode8.3
osx_image: xcode9.2
before_script:
- export LANG=en_US.UTF-8

View File

@ -140,6 +140,12 @@ framework module YapDatabase {
header "YapDatabaseConnectionProxy.h"
}
// Extension: ConnectionPool
explicit module YapDatabaseConnectionPool {
header "YapDatabaseConnectionPool.h"
}
// Extension: ActionManager
explicit module YapDatabaseActionManager {

View File

@ -16,6 +16,7 @@
@import YapDatabase.YapDatabaseHooks;
@import YapDatabase.YapDatabaseRTreeIndex;
@import YapDatabase.YapDatabaseConnectionProxy;
@import YapDatabase.YapDatabaseConnectionPool;
@import YapDatabase.YapDatabaseActionManager;
#if !TARGET_OS_WATCH
@import YapDatabase.YapDatabaseCloudKit;

View File

@ -140,6 +140,12 @@ framework module YapDatabase {
header "YapDatabaseConnectionProxy.h"
}
// Extension: ConnectionPool
explicit module YapDatabaseConnectionPool {
header "YapDatabaseConnectionPool.h"
}
// Extension: ActionManager
explicit module YapDatabaseActionManager {

View File

@ -140,6 +140,12 @@ framework module YapDatabase {
header "YapDatabaseConnectionProxy.h"
}
// Extension: ConnectionPool
explicit module YapDatabaseConnectionPool {
header "YapDatabaseConnectionPool.h"
}
// Extension: ActionManager
explicit module YapDatabaseActionManager {

View File

@ -140,6 +140,12 @@ framework module YapDatabase {
header "YapDatabaseConnectionProxy.h"
}
// Extension: ConnectionPool
explicit module YapDatabaseConnectionPool {
header "YapDatabaseConnectionPool.h"
}
// Extension: ActionManager
explicit module YapDatabaseActionManager {

View File

@ -28,8 +28,6 @@ It has the following features:
* **Performance**. Fetch thousands of objects on the main thread without dropping a frame.
* **Objective-C**. A simple to use Objective-C API means you'll be up and running in no time.
<br/>
**[See what the API looks like in "hello world" for YapDatabase](https://github.com/yapstudios/YapDatabase/wiki/Hello-World)**<br/>

View File

@ -50,7 +50,7 @@
YapDatabaseConnection *connection = [database newConnection];
YapDatabaseFullTextSearchHandler *handler = [YapDatabaseFullTextSearchHandler withObjectBlock:
^(NSMutableDictionary *dict, NSString *collection, NSString *key, id object){
^(YapDatabaseReadTransaction *transaction, NSMutableDictionary *dict, NSString *collection, NSString *key, id object){
[dict setObject:object forKey:@"content"];
}];
@ -169,7 +169,7 @@
YapDatabaseConnection *connection = [database newConnection];
YapDatabaseFullTextSearchHandler *handler = [YapDatabaseFullTextSearchHandler withObjectBlock:
^(NSMutableDictionary *dict, NSString *collection, NSString *key, id object){
^(YapDatabaseReadTransaction *transaction, NSMutableDictionary *dict, NSString *collection, NSString *key, id object){
[dict setObject:object forKey:@"content"];
}];

View File

@ -4292,6 +4292,66 @@
}];
}
/**
* Issue #399 refers to a crash when:
* - manual edges are being used
* - an edge is being immediately deleted
* - but the NotInDatabase flag wasn't being set
*
* We discovered a similar crash when using protocolEdges.
**/
- (void)testIssue399_protocol
{
NSString *databasePath = [self databasePath:NSStringFromSelector(_cmd)];
[[NSFileManager defaultManager] removeItemAtPath:databasePath error:NULL];
YapDatabase *database = [[YapDatabase alloc] initWithPath:databasePath];
XCTAssertNotNil(database);
YapDatabaseConnection *connection = [database newConnection];
YapDatabaseRelationship *relationship = [[YapDatabaseRelationship alloc] init];
BOOL registered = [database registerExtension:relationship withName:@"relationship"];
XCTAssertTrue(registered, @"Error registering extension");
__block Node_Standard *node = nil;
[connection readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
[transaction setObject:@"string" forKey:@"valid" inCollection:nil];
node = [[Node_Standard alloc] init];
node.childKeys = @[@"valid", @"invalid-1"];
// The node.childKeys has 2 items,
// and so it will attempt to create 2 edges.
// - The first is valid
// - The second is invalid
//
// The invalid edge should be deleted during [YapDBRelationshipTransaction flush].
//
// Note:
// In this case, 'node' is a newly inserted item in the database.
// Which means the code path taken is different from a modified item.
// So we need another unit test to achieve proper unit test coverage for this issue.
//
[transaction setObject:node forKey:node.key inCollection:nil];
}];
[connection readWriteWithBlock:^(YapDatabaseReadWriteTransaction * _Nonnull transaction) {
node = [transaction objectForKey:node.key inCollection:nil];
node.childKeys = @[@"valid", @"invalid-2"];
// In this case, 'node' is a modified item in the database.
// Which means the code path taken is different from an inserted item.
//
[transaction setObject:node forKey:node.key inCollection:nil];
}];
}
/**
* Issue #426 - https://github.com/yapstudios/YapDatabase/issues/426

View File

@ -169,7 +169,7 @@
// Setup FTS
YapDatabaseFullTextSearchHandler *handler = [YapDatabaseFullTextSearchHandler withObjectBlock:
^(NSMutableDictionary *dict, NSString *collection, NSString *key, id object){
^(YapDatabaseReadTransaction *transaction, NSMutableDictionary *dict, NSString *collection, NSString *key, id object){
[dict setObject:object forKey:@"content"];
}];
@ -259,7 +259,7 @@
// Setup FTS
YapDatabaseFullTextSearchHandler *handler = [YapDatabaseFullTextSearchHandler withObjectBlock:
^(NSMutableDictionary *dict, NSString *collection, NSString *key, id object){
^(YapDatabaseReadTransaction *transaction, NSMutableDictionary *dict, NSString *collection, NSString *key, id object){
[dict setObject:object forKey:@"content"];
}];

View File

@ -1,9 +1,9 @@
PODS:
- CocoaLumberjack (3.3.0):
- CocoaLumberjack/Default (= 3.3.0)
- CocoaLumberjack/Extensions (= 3.3.0)
- CocoaLumberjack/Default (3.3.0)
- CocoaLumberjack/Extensions (3.3.0):
- CocoaLumberjack (3.4.1):
- CocoaLumberjack/Default (= 3.4.1)
- CocoaLumberjack/Extensions (= 3.4.1)
- CocoaLumberjack/Default (3.4.1)
- CocoaLumberjack/Extensions (3.4.1):
- CocoaLumberjack/Default
- YapDatabase (3.0.2):
- YapDatabase/Standard (= 3.0.2)
@ -18,6 +18,7 @@ PODS:
- YapDatabase/Standard/Extensions/AutoView (= 3.0.2)
- YapDatabase/Standard/Extensions/CloudCore (= 3.0.2)
- YapDatabase/Standard/Extensions/CloudKit (= 3.0.2)
- YapDatabase/Standard/Extensions/ConnectionPool (= 3.0.2)
- YapDatabase/Standard/Extensions/ConnectionProxy (= 3.0.2)
- YapDatabase/Standard/Extensions/CrossProcessNotification (= 3.0.2)
- YapDatabase/Standard/Extensions/FilteredView (= 3.0.2)
@ -39,6 +40,8 @@ PODS:
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/CloudKit (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/ConnectionPool (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/ConnectionProxy (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/CrossProcessNotification (3.0.2):
@ -74,9 +77,9 @@ EXTERNAL SOURCES:
:path: ../../
SPEC CHECKSUMS:
CocoaLumberjack: 3c8c74683302f9012bb168e1c4b7ae3c0b558431
YapDatabase: 299a32de9d350d37a9ac5b0532609d87d5d2a5de
CocoaLumberjack: 2e258a064cacc8eb9a2aca318e24d02a0a7fd56d
YapDatabase: 972eccb0c997d0dafe8192dccf7f58351914baf1
PODFILE CHECKSUM: 27f2264941859e807f069adfc2aa0a50167ae03d
PODFILE CHECKSUM: 8dceb5c937bc6e9558d8d75103d141eef959b637
COCOAPODS: 1.3.1
COCOAPODS: 1.4.0

View File

@ -279,13 +279,14 @@ unsigned long long const kDDDefaultLogFilesDiskQuota = 20 * 1024 * 1024; // 20
- (BOOL)isLogFile:(NSString *)fileName {
NSString *appName = [self applicationName];
BOOL hasProperPrefix = [fileName hasPrefix:appName];
// We need to add a space to the name as otherwise we could match applications that have the name prefix.
BOOL hasProperPrefix = [fileName hasPrefix:[appName stringByAppendingString:@" "]];
BOOL hasProperSuffix = [fileName hasSuffix:@".log"];
return (hasProperPrefix && hasProperSuffix);
}
//if you change formater , then change sortedLogFileInfos method also accordingly
// if you change formatter, then change sortedLogFileInfos method also accordingly
- (NSDateFormatter *)logFileDateFormatter {
NSMutableDictionary *dictionary = [[NSThread currentThread]
threadDictionary];

View File

@ -351,17 +351,16 @@ static NSUInteger _numProcessors;
// Dispatch semaphores call down to the kernel only when the calling thread needs to be blocked.
// If the calling semaphore does not need to block, no kernel call is made.
dispatch_semaphore_wait(_queueSemaphore, DISPATCH_TIME_FOREVER);
// We've now sure we won't overflow the queue.
// It is time to queue our log message.
dispatch_block_t logBlock = ^{
dispatch_semaphore_wait(_queueSemaphore, DISPATCH_TIME_FOREVER);
@autoreleasepool {
[self lt_log:logMessage];
}
};
// We've now sure we won't overflow the queue.
// It is time to queue our log message.
if (asyncFlag) {
dispatch_async(_loggingQueue, logBlock);
} else {

View File

@ -25,7 +25,6 @@
/**
* This class provides a logger for the Apple os_log facility.
**/
API_AVAILABLE(ios(10.0), macos(10.12), tvos(10.0), watchos(3.0))
@interface DDOSLogger : DDAbstractLogger <DDLogger>
/**

View File

@ -48,26 +48,30 @@ static DDOSLogger *sharedInstance;
return;
}
NSString * message = _logFormatter ? [_logFormatter formatLogMessage:logMessage] : logMessage->_message;
if (message) {
const char *msg = [message UTF8String];
if(@available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *)) {
switch (logMessage->_flag) {
case DDLogFlagError :
os_log_error(OS_LOG_DEFAULT, "%{public}s", msg);
break;
case DDLogFlagWarning :
case DDLogFlagInfo :
os_log_info(OS_LOG_DEFAULT, "%{public}s", msg);
break;
case DDLogFlagDebug :
case DDLogFlagVerbose :
default :
os_log_debug(OS_LOG_DEFAULT, "%{public}s", msg);
break;
NSString * message = _logFormatter ? [_logFormatter formatLogMessage:logMessage] : logMessage->_message;
if (message) {
const char *msg = [message UTF8String];
switch (logMessage->_flag) {
case DDLogFlagError :
os_log_error(OS_LOG_DEFAULT, "%{public}s", msg);
break;
case DDLogFlagWarning :
case DDLogFlagInfo :
os_log_info(OS_LOG_DEFAULT, "%{public}s", msg);
break;
case DDLogFlagDebug :
case DDLogFlagVerbose :
default :
os_log_debug(OS_LOG_DEFAULT, "%{public}s", msg);
break;
}
}
}
}
- (NSString *)loggerName {

View File

@ -151,14 +151,16 @@ Configure your logging however you want. Change log levels per file (perfect for
### Requirements
The current version of Lumberjack requires:
- Xcode 8 or later
- Swift 3.0 or later
- iOS 5 or later
- OS X 10.7 or later
- Xcode 9 or later
- Swift 4.0 or later
- iOS 6 or later
- OS X 10.8 or later
- WatchOS 2 or later
- TVOS 9 or later
#### Backwards compability
- for iOS 5 and OS X 10.7, use the 3.3 version
- for Xcode 8 and Swift 3, use the 3.2 version
- for Xcode 7.3 and Swift 2.3, use the 2.4.0 version
- for Xcode 7.3 and Swift 2.2, use the 2.3.0 version
- for Xcode 7.2 and 7.1, use the 2.2.0 version

View File

@ -0,0 +1 @@
../../../../../../YapDatabase/Extensions/ConnectionPool/YapDatabaseConnectionPool.h

View File

@ -0,0 +1 @@
../../../../../../YapDatabase/Utilities/YapDatabaseCryptoUtils.h

View File

@ -0,0 +1 @@
../../../../../../YapDatabase/Extensions/ConnectionPool/YapDatabaseConnectionPool.h

View File

@ -0,0 +1 @@
../../../../../../YapDatabase/Utilities/YapDatabaseCryptoUtils.h

View File

@ -12,7 +12,7 @@
"tag": "3.0.2"
},
"platforms": {
"osx": "10.9",
"osx": "10.10",
"ios": "8.0",
"tvos": "9.0",
"watchos": "2.0"
@ -139,6 +139,10 @@
"name": "ConnectionProxy",
"source_files": "YapDatabase/Extensions/ConnectionProxy/**/*.{h,m,mm,c}"
},
{
"name": "ConnectionPool",
"source_files": "YapDatabase/Extensions/ConnectionPool/**/*.{h,m,mm,c}"
},
{
"name": "ActionManager",
"osx": {
@ -288,6 +292,10 @@
"name": "ConnectionProxy",
"source_files": "YapDatabase/Extensions/ConnectionProxy/**/*.{h,m,mm,c}"
},
{
"name": "ConnectionPool",
"source_files": "YapDatabase/Extensions/ConnectionPool/**/*.{h,m,mm,c}"
},
{
"name": "ActionManager",
"osx": {

View File

@ -1,9 +1,9 @@
PODS:
- CocoaLumberjack (3.3.0):
- CocoaLumberjack/Default (= 3.3.0)
- CocoaLumberjack/Extensions (= 3.3.0)
- CocoaLumberjack/Default (3.3.0)
- CocoaLumberjack/Extensions (3.3.0):
- CocoaLumberjack (3.4.1):
- CocoaLumberjack/Default (= 3.4.1)
- CocoaLumberjack/Extensions (= 3.4.1)
- CocoaLumberjack/Default (3.4.1)
- CocoaLumberjack/Extensions (3.4.1):
- CocoaLumberjack/Default
- YapDatabase (3.0.2):
- YapDatabase/Standard (= 3.0.2)
@ -18,6 +18,7 @@ PODS:
- YapDatabase/Standard/Extensions/AutoView (= 3.0.2)
- YapDatabase/Standard/Extensions/CloudCore (= 3.0.2)
- YapDatabase/Standard/Extensions/CloudKit (= 3.0.2)
- YapDatabase/Standard/Extensions/ConnectionPool (= 3.0.2)
- YapDatabase/Standard/Extensions/ConnectionProxy (= 3.0.2)
- YapDatabase/Standard/Extensions/CrossProcessNotification (= 3.0.2)
- YapDatabase/Standard/Extensions/FilteredView (= 3.0.2)
@ -39,6 +40,8 @@ PODS:
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/CloudKit (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/ConnectionPool (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/ConnectionProxy (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/CrossProcessNotification (3.0.2):
@ -74,9 +77,9 @@ EXTERNAL SOURCES:
:path: ../../
SPEC CHECKSUMS:
CocoaLumberjack: 3c8c74683302f9012bb168e1c4b7ae3c0b558431
YapDatabase: 299a32de9d350d37a9ac5b0532609d87d5d2a5de
CocoaLumberjack: 2e258a064cacc8eb9a2aca318e24d02a0a7fd56d
YapDatabase: 972eccb0c997d0dafe8192dccf7f58351914baf1
PODFILE CHECKSUM: 27f2264941859e807f069adfc2aa0a50167ae03d
PODFILE CHECKSUM: 8dceb5c937bc6e9558d8d75103d141eef959b637
COCOAPODS: 1.3.1
COCOAPODS: 1.4.0

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CocoaLumberjack" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/CocoaLumberjack
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}

View File

@ -6,10 +6,14 @@ mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
# Used as a return value for each invocation of `strip_invalid_archs` function.
STRIP_BINARY_RETVAL=0
# This protects against multiple targets copying the same framework dependency at the same time. The solution
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
# Copies and strips a vendored framework
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
@ -58,12 +62,31 @@ install_framework()
fi
}
# Copies the dSYM of a vendored framework
# Copies and strips a vendored dSYM
install_dsym() {
local source="$1"
if [ -r "$source" ]; then
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}"
# Copy the dSYM into a the targets temp dir.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
local basename
basename="$(basename -s .framework.dSYM "$source")"
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
strip_invalid_archs "$binary"
fi
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
# Move the stripped file into its final destination.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
else
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
fi
fi
}
@ -85,10 +108,18 @@ code_sign_if_enabled() {
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
# Get architectures for current target binary
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
# Intersect them with the architectures we are building for
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
# If there are no archs supported by this binary then warn the user
if [[ -z "$intersected_archs" ]]; then
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
STRIP_BINARY_RETVAL=0
return
fi
stripped=""
for arch in $archs; do
for arch in $binary_archs; do
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
@ -98,6 +129,7 @@ strip_invalid_archs() {
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
STRIP_BINARY_RETVAL=1
}
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then

View File

@ -1,9 +1,9 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$PODS_CONFIGURATION_BUILD_DIR/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/YapDatabase"
OTHER_CFLAGS = $(inherited) -DYAP_STANDARD_SQLITE $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaLumberjack" -isystem "${PODS_ROOT}/Headers/Public/YapDatabase"
OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaLumberjack" -l"YapDatabase" -l"c++" -l"sqlite3" -framework "SystemConfiguration"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,9 +1,9 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$PODS_CONFIGURATION_BUILD_DIR/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/YapDatabase"
OTHER_CFLAGS = $(inherited) -DYAP_STANDARD_SQLITE $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaLumberjack" -isystem "${PODS_ROOT}/Headers/Public/YapDatabase"
OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaLumberjack" -l"YapDatabase" -l"c++" -l"sqlite3" -framework "SystemConfiguration"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -6,10 +6,14 @@ mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
# Used as a return value for each invocation of `strip_invalid_archs` function.
STRIP_BINARY_RETVAL=0
# This protects against multiple targets copying the same framework dependency at the same time. The solution
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
# Copies and strips a vendored framework
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
@ -58,12 +62,31 @@ install_framework()
fi
}
# Copies the dSYM of a vendored framework
# Copies and strips a vendored dSYM
install_dsym() {
local source="$1"
if [ -r "$source" ]; then
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}"
# Copy the dSYM into a the targets temp dir.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
local basename
basename="$(basename -s .framework.dSYM "$source")"
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
strip_invalid_archs "$binary"
fi
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
# Move the stripped file into its final destination.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
else
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
fi
fi
}
@ -85,10 +108,18 @@ code_sign_if_enabled() {
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
# Get architectures for current target binary
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
# Intersect them with the architectures we are building for
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
# If there are no archs supported by this binary then warn the user
if [[ -z "$intersected_archs" ]]; then
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
STRIP_BINARY_RETVAL=0
return
fi
stripped=""
for arch in $archs; do
for arch in $binary_archs; do
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
@ -98,6 +129,7 @@ strip_invalid_archs() {
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
STRIP_BINARY_RETVAL=1
}
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then

View File

@ -1,9 +1,9 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$PODS_CONFIGURATION_BUILD_DIR/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/YapDatabase"
OTHER_CFLAGS = $(inherited) -DYAP_STANDARD_SQLITE $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaLumberjack" -isystem "${PODS_ROOT}/Headers/Public/YapDatabase"
OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaLumberjack" -l"YapDatabase" -l"c++" -l"sqlite3" -framework "SystemConfiguration"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,9 +1,9 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$PODS_CONFIGURATION_BUILD_DIR/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/YapDatabase"
OTHER_CFLAGS = $(inherited) -DYAP_STANDARD_SQLITE $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaLumberjack" -isystem "${PODS_ROOT}/Headers/Public/YapDatabase"
OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaLumberjack" -l"YapDatabase" -l"c++" -l"sqlite3" -framework "SystemConfiguration"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -6,10 +6,14 @@ mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
# Used as a return value for each invocation of `strip_invalid_archs` function.
STRIP_BINARY_RETVAL=0
# This protects against multiple targets copying the same framework dependency at the same time. The solution
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
# Copies and strips a vendored framework
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
@ -58,12 +62,31 @@ install_framework()
fi
}
# Copies the dSYM of a vendored framework
# Copies and strips a vendored dSYM
install_dsym() {
local source="$1"
if [ -r "$source" ]; then
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DWARF_DSYM_FOLDER_PATH}"
# Copy the dSYM into a the targets temp dir.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
local basename
basename="$(basename -s .framework.dSYM "$source")"
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
strip_invalid_archs "$binary"
fi
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
# Move the stripped file into its final destination.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
else
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
fi
fi
}
@ -85,10 +108,18 @@ code_sign_if_enabled() {
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
# Get architectures for current target binary
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
# Intersect them with the architectures we are building for
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
# If there are no archs supported by this binary then warn the user
if [[ -z "$intersected_archs" ]]; then
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
STRIP_BINARY_RETVAL=0
return
fi
stripped=""
for arch in $archs; do
for arch in $binary_archs; do
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
@ -98,6 +129,7 @@ strip_invalid_archs() {
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
STRIP_BINARY_RETVAL=1
}
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then

View File

@ -1,9 +1,9 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$PODS_CONFIGURATION_BUILD_DIR/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/YapDatabase"
OTHER_CFLAGS = $(inherited) -DYAP_STANDARD_SQLITE $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaLumberjack" -isystem "${PODS_ROOT}/Headers/Public/YapDatabase"
OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaLumberjack" -l"YapDatabase" -l"c++" -l"sqlite3" -framework "SystemConfiguration"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,9 +1,9 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$PODS_CONFIGURATION_BUILD_DIR/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/YapDatabase"
OTHER_CFLAGS = $(inherited) -DYAP_STANDARD_SQLITE $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaLumberjack" -isystem "${PODS_ROOT}/Headers/Public/YapDatabase"
OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaLumberjack" -l"YapDatabase" -l"c++" -l"sqlite3" -framework "SystemConfiguration"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,11 +1,11 @@
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/YapDatabase
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/YapDatabase
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/YapDatabase" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack"
OTHER_CFLAGS = $(inherited) -DYAP_STANDARD_SQLITE
OTHER_LDFLAGS = -l"c++" -l"sqlite3" -framework "SystemConfiguration"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../..
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}

View File

@ -40,7 +40,6 @@
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
@ -70,7 +69,6 @@
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
language = ""
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -1,69 +1,72 @@
PODS:
- CocoaLumberjack (3.2.0):
- CocoaLumberjack/Default (= 3.2.0)
- CocoaLumberjack/Extensions (= 3.2.0)
- CocoaLumberjack/Default (3.2.0)
- CocoaLumberjack/Extensions (3.2.0):
- CocoaLumberjack (3.4.1):
- CocoaLumberjack/Default (= 3.4.1)
- CocoaLumberjack/Extensions (= 3.4.1)
- CocoaLumberjack/Default (3.4.1)
- CocoaLumberjack/Extensions (3.4.1):
- CocoaLumberjack/Default
- YapDatabase (3.0):
- YapDatabase/Standard (= 3.0)
- YapDatabase/Standard (3.0):
- YapDatabase/Standard/Core (= 3.0)
- YapDatabase/Standard/Extensions (= 3.0)
- YapDatabase/Standard/Core (3.0):
- YapDatabase (3.0.2):
- YapDatabase/Standard (= 3.0.2)
- YapDatabase/Standard (3.0.2):
- YapDatabase/Standard/Core (= 3.0.2)
- YapDatabase/Standard/Extensions (= 3.0.2)
- YapDatabase/Standard/Core (3.0.2):
- CocoaLumberjack
- YapDatabase/Standard/Extensions (3.0):
- YapDatabase/Standard/Extensions (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/ActionManager (= 3.0)
- YapDatabase/Standard/Extensions/AutoView (= 3.0)
- YapDatabase/Standard/Extensions/CloudCore (= 3.0)
- YapDatabase/Standard/Extensions/CloudKit (= 3.0)
- YapDatabase/Standard/Extensions/ConnectionProxy (= 3.0)
- YapDatabase/Standard/Extensions/CrossProcessNotification (= 3.0)
- YapDatabase/Standard/Extensions/FilteredView (= 3.0)
- YapDatabase/Standard/Extensions/FullTextSearch (= 3.0)
- YapDatabase/Standard/Extensions/Hooks (= 3.0)
- YapDatabase/Standard/Extensions/ManualView (= 3.0)
- YapDatabase/Standard/Extensions/Relationships (= 3.0)
- YapDatabase/Standard/Extensions/RTreeIndex (= 3.0)
- YapDatabase/Standard/Extensions/SearchResultsView (= 3.0)
- YapDatabase/Standard/Extensions/SecondaryIndex (= 3.0)
- YapDatabase/Standard/Extensions/View (= 3.0)
- YapDatabase/Standard/Extensions/ActionManager (3.0):
- YapDatabase/Standard/Extensions/ActionManager (= 3.0.2)
- YapDatabase/Standard/Extensions/AutoView (= 3.0.2)
- YapDatabase/Standard/Extensions/CloudCore (= 3.0.2)
- YapDatabase/Standard/Extensions/CloudKit (= 3.0.2)
- YapDatabase/Standard/Extensions/ConnectionPool (= 3.0.2)
- YapDatabase/Standard/Extensions/ConnectionProxy (= 3.0.2)
- YapDatabase/Standard/Extensions/CrossProcessNotification (= 3.0.2)
- YapDatabase/Standard/Extensions/FilteredView (= 3.0.2)
- YapDatabase/Standard/Extensions/FullTextSearch (= 3.0.2)
- YapDatabase/Standard/Extensions/Hooks (= 3.0.2)
- YapDatabase/Standard/Extensions/ManualView (= 3.0.2)
- YapDatabase/Standard/Extensions/Relationships (= 3.0.2)
- YapDatabase/Standard/Extensions/RTreeIndex (= 3.0.2)
- YapDatabase/Standard/Extensions/SearchResultsView (= 3.0.2)
- YapDatabase/Standard/Extensions/SecondaryIndex (= 3.0.2)
- YapDatabase/Standard/Extensions/View (= 3.0.2)
- YapDatabase/Standard/Extensions/ActionManager (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/AutoView
- YapDatabase/Standard/Extensions/AutoView (3.0):
- YapDatabase/Standard/Extensions/AutoView (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/View
- YapDatabase/Standard/Extensions/CloudCore (3.0):
- YapDatabase/Standard/Extensions/CloudCore (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/CloudKit (3.0):
- YapDatabase/Standard/Extensions/CloudKit (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/ConnectionProxy (3.0):
- YapDatabase/Standard/Extensions/ConnectionPool (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/CrossProcessNotification (3.0):
- YapDatabase/Standard/Extensions/ConnectionProxy (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/FilteredView (3.0):
- YapDatabase/Standard/Extensions/CrossProcessNotification (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/FilteredView (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/View
- YapDatabase/Standard/Extensions/FullTextSearch (3.0):
- YapDatabase/Standard/Extensions/FullTextSearch (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/Hooks (3.0):
- YapDatabase/Standard/Extensions/Hooks (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/ManualView (3.0):
- YapDatabase/Standard/Extensions/ManualView (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/View
- YapDatabase/Standard/Extensions/Relationships (3.0):
- YapDatabase/Standard/Extensions/Relationships (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/RTreeIndex (3.0):
- YapDatabase/Standard/Extensions/RTreeIndex (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/SearchResultsView (3.0):
- YapDatabase/Standard/Extensions/SearchResultsView (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/AutoView
- YapDatabase/Standard/Extensions/FullTextSearch
- YapDatabase/Standard/Extensions/SecondaryIndex (3.0):
- YapDatabase/Standard/Extensions/SecondaryIndex (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/View (3.0):
- YapDatabase/Standard/Extensions/View (3.0.2):
- YapDatabase/Standard/Core
DEPENDENCIES:
@ -74,9 +77,9 @@ EXTERNAL SOURCES:
:path: ../../
SPEC CHECKSUMS:
CocoaLumberjack: 9b4aed7073d242f29cc2f62068d995faf67f703a
YapDatabase: 0cef6c79948169c924ae325d430ffcfa8a5231c2
CocoaLumberjack: 2e258a064cacc8eb9a2aca318e24d02a0a7fd56d
YapDatabase: 972eccb0c997d0dafe8192dccf7f58351914baf1
PODFILE CHECKSUM: 56e0faf7e85fac2003da53b861394c2731e637d4
COCOAPODS: 1.2.1
COCOAPODS: 1.4.0

View File

@ -86,10 +86,10 @@ public func DDLogError(_ message: @autoclosure () -> String, level: DDLogLevel =
public func CurrentFileName(_ fileName: StaticString = #file) -> String {
var str = String(describing: fileName)
if let idx = str.range(of: "/", options: .backwards)?.upperBound {
str = str.substring(from: idx)
str = String(str[idx...])
}
if let idx = str.range(of: ".", options: .backwards)?.lowerBound {
str = str.substring(to: idx)
str = String(str[..<idx])
}
return str
}

View File

@ -397,7 +397,7 @@ extern unsigned long long const kDDDefaultLogFilesDiskQuota;
* You can optionally force the current log file to be rolled with this method.
* CompletionBlock will be called on main queue.
*/
- (void)rollLogFileWithCompletionBlock:(void (^)())completionBlock NS_SWIFT_NAME(rollLogFile(withCompletion:));
- (void)rollLogFileWithCompletionBlock:(void (^)(void))completionBlock NS_SWIFT_NAME(rollLogFile(withCompletion:));
/**
* Method is deprecated.

View File

@ -279,47 +279,18 @@ unsigned long long const kDDDefaultLogFilesDiskQuota = 20 * 1024 * 1024; // 20
- (BOOL)isLogFile:(NSString *)fileName {
NSString *appName = [self applicationName];
BOOL hasProperPrefix = [fileName hasPrefix:appName];
// We need to add a space to the name as otherwise we could match applications that have the name prefix.
BOOL hasProperPrefix = [fileName hasPrefix:[appName stringByAppendingString:@" "]];
BOOL hasProperSuffix = [fileName hasSuffix:@".log"];
BOOL hasProperDate = NO;
if (hasProperPrefix && hasProperSuffix) {
NSUInteger lengthOfMiddle = fileName.length - appName.length - @".log".length;
// Date string should have at least 16 characters - " 2013-12-03 17-14"
if (lengthOfMiddle >= 17) {
NSRange range = NSMakeRange(appName.length, lengthOfMiddle);
NSString *middle = [fileName substringWithRange:range];
NSArray *components = [middle componentsSeparatedByString:@" "];
// When creating logfile if there is existing file with the same name, we append attemp number at the end.
// Thats why here we can have three or four components. For details see createNewLogFile method.
//
// Components:
// "", "2013-12-03", "17-14"
// or
// "", "2013-12-03", "17-14", "1"
if (components.count == 3 || components.count == 4) {
NSString *dateString = [NSString stringWithFormat:@"%@ %@", components[1], components[2]];
NSDateFormatter *dateFormatter = [self logFileDateFormatter];
NSDate *date = [dateFormatter dateFromString:dateString];
if (date) {
hasProperDate = YES;
}
}
}
}
return (hasProperPrefix && hasProperDate && hasProperSuffix);
return (hasProperPrefix && hasProperSuffix);
}
// if you change formatter, then change sortedLogFileInfos method also accordingly
- (NSDateFormatter *)logFileDateFormatter {
NSMutableDictionary *dictionary = [[NSThread currentThread]
threadDictionary];
NSString *dateFormat = @"yyyy'-'MM'-'dd' 'HH'-'mm'";
NSString *dateFormat = @"yyyy'-'MM'-'dd'--'HH'-'mm'-'ss'-'SSS'";
NSString *key = [NSString stringWithFormat:@"logFileDateFormatter.%@", dateFormat];
NSDateFormatter *dateFormatter = dictionary[key];
@ -417,13 +388,35 @@ unsigned long long const kDDDefaultLogFilesDiskQuota = 20 * 1024 * 1024; // 20
}
- (NSArray *)sortedLogFileInfos {
return [[self unsortedLogFileInfos] sortedArrayUsingSelector:@selector(reverseCompareByCreationDate:)];
return [[self unsortedLogFileInfos] sortedArrayUsingComparator:^NSComparisonResult(DDLogFileInfo * _Nonnull obj1, DDLogFileInfo * _Nonnull obj2) {
NSDate *date1 = [NSDate new];
NSDate *date2 = [NSDate new];
NSArray<NSString *> *arrayComponent = [[obj1 fileName] componentsSeparatedByString:@" "];
if (arrayComponent.count > 0) {
NSString *stringDate = arrayComponent.lastObject;
stringDate = [stringDate stringByReplacingOccurrencesOfString:@".log" withString:@""];
stringDate = [stringDate stringByReplacingOccurrencesOfString:@".archived" withString:@""];
date1 = [[self logFileDateFormatter] dateFromString:stringDate] ?: [obj1 creationDate];
}
arrayComponent = [[obj2 fileName] componentsSeparatedByString:@" "];
if (arrayComponent.count > 0) {
NSString *stringDate = arrayComponent.lastObject;
stringDate = [stringDate stringByReplacingOccurrencesOfString:@".log" withString:@""];
stringDate = [stringDate stringByReplacingOccurrencesOfString:@".archived" withString:@""];
date2 = [[self logFileDateFormatter] dateFromString:stringDate] ?: [obj2 creationDate];
}
return [date2 compare:date1 ?: [NSDate new]];
}];
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Creation
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//if you change newLogFileName , then change isLogFile method also accordingly
- (NSString *)newLogFileName {
NSString *appName = [self applicationName];
@ -779,7 +772,7 @@ unsigned long long const kDDDefaultLogFilesDiskQuota = 20 * 1024 * 1024; // 20
[self rollLogFileWithCompletionBlock:nil];
}
- (void)rollLogFileWithCompletionBlock:(void (^)())completionBlock {
- (void)rollLogFileWithCompletionBlock:(void (^)(void))completionBlock {
// This method is public.
// We need to execute the rolling on our logging thread/queue.

View File

@ -351,17 +351,16 @@ static NSUInteger _numProcessors;
// Dispatch semaphores call down to the kernel only when the calling thread needs to be blocked.
// If the calling semaphore does not need to block, no kernel call is made.
dispatch_semaphore_wait(_queueSemaphore, DISPATCH_TIME_FOREVER);
// We've now sure we won't overflow the queue.
// It is time to queue our log message.
dispatch_block_t logBlock = ^{
dispatch_semaphore_wait(_queueSemaphore, DISPATCH_TIME_FOREVER);
@autoreleasepool {
[self lt_log:logMessage];
}
};
// We've now sure we won't overflow the queue.
// It is time to queue our log message.
if (asyncFlag) {
dispatch_async(_loggingQueue, logBlock);
} else {

View File

@ -25,7 +25,6 @@
/**
* This class provides a logger for the Apple os_log facility.
**/
API_AVAILABLE(ios(10.0), macos(10.12), tvos(10.0), watchos(3.0))
@interface DDOSLogger : DDAbstractLogger <DDLogger>
/**

View File

@ -48,26 +48,30 @@ static DDOSLogger *sharedInstance;
return;
}
NSString * message = _logFormatter ? [_logFormatter formatLogMessage:logMessage] : logMessage->_message;
if (message) {
const char *msg = [message UTF8String];
if(@available(iOS 10.0, macOS 10.12, tvOS 10.0, watchOS 3.0, *)) {
switch (logMessage->_flag) {
case DDLogFlagError :
os_log_error(OS_LOG_DEFAULT, msg);
break;
case DDLogFlagWarning :
case DDLogFlagInfo :
os_log_info(OS_LOG_DEFAULT, msg);
break;
case DDLogFlagDebug :
case DDLogFlagVerbose :
default :
os_log_debug(OS_LOG_DEFAULT, msg);
break;
NSString * message = _logFormatter ? [_logFormatter formatLogMessage:logMessage] : logMessage->_message;
if (message) {
const char *msg = [message UTF8String];
switch (logMessage->_flag) {
case DDLogFlagError :
os_log_error(OS_LOG_DEFAULT, "%{public}s", msg);
break;
case DDLogFlagWarning :
case DDLogFlagInfo :
os_log_info(OS_LOG_DEFAULT, "%{public}s", msg);
break;
case DDLogFlagDebug :
case DDLogFlagVerbose :
default :
os_log_debug(OS_LOG_DEFAULT, "%{public}s", msg);
break;
}
}
}
}
- (NSString *)loggerName {

View File

@ -14,7 +14,7 @@
// prior written permission of Deusty, LLC.
#import "DDContextFilterLogFormatter.h"
#import <libkern/OSAtomic.h>
#import <pthread/pthread.h>
#if !__has_feature(objc_arc)
#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
@ -131,7 +131,7 @@
@interface DDLoggingContextSet () {
OSSpinLock _lock;
pthread_mutex_t _mutex;
NSMutableSet *_set;
}
@ -143,36 +143,40 @@
- (instancetype)init {
if ((self = [super init])) {
_set = [[NSMutableSet alloc] init];
_lock = OS_SPINLOCK_INIT;
pthread_mutex_init(&_mutex, NULL);
}
return self;
}
- (void)dealloc {
pthread_mutex_destroy(&_mutex);
}
- (void)addToSet:(NSUInteger)loggingContext {
OSSpinLockLock(&_lock);
pthread_mutex_lock(&_mutex);
{
[_set addObject:@(loggingContext)];
}
OSSpinLockUnlock(&_lock);
pthread_mutex_unlock(&_mutex);
}
- (void)removeFromSet:(NSUInteger)loggingContext {
OSSpinLockLock(&_lock);
pthread_mutex_lock(&_mutex);
{
[_set removeObject:@(loggingContext)];
}
OSSpinLockUnlock(&_lock);
pthread_mutex_unlock(&_mutex);
}
- (NSArray *)currentSet {
NSArray *result = nil;
OSSpinLockLock(&_lock);
pthread_mutex_lock(&_mutex);
{
result = [_set allObjects];
}
OSSpinLockUnlock(&_lock);
pthread_mutex_unlock(&_mutex);
return result;
}
@ -180,11 +184,11 @@
- (BOOL)isInSet:(NSUInteger)loggingContext {
BOOL result = NO;
OSSpinLockLock(&_lock);
pthread_mutex_lock(&_mutex);
{
result = [_set containsObject:@(loggingContext)];
}
OSSpinLockUnlock(&_lock);
pthread_mutex_unlock(&_mutex);
return result;
}

View File

@ -14,10 +14,9 @@
// prior written permission of Deusty, LLC.
#import "DDDispatchQueueLogFormatter.h"
#import <libkern/OSAtomic.h>
#import <pthread/pthread.h>
#import <objc/runtime.h>
#if !__has_feature(objc_arc)
#error This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
#endif
@ -29,7 +28,7 @@
int32_t _atomicLoggerCount;
NSDateFormatter *_threadUnsafeDateFormatter; // Use [self stringFromDate]
OSSpinLock _lock;
pthread_mutex_t _mutex;
NSUInteger _minQueueLength; // _prefix == Only access via atomic property
NSUInteger _maxQueueLength; // _prefix == Only access via atomic property
@ -63,7 +62,7 @@
_minQueueLength = 0;
_maxQueueLength = 0;
_lock = OS_SPINLOCK_INIT;
pthread_mutex_init(&_mutex, NULL);
_replacements = [[NSMutableDictionary alloc] init];
// Set default replacements:
@ -81,6 +80,10 @@
return self;
}
- (void)dealloc {
pthread_mutex_destroy(&_mutex);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#pragma mark Configuration
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -91,17 +94,17 @@
- (NSString *)replacementStringForQueueLabel:(NSString *)longLabel {
NSString *result = nil;
OSSpinLockLock(&_lock);
pthread_mutex_lock(&_mutex);
{
result = _replacements[longLabel];
}
OSSpinLockUnlock(&_lock);
pthread_mutex_unlock(&_mutex);
return result;
}
- (void)setReplacementString:(NSString *)shortLabel forQueueLabel:(NSString *)longLabel {
OSSpinLockLock(&_lock);
pthread_mutex_lock(&_mutex);
{
if (shortLabel) {
_replacements[longLabel] = shortLabel;
@ -109,7 +112,7 @@
[_replacements removeObjectForKey:longLabel];
}
}
OSSpinLockUnlock(&_lock);
pthread_mutex_unlock(&_mutex);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -214,11 +217,11 @@
fullLabel = logMessage->_threadName;
}
OSSpinLockLock(&_lock);
pthread_mutex_lock(&_mutex);
{
abrvLabel = _replacements[fullLabel];
}
OSSpinLockUnlock(&_lock);
pthread_mutex_unlock(&_mutex);
if (abrvLabel) {
queueThreadLabel = abrvLabel;

View File

@ -151,14 +151,16 @@ Configure your logging however you want. Change log levels per file (perfect for
### Requirements
The current version of Lumberjack requires:
- Xcode 8 or later
- Swift 3.0 or later
- iOS 5 or later
- OS X 10.7 or later
- Xcode 9 or later
- Swift 4.0 or later
- iOS 6 or later
- OS X 10.8 or later
- WatchOS 2 or later
- TVOS 9 or later
#### Backwards compability
- for iOS 5 and OS X 10.7, use the 3.3 version
- for Xcode 8 and Swift 3, use the 3.2 version
- for Xcode 7.3 and Swift 2.3, use the 2.4.0 version
- for Xcode 7.3 and Swift 2.2, use the 2.3.0 version
- for Xcode 7.2 and 7.1, use the 2.2.0 version

View File

@ -0,0 +1 @@
../../../../../../YapDatabase/Extensions/ConnectionPool/YapDatabaseConnectionPool.h

View File

@ -0,0 +1 @@
../../../../../../YapDatabase/Utilities/YapDatabaseCryptoUtils.h

View File

@ -0,0 +1 @@
../../../../../../YapDatabase/Extensions/ConnectionPool/YapDatabaseConnectionPool.h

View File

@ -0,0 +1 @@
../../../../../../YapDatabase/Utilities/YapDatabaseCryptoUtils.h

View File

@ -1,6 +1,6 @@
{
"name": "YapDatabase",
"version": "3.0",
"version": "3.0.2",
"summary": "A key/value store built atop sqlite for iOS & Mac.",
"homepage": "https://github.com/yapstudios/YapDatabase",
"license": "MIT",
@ -9,10 +9,10 @@
},
"source": {
"git": "https://github.com/yapstudios/YapDatabase.git",
"tag": "3.0"
"tag": "3.0.2"
},
"platforms": {
"osx": "10.9",
"osx": "10.10",
"ios": "8.0",
"tvos": "9.0",
"watchos": "2.0"
@ -139,6 +139,10 @@
"name": "ConnectionProxy",
"source_files": "YapDatabase/Extensions/ConnectionProxy/**/*.{h,m,mm,c}"
},
{
"name": "ConnectionPool",
"source_files": "YapDatabase/Extensions/ConnectionPool/**/*.{h,m,mm,c}"
},
{
"name": "ActionManager",
"osx": {
@ -288,6 +292,10 @@
"name": "ConnectionProxy",
"source_files": "YapDatabase/Extensions/ConnectionProxy/**/*.{h,m,mm,c}"
},
{
"name": "ConnectionPool",
"source_files": "YapDatabase/Extensions/ConnectionPool/**/*.{h,m,mm,c}"
},
{
"name": "ActionManager",
"osx": {

View File

@ -1,69 +1,72 @@
PODS:
- CocoaLumberjack (3.2.0):
- CocoaLumberjack/Default (= 3.2.0)
- CocoaLumberjack/Extensions (= 3.2.0)
- CocoaLumberjack/Default (3.2.0)
- CocoaLumberjack/Extensions (3.2.0):
- CocoaLumberjack (3.4.1):
- CocoaLumberjack/Default (= 3.4.1)
- CocoaLumberjack/Extensions (= 3.4.1)
- CocoaLumberjack/Default (3.4.1)
- CocoaLumberjack/Extensions (3.4.1):
- CocoaLumberjack/Default
- YapDatabase (3.0):
- YapDatabase/Standard (= 3.0)
- YapDatabase/Standard (3.0):
- YapDatabase/Standard/Core (= 3.0)
- YapDatabase/Standard/Extensions (= 3.0)
- YapDatabase/Standard/Core (3.0):
- YapDatabase (3.0.2):
- YapDatabase/Standard (= 3.0.2)
- YapDatabase/Standard (3.0.2):
- YapDatabase/Standard/Core (= 3.0.2)
- YapDatabase/Standard/Extensions (= 3.0.2)
- YapDatabase/Standard/Core (3.0.2):
- CocoaLumberjack
- YapDatabase/Standard/Extensions (3.0):
- YapDatabase/Standard/Extensions (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/ActionManager (= 3.0)
- YapDatabase/Standard/Extensions/AutoView (= 3.0)
- YapDatabase/Standard/Extensions/CloudCore (= 3.0)
- YapDatabase/Standard/Extensions/CloudKit (= 3.0)
- YapDatabase/Standard/Extensions/ConnectionProxy (= 3.0)
- YapDatabase/Standard/Extensions/CrossProcessNotification (= 3.0)
- YapDatabase/Standard/Extensions/FilteredView (= 3.0)
- YapDatabase/Standard/Extensions/FullTextSearch (= 3.0)
- YapDatabase/Standard/Extensions/Hooks (= 3.0)
- YapDatabase/Standard/Extensions/ManualView (= 3.0)
- YapDatabase/Standard/Extensions/Relationships (= 3.0)
- YapDatabase/Standard/Extensions/RTreeIndex (= 3.0)
- YapDatabase/Standard/Extensions/SearchResultsView (= 3.0)
- YapDatabase/Standard/Extensions/SecondaryIndex (= 3.0)
- YapDatabase/Standard/Extensions/View (= 3.0)
- YapDatabase/Standard/Extensions/ActionManager (3.0):
- YapDatabase/Standard/Extensions/ActionManager (= 3.0.2)
- YapDatabase/Standard/Extensions/AutoView (= 3.0.2)
- YapDatabase/Standard/Extensions/CloudCore (= 3.0.2)
- YapDatabase/Standard/Extensions/CloudKit (= 3.0.2)
- YapDatabase/Standard/Extensions/ConnectionPool (= 3.0.2)
- YapDatabase/Standard/Extensions/ConnectionProxy (= 3.0.2)
- YapDatabase/Standard/Extensions/CrossProcessNotification (= 3.0.2)
- YapDatabase/Standard/Extensions/FilteredView (= 3.0.2)
- YapDatabase/Standard/Extensions/FullTextSearch (= 3.0.2)
- YapDatabase/Standard/Extensions/Hooks (= 3.0.2)
- YapDatabase/Standard/Extensions/ManualView (= 3.0.2)
- YapDatabase/Standard/Extensions/Relationships (= 3.0.2)
- YapDatabase/Standard/Extensions/RTreeIndex (= 3.0.2)
- YapDatabase/Standard/Extensions/SearchResultsView (= 3.0.2)
- YapDatabase/Standard/Extensions/SecondaryIndex (= 3.0.2)
- YapDatabase/Standard/Extensions/View (= 3.0.2)
- YapDatabase/Standard/Extensions/ActionManager (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/AutoView
- YapDatabase/Standard/Extensions/AutoView (3.0):
- YapDatabase/Standard/Extensions/AutoView (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/View
- YapDatabase/Standard/Extensions/CloudCore (3.0):
- YapDatabase/Standard/Extensions/CloudCore (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/CloudKit (3.0):
- YapDatabase/Standard/Extensions/CloudKit (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/ConnectionProxy (3.0):
- YapDatabase/Standard/Extensions/ConnectionPool (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/CrossProcessNotification (3.0):
- YapDatabase/Standard/Extensions/ConnectionProxy (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/FilteredView (3.0):
- YapDatabase/Standard/Extensions/CrossProcessNotification (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/FilteredView (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/View
- YapDatabase/Standard/Extensions/FullTextSearch (3.0):
- YapDatabase/Standard/Extensions/FullTextSearch (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/Hooks (3.0):
- YapDatabase/Standard/Extensions/Hooks (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/ManualView (3.0):
- YapDatabase/Standard/Extensions/ManualView (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/View
- YapDatabase/Standard/Extensions/Relationships (3.0):
- YapDatabase/Standard/Extensions/Relationships (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/RTreeIndex (3.0):
- YapDatabase/Standard/Extensions/RTreeIndex (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/SearchResultsView (3.0):
- YapDatabase/Standard/Extensions/SearchResultsView (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/AutoView
- YapDatabase/Standard/Extensions/FullTextSearch
- YapDatabase/Standard/Extensions/SecondaryIndex (3.0):
- YapDatabase/Standard/Extensions/SecondaryIndex (3.0.2):
- YapDatabase/Standard/Core
- YapDatabase/Standard/Extensions/View (3.0):
- YapDatabase/Standard/Extensions/View (3.0.2):
- YapDatabase/Standard/Core
DEPENDENCIES:
@ -74,9 +77,9 @@ EXTERNAL SOURCES:
:path: ../../
SPEC CHECKSUMS:
CocoaLumberjack: 9b4aed7073d242f29cc2f62068d995faf67f703a
YapDatabase: 0cef6c79948169c924ae325d430ffcfa8a5231c2
CocoaLumberjack: 2e258a064cacc8eb9a2aca318e24d02a0a7fd56d
YapDatabase: 972eccb0c997d0dafe8192dccf7f58351914baf1
PODFILE CHECKSUM: 56e0faf7e85fac2003da53b861394c2731e637d4
COCOAPODS: 1.2.1
COCOAPODS: 1.4.0

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/CocoaLumberjack" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/CocoaLumberjack
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}

View File

@ -6,6 +6,14 @@ mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
# Used as a return value for each invocation of `strip_invalid_archs` function.
STRIP_BINARY_RETVAL=0
# This protects against multiple targets copying the same framework dependency at the same time. The solution
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
# Copies and strips a vendored framework
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
@ -23,9 +31,9 @@ install_framework()
source="$(readlink "${source}")"
fi
# use filter instead of exclude so missing patterns dont' throw errors
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
# Use filter instead of exclude so missing patterns don't throw errors.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
@ -54,6 +62,34 @@ install_framework()
fi
}
# Copies and strips a vendored dSYM
install_dsym() {
local source="$1"
if [ -r "$source" ]; then
# Copy the dSYM into a the targets temp dir.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
local basename
basename="$(basename -s .framework.dSYM "$source")"
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
strip_invalid_archs "$binary"
fi
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
# Move the stripped file into its final destination.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
else
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
fi
fi
}
# Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
@ -72,11 +108,19 @@ code_sign_if_enabled() {
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
# Get architectures for current target binary
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
# Intersect them with the architectures we are building for
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
# If there are no archs supported by this binary then warn the user
if [[ -z "$intersected_archs" ]]; then
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
STRIP_BINARY_RETVAL=0
return
fi
stripped=""
for arch in $archs; do
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
for arch in $binary_archs; do
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
@ -85,6 +129,7 @@ strip_invalid_archs() {
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
STRIP_BINARY_RETVAL=1
}
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then

View File

@ -8,6 +8,10 @@ RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
XCASSET_FILES=()
# This protects against multiple targets copying the same framework dependency at the same time. The solution
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
case "${TARGETED_DEVICE_FAMILY}" in
1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
@ -44,29 +48,29 @@ EOM
fi
case $RESOURCE_PATH in
*.storyboard)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
;;
*.xib)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
;;
*.framework)
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
;;
*.xcdatamodel)
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
;;
*.xcdatamodeld)
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
;;
*.xcmappingmodel)
echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true
xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
;;
*.xcassets)
@ -74,7 +78,7 @@ EOM
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
;;
*)
echo "$RESOURCE_PATH"
echo "$RESOURCE_PATH" || true
echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
;;
esac

View File

@ -1,9 +1,9 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$PODS_CONFIGURATION_BUILD_DIR/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/YapDatabase"
OTHER_CFLAGS = $(inherited) -DYAP_STANDARD_SQLITE $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaLumberjack" -isystem "${PODS_ROOT}/Headers/Public/YapDatabase"
OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaLumberjack" -l"YapDatabase" -l"c++" -l"sqlite3" -framework "SystemConfiguration"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,9 +1,9 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$PODS_CONFIGURATION_BUILD_DIR/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/YapDatabase"
OTHER_CFLAGS = $(inherited) -DYAP_STANDARD_SQLITE $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaLumberjack" -isystem "${PODS_ROOT}/Headers/Public/YapDatabase"
OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaLumberjack" -l"YapDatabase" -l"c++" -l"sqlite3" -framework "SystemConfiguration"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -6,6 +6,14 @@ mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}"
# Used as a return value for each invocation of `strip_invalid_archs` function.
STRIP_BINARY_RETVAL=0
# This protects against multiple targets copying the same framework dependency at the same time. The solution
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
# Copies and strips a vendored framework
install_framework()
{
if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then
@ -23,9 +31,9 @@ install_framework()
source="$(readlink "${source}")"
fi
# use filter instead of exclude so missing patterns dont' throw errors
echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
# Use filter instead of exclude so missing patterns don't throw errors.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}"
local basename
basename="$(basename -s .framework "$1")"
@ -54,6 +62,34 @@ install_framework()
fi
}
# Copies and strips a vendored dSYM
install_dsym() {
local source="$1"
if [ -r "$source" ]; then
# Copy the dSYM into a the targets temp dir.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${DERIVED_FILES_DIR}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${DERIVED_FILES_DIR}"
local basename
basename="$(basename -s .framework.dSYM "$source")"
binary="${DERIVED_FILES_DIR}/${basename}.framework.dSYM/Contents/Resources/DWARF/${basename}"
# Strip invalid architectures so "fat" simulator / device frameworks work on device
if [[ "$(file "$binary")" == *"Mach-O dSYM companion"* ]]; then
strip_invalid_archs "$binary"
fi
if [[ $STRIP_BINARY_RETVAL == 1 ]]; then
# Move the stripped file into its final destination.
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${DERIVED_FILES_DIR}/${basename}.framework.dSYM\" \"${DWARF_DSYM_FOLDER_PATH}\""
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${DERIVED_FILES_DIR}/${basename}.framework.dSYM" "${DWARF_DSYM_FOLDER_PATH}"
else
# The dSYM was not stripped at all, in this case touch a fake folder so the input/output paths from Xcode do not reexecute this script because the file is missing.
touch "${DWARF_DSYM_FOLDER_PATH}/${basename}.framework.dSYM"
fi
fi
}
# Signs a framework with the provided identity
code_sign_if_enabled() {
if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then
@ -72,11 +108,19 @@ code_sign_if_enabled() {
# Strip invalid architectures
strip_invalid_archs() {
binary="$1"
# Get architectures for current file
archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)"
# Get architectures for current target binary
binary_archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | awk '{$1=$1;print}' | rev)"
# Intersect them with the architectures we are building for
intersected_archs="$(echo ${ARCHS[@]} ${binary_archs[@]} | tr ' ' '\n' | sort | uniq -d)"
# If there are no archs supported by this binary then warn the user
if [[ -z "$intersected_archs" ]]; then
echo "warning: [CP] Vendored binary '$binary' contains architectures ($binary_archs) none of which match the current build architectures ($ARCHS)."
STRIP_BINARY_RETVAL=0
return
fi
stripped=""
for arch in $archs; do
if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then
for arch in $binary_archs; do
if ! [[ "${ARCHS}" == *"$arch"* ]]; then
# Strip non-valid architectures in-place
lipo -remove "$arch" -output "$binary" "$binary" || exit 1
stripped="$stripped $arch"
@ -85,6 +129,7 @@ strip_invalid_archs() {
if [[ "$stripped" ]]; then
echo "Stripped $binary of architectures:$stripped"
fi
STRIP_BINARY_RETVAL=1
}
if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then

View File

@ -8,6 +8,10 @@ RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt
XCASSET_FILES=()
# This protects against multiple targets copying the same framework dependency at the same time. The solution
# was originally proposed here: https://lists.samba.org/archive/rsync/2008-February/020158.html
RSYNC_PROTECT_TMP_FILES=(--filter "P .*.??????")
case "${TARGETED_DEVICE_FAMILY}" in
1,2)
TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone"
@ -44,29 +48,29 @@ EOM
fi
case $RESOURCE_PATH in
*.storyboard)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
;;
*.xib)
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}"
echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" || true
ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS}
;;
*.framework)
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
echo "rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" || true
rsync --delete -av "${RSYNC_PROTECT_TMP_FILES[@]}" "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}"
;;
*.xcdatamodel)
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\""
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" || true
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom"
;;
*.xcdatamodeld)
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\""
echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" || true
xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd"
;;
*.xcmappingmodel)
echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\""
echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" || true
xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm"
;;
*.xcassets)
@ -74,7 +78,7 @@ EOM
XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE")
;;
*)
echo "$RESOURCE_PATH"
echo "$RESOURCE_PATH" || true
echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY"
;;
esac

View File

@ -1,9 +1,9 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$PODS_CONFIGURATION_BUILD_DIR/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/YapDatabase"
OTHER_CFLAGS = $(inherited) -DYAP_STANDARD_SQLITE $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaLumberjack" -isystem "${PODS_ROOT}/Headers/Public/YapDatabase"
OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaLumberjack" -l"YapDatabase" -l"c++" -l"sqlite3" -framework "SystemConfiguration"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,9 +1,9 @@
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack" "$PODS_CONFIGURATION_BUILD_DIR/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack" "${PODS_CONFIGURATION_BUILD_DIR}/YapDatabase"
OTHER_CFLAGS = $(inherited) -DYAP_STANDARD_SQLITE $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/CocoaLumberjack" -isystem "${PODS_ROOT}/Headers/Public/YapDatabase"
OTHER_LDFLAGS = $(inherited) -ObjC -l"CocoaLumberjack" -l"YapDatabase" -l"c++" -l"sqlite3" -framework "SystemConfiguration"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_PODFILE_DIR_PATH = ${SRCROOT}/.
PODS_ROOT = ${SRCROOT}/Pods

View File

@ -1,11 +1,11 @@
CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/YapDatabase
CONFIGURATION_BUILD_DIR = ${PODS_CONFIGURATION_BUILD_DIR}/YapDatabase
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/YapDatabase" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/CocoaLumberjack" "${PODS_ROOT}/Headers/Public/YapDatabase"
LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/CocoaLumberjack"
LIBRARY_SEARCH_PATHS = $(inherited) "${PODS_CONFIGURATION_BUILD_DIR}/CocoaLumberjack"
OTHER_CFLAGS = $(inherited) -DYAP_STANDARD_SQLITE
OTHER_LDFLAGS = -l"c++" -l"sqlite3" -framework "SystemConfiguration"
PODS_BUILD_DIR = $BUILD_DIR
PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_BUILD_DIR = ${BUILD_DIR}
PODS_CONFIGURATION_BUILD_DIR = ${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)
PODS_ROOT = ${SRCROOT}
PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../..
PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier}

View File

@ -553,13 +553,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-YapDatabase-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
3397BBC53BC83C63A5C6FE2F /* [CP] Copy Pods Resources */ = {
@ -626,13 +629,16 @@
files = (
);
inputPaths = (
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
"${PODS_ROOT}/Manifest.lock",
);
name = "[CP] Check Pods Manifest.lock";
outputPaths = (
"$(DERIVED_FILE_DIR)/Pods-YapDatabaseTests-checkManifestLockResult.txt",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n";
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
showEnvVarsInLog = 0;
};
/* End PBXShellScriptBuildPhase section */

View File

@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "YapDatabase"
s.version = "3.0.2"
s.version = "3.1.1"
s.summary = "A key/value store built atop sqlite for iOS & Mac."
s.homepage = "https://github.com/yapstudios/YapDatabase"
s.license = 'MIT'
@ -13,7 +13,7 @@ Pod::Spec.new do |s|
:tag => s.version.to_s
}
s.osx.deployment_target = '10.9'
s.osx.deployment_target = '10.10'
s.ios.deployment_target = '8.0'
s.tvos.deployment_target = '9.0'
s.watchos.deployment_target = '2.0'
@ -109,6 +109,10 @@ Pod::Spec.new do |s|
sse.subspec 'ConnectionProxy' do |ssee|
ssee.source_files = 'YapDatabase/Extensions/ConnectionProxy/**/*.{h,m,mm,c}'
end
sse.subspec 'ConnectionPool' do |ssee|
ssee.source_files = 'YapDatabase/Extensions/ConnectionPool/**/*.{h,m,mm,c}'
end
sse.subspec 'ActionManager' do |ssee|
ssee.osx.framework = 'SystemConfiguration'
@ -210,6 +214,10 @@ Pod::Spec.new do |s|
sse.subspec 'ConnectionProxy' do |ssee|
ssee.source_files = 'YapDatabase/Extensions/ConnectionProxy/**/*.{h,m,mm,c}'
end
sse.subspec 'ConnectionPool' do |ssee|
ssee.source_files = 'YapDatabase/Extensions/ConnectionPool/**/*.{h,m,mm,c}'
end
sse.subspec 'ActionManager' do |ssee|
ssee.osx.framework = 'SystemConfiguration'

View File

@ -685,6 +685,14 @@
DCAF52501C4867B000562C92 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = DCAF524F1C4867B000562C92 /* main.m */; };
DCAF52541C48681000562C92 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = DCAF52521C48681000562C92 /* Main.storyboard */; };
DCAF52581C48685400562C92 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DCAF52571C48685400562C92 /* Assets.xcassets */; };
DCB8AD0020604A26000B2D76 /* YapDatabaseConnectionPool.m in Sources */ = {isa = PBXBuildFile; fileRef = DCB8ACFE20604A25000B2D76 /* YapDatabaseConnectionPool.m */; };
DCB8AD0120604A26000B2D76 /* YapDatabaseConnectionPool.h in Headers */ = {isa = PBXBuildFile; fileRef = DCB8ACFF20604A25000B2D76 /* YapDatabaseConnectionPool.h */; settings = {ATTRIBUTES = (Public, ); }; };
DCB8AD0220604A89000B2D76 /* YapDatabaseConnectionPool.m in Sources */ = {isa = PBXBuildFile; fileRef = DCB8ACFE20604A25000B2D76 /* YapDatabaseConnectionPool.m */; };
DCB8AD0320604A8A000B2D76 /* YapDatabaseConnectionPool.m in Sources */ = {isa = PBXBuildFile; fileRef = DCB8ACFE20604A25000B2D76 /* YapDatabaseConnectionPool.m */; };
DCB8AD0420604A8B000B2D76 /* YapDatabaseConnectionPool.m in Sources */ = {isa = PBXBuildFile; fileRef = DCB8ACFE20604A25000B2D76 /* YapDatabaseConnectionPool.m */; };
DCB8AD0520604A9D000B2D76 /* YapDatabaseConnectionPool.h in Headers */ = {isa = PBXBuildFile; fileRef = DCB8ACFF20604A25000B2D76 /* YapDatabaseConnectionPool.h */; settings = {ATTRIBUTES = (Public, ); }; };
DCB8AD0620604A9E000B2D76 /* YapDatabaseConnectionPool.h in Headers */ = {isa = PBXBuildFile; fileRef = DCB8ACFF20604A25000B2D76 /* YapDatabaseConnectionPool.h */; settings = {ATTRIBUTES = (Public, ); }; };
DCB8AD0720604A9E000B2D76 /* YapDatabaseConnectionPool.h in Headers */ = {isa = PBXBuildFile; fileRef = DCB8ACFF20604A25000B2D76 /* YapDatabaseConnectionPool.h */; settings = {ATTRIBUTES = (Public, ); }; };
DCBA3C4B1FAE0EC50086289D /* YapDatabaseCloudCoreConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = DCBA3C331FAE0EC50086289D /* YapDatabaseCloudCoreConnection.m */; };
DCBA3C4C1FAE0EC50086289D /* YapDatabaseCloudCoreConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = DCBA3C331FAE0EC50086289D /* YapDatabaseCloudCoreConnection.m */; };
DCBA3C4D1FAE0EC50086289D /* YapDatabaseCloudCoreConnection.m in Sources */ = {isa = PBXBuildFile; fileRef = DCBA3C331FAE0EC50086289D /* YapDatabaseCloudCoreConnection.m */; };
@ -1386,6 +1394,8 @@
DCAF52531C48681000562C92 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Main.storyboard; sourceTree = "<group>"; };
DCAF52551C48683200562C92 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = "Framework/TestModuleMap-Mac/Info.plist"; sourceTree = "<group>"; };
DCAF52571C48685400562C92 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = "Framework/TestModuleMap-Mac/Assets.xcassets"; sourceTree = "<group>"; };
DCB8ACFE20604A25000B2D76 /* YapDatabaseConnectionPool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YapDatabaseConnectionPool.m; sourceTree = "<group>"; };
DCB8ACFF20604A25000B2D76 /* YapDatabaseConnectionPool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YapDatabaseConnectionPool.h; sourceTree = "<group>"; };
DCBA3C331FAE0EC50086289D /* YapDatabaseCloudCoreConnection.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = YapDatabaseCloudCoreConnection.m; sourceTree = "<group>"; };
DCBA3C341FAE0EC50086289D /* YapDatabaseCloudCoreTransaction.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YapDatabaseCloudCoreTransaction.h; sourceTree = "<group>"; };
DCBA3C351FAE0EC50086289D /* YapDatabaseCloudCore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = YapDatabaseCloudCore.h; sourceTree = "<group>"; };
@ -1619,10 +1629,11 @@
children = (
DC6C28D91CAAFE3B00166CE4 /* ActionManager */,
371A7B851EF18AB0004176EC /* AutoView */,
DC6C28BC1CAAF8DF00166CE4 /* CrossProcessNotification */,
DCAF523C1C48636C00562C92 /* ConnectionProxy */,
DCBA3C321FAE0EC50086289D /* CloudCore */,
DC651F191BCEC77E00188E23 /* CloudKit */,
DCB8ACFD20604A25000B2D76 /* ConnectionPool */,
DCAF523C1C48636C00562C92 /* ConnectionProxy */,
DC6C28BC1CAAF8DF00166CE4 /* CrossProcessNotification */,
DC651F391BCEC77E00188E23 /* FilteredView */,
DC651F441BCEC77E00188E23 /* FullTextSearch */,
DC651F511BCEC77E00188E23 /* Hooks */,
@ -2097,6 +2108,15 @@
name = "TestModuleMap-Shared";
sourceTree = "<group>";
};
DCB8ACFD20604A25000B2D76 /* ConnectionPool */ = {
isa = PBXGroup;
children = (
DCB8ACFF20604A25000B2D76 /* YapDatabaseConnectionPool.h */,
DCB8ACFE20604A25000B2D76 /* YapDatabaseConnectionPool.m */,
);
path = ConnectionPool;
sourceTree = "<group>";
};
DCBA3C321FAE0EC50086289D /* CloudCore */ = {
isa = PBXGroup;
children = (
@ -2300,6 +2320,7 @@
DCBA3C5A1FAE0EC50086289D /* YapDatabaseCloudCoreOptions.h in Headers */,
DC6266591D80D14B00557968 /* YapDatabaseCrossProcessNotificationConnection.h in Headers */,
DC6266571D80D14400557968 /* YapDatabaseCrossProcessNotification.h in Headers */,
DCB8AD0720604A9E000B2D76 /* YapDatabaseConnectionPool.h in Headers */,
DC62664F1D80D11700557968 /* YapDatabaseExtension.h in Headers */,
DC6266421D80D0EA00557968 /* YapDatabaseStatement.h in Headers */,
DCDAF73C1D81DC2A00C827C6 /* YapReachability.h in Headers */,
@ -2531,6 +2552,7 @@
DCE7611A1D78B638009C83A0 /* YapDatabaseSecondaryIndexPrivate.h in Headers */,
DCE761001D78B5CF009C83A0 /* YapDatabaseViewChangePrivate.h in Headers */,
DCE761521D78B742009C83A0 /* YapDatabaseRelationshipConnection.h in Headers */,
DCB8AD0620604A9E000B2D76 /* YapDatabaseConnectionPool.h in Headers */,
DCE760E71D78B556009C83A0 /* YapDatabaseCloudKitOptions.h in Headers */,
DCE761361D78B6BC009C83A0 /* YapDatabaseFullTextSearchConnection.h in Headers */,
DCE7615B1D78B775009C83A0 /* YapDatabaseRTreeIndexPrivate.h in Headers */,
@ -2675,6 +2697,7 @@
DC65204F1BCEC77E00188E23 /* YapDatabaseHooksPrivate.h in Headers */,
DC6520871BCEC77E00188E23 /* YapDatabaseRTreeIndexPrivate.h in Headers */,
DC65212F1BCEC77E00188E23 /* YapProxyObjectPrivate.h in Headers */,
DCB8AD0120604A26000B2D76 /* YapDatabaseConnectionPool.h in Headers */,
DC6C28C51CAAF8DF00166CE4 /* YapDatabaseCrossProcessNotificationPrivate.h in Headers */,
DC6521351BCEC77E00188E23 /* YapTouch.h in Headers */,
DC6C28F01CAAFE3B00166CE4 /* YapDatabaseActionManager.h in Headers */,
@ -2819,6 +2842,7 @@
DC6520501BCEC77E00188E23 /* YapDatabaseHooksPrivate.h in Headers */,
DC6520881BCEC77E00188E23 /* YapDatabaseRTreeIndexPrivate.h in Headers */,
DC6521301BCEC77E00188E23 /* YapProxyObjectPrivate.h in Headers */,
DCB8AD0520604A9D000B2D76 /* YapDatabaseConnectionPool.h in Headers */,
DC6C28C61CAAF8DF00166CE4 /* YapDatabaseCrossProcessNotificationPrivate.h in Headers */,
DC6521361BCEC77E00188E23 /* YapTouch.h in Headers */,
DC6C28F11CAAFE3B00166CE4 /* YapDatabaseActionManager.h in Headers */,
@ -3198,6 +3222,7 @@
DC6266781D80D1E300557968 /* YapDatabaseRelationshipEdge.m in Sources */,
DC62665E1D80D16400557968 /* YapDatabaseConnectionProxy.m in Sources */,
DC6266801D80D20700557968 /* YapDatabaseRTreeIndex.m in Sources */,
DCB8AD0420604A8B000B2D76 /* YapDatabaseConnectionPool.m in Sources */,
DC6266A51D80D2A300557968 /* YapDatabaseViewMappings.m in Sources */,
DC62665C1D80D15600557968 /* YapDatabaseCrossProcessNotificationTransaction.m in Sources */,
DC6266261D80D08C00557968 /* YapCache.m in Sources */,
@ -3364,6 +3389,7 @@
DCE760F31D78B582009C83A0 /* YDBCKChangeRecord.m in Sources */,
DCE7612A1D78B67B009C83A0 /* YapDatabaseSearchQueue.m in Sources */,
DCE7610B1D78B5F1009C83A0 /* YapDatabaseViewChange.m in Sources */,
DCB8AD0320604A8A000B2D76 /* YapDatabaseConnectionPool.m in Sources */,
DCE760B01D78B0DA009C83A0 /* YapMurmurHash.m in Sources */,
DCE761091D78B5EA009C83A0 /* YapDatabaseViewState.m in Sources */,
DCE7609E1D78B075009C83A0 /* YapDatabase.m in Sources */,
@ -3491,6 +3517,7 @@
DC6520531BCEC77E00188E23 /* YapDatabaseHooks.m in Sources */,
DC6521571BCEC77E00188E23 /* YapDatabase.m in Sources */,
DC6520FD1BCEC77E00188E23 /* YapDatabaseViewOptions.m in Sources */,
DCB8AD0020604A26000B2D76 /* YapDatabaseConnectionPool.m in Sources */,
DC6520411BCEC77E00188E23 /* YapDatabaseFullTextSearchConnection.m in Sources */,
DC6520BD1BCEC77E00188E23 /* YapDatabaseSecondaryIndex.m in Sources */,
DC6C28C91CAAF8DF00166CE4 /* YapDatabaseCrossProcessNotification.m in Sources */,
@ -3607,6 +3634,7 @@
DC6520541BCEC77E00188E23 /* YapDatabaseHooks.m in Sources */,
DC6521581BCEC77E00188E23 /* YapDatabase.m in Sources */,
DC6520FE1BCEC77E00188E23 /* YapDatabaseViewOptions.m in Sources */,
DCB8AD0220604A89000B2D76 /* YapDatabaseConnectionPool.m in Sources */,
DC6520421BCEC77E00188E23 /* YapDatabaseFullTextSearchConnection.m in Sources */,
DC6520BE1BCEC77E00188E23 /* YapDatabaseSecondaryIndex.m in Sources */,
DC6C28CA1CAAF8DF00166CE4 /* YapDatabaseCrossProcessNotification.m in Sources */,

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>

View File

@ -12,7 +12,7 @@
* See YapDatabaseLogging.h for more information.
**/
#if DEBUG
static const int ydbLogLevel = YDB_LOG_LEVEL_VERBOSE | YDB_LOG_FLAG_TRACE;
static const int ydbLogLevel = YDB_LOG_LEVEL_WARN;
#else
static const int ydbLogLevel = YDB_LOG_LEVEL_WARN;
#endif
@ -549,6 +549,8 @@
}
} usingBlock:^(NSString *collection, NSString *key, id object, NSUInteger index, BOOL *stop) {
#pragma clang diagnostic push // silence warnings: synchronous access
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
//
// Processing Block
@ -583,6 +585,8 @@
}
}
}
#pragma clang diagnostic pop
}];
}

View File

@ -124,9 +124,13 @@
__block YapDatabaseViewSorting *mostRecentSorting = nil;
dispatch_block_t block = ^{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
mostRecentGrouping = grouping;
mostRecentSorting = sorting;
#pragma clang diagnostic pop
};
__strong YapDatabase *database = self.registeredDatabase;

View File

@ -33,6 +33,9 @@
- (BOOL)populateView
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
YDBLogAutoTrace();
// Remove everything from the database
@ -389,6 +392,8 @@
}
return YES;
#pragma clang diagnostic pop
}
- (void)repopulateView
@ -417,6 +422,8 @@
// The changeset mechanism will automatically consolidate all changes to the minimum.
[self enumerateGroupsUsingBlock:^(NSString *group, BOOL __unused *outerStop) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
// We must add the changes in reverse order.
// Either that, or the change index of each item would have to be zero,
@ -433,6 +440,8 @@
}];
[parentConnection->changes addObject:[YapDatabaseViewSectionChange deleteGroup:group]];
#pragma clang diagnostic pop
}];
isRepopulate = YES;
@ -519,6 +528,8 @@
// This block will be invoked repeatedly as we calculate the insertion index.
NSComparisonResult (^compare)(NSUInteger) = ^NSComparisonResult (NSUInteger index){
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
int64_t anotherRowid = 0;
[self getRowid:&anotherRowid atIndex:index inGroup:group];
@ -581,6 +592,8 @@
collectionKey.collection, collectionKey.key, object, metadata,
another.collection, another.key, anotherObject, anotherMetadata);
}
#pragma clang diagnostic pop
};
NSComparisonResult cmp;
@ -1320,6 +1333,8 @@
(YapDatabaseViewFindWithKeyBlock)find.findBlock;
compare = ^NSComparisonResult (NSUInteger index){
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
int64_t rowid = 0;
[self getRowid:&rowid atIndex:index inGroup:group];
@ -1327,6 +1342,8 @@
YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
return findBlock(ck.collection, ck.key);
#pragma clang diagnostic pop
};
break;
@ -1337,6 +1354,8 @@
(YapDatabaseViewFindWithObjectBlock)find.findBlock;
compare = ^NSComparisonResult (NSUInteger index){
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
int64_t rowid = 0;
[self getRowid:&rowid atIndex:index inGroup:group];
@ -1346,6 +1365,8 @@
[databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
return findBlock(ck.collection, ck.key, object);
#pragma clang diagnostic pop
};
break;
@ -1356,6 +1377,8 @@
(YapDatabaseViewFindWithMetadataBlock)find.findBlock;
compare = ^NSComparisonResult (NSUInteger index){
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
int64_t rowid = 0;
[self getRowid:&rowid atIndex:index inGroup:group];
@ -1365,6 +1388,8 @@
[databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
return findBlock(ck.collection, ck.key, metadata);
#pragma clang diagnostic pop
};
break;
@ -1375,6 +1400,8 @@
(YapDatabaseViewFindWithRowBlock)find.findBlock;
compare = ^NSComparisonResult (NSUInteger index){
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
int64_t rowid = 0;
[self getRowid:&rowid atIndex:index inGroup:group];
@ -1385,6 +1412,8 @@
[databaseTransaction getCollectionKey:&ck object:&object metadata:&metadata forRowid:rowid];
return findBlock(ck.collection, ck.key, object, metadata);
#pragma clang diagnostic pop
};
}
@ -1527,6 +1556,8 @@
NSDictionary *extensionDependencies = databaseTransaction->connection->extensionDependencies;
[extensionDependencies enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL __unused *stop){
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
__unsafe_unretained NSString *extName = (NSString *)key;
__unsafe_unretained NSSet *extDependencies = (NSSet *)obj;
@ -1541,6 +1572,8 @@
[(id <YapDatabaseViewDependency>)extTransaction view:registeredName didRepopulateWithFlags:flags];
}
}
#pragma clang diagnostic pop
}];
}

View File

@ -120,12 +120,16 @@
[newOperations addObjectsFromArray:insertedOperations];
[indexesToReplace enumerateIndexesUsingBlock:^(NSUInteger index, BOOL *stop) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
YapDatabaseCloudCoreOperation *oldOperation = operations[index];
YapDatabaseCloudCoreOperation *newOperation = modifiedOperations[oldOperation.uuid];
[newOperations replaceObjectAtIndex:index withObject:newOperation];
[matchedModifiedOperations addObject:newOperation];
#pragma clang diagnostic pop
}];
operations = [[self class] sortOperationsByPriority:newOperations];

View File

@ -127,8 +127,12 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
__block YapDatabaseCloudCore *owner = nil;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
owner = _atomic_owner;
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -144,12 +148,16 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
__block BOOL wasOwnerSet = NO;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (!_atomic_owner && inOwner)
{
_atomic_owner = inOwner;
wasOwnerSet = YES;
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -176,6 +184,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
__block YapDatabaseCloudCoreOperation *match = nil;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
for (YapDatabaseCloudCoreGraph *graph in graphs)
{
@ -188,6 +198,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
}
}
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -213,6 +225,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
__block NSMutableArray<NSArray<YapDatabaseCloudCoreOperation *> *> *graphOperations = nil;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
graphOperations = [NSMutableArray arrayWithCapacity:graphs.count];
@ -220,6 +234,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
{
[graphOperations addObject:graph.operations];
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -250,8 +266,12 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
__block NSUInteger graphCount = 0;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
graphCount = graphs.count;
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -267,6 +287,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
__block NSMutableArray<NSArray<YapDatabaseCloudCoreOperation *> *> *graphOperations = nil;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
graphOperations = [NSMutableArray arrayWithCapacity:graphs.count];
@ -274,6 +296,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
{
[graphOperations addObject:graph.operations];
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -290,12 +314,16 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
__block uint64_t graphID = 0;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (idx <= graphs.count)
{
found = YES;
graphID = graphs[idx].persistentOrder;
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -312,12 +340,16 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
__block uint64_t nextGraphID = 0;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
YapDatabaseCloudCoreGraph *lastGraph = [graphs lastObject];
if (lastGraph)
{
nextGraphID = lastGraph.persistentOrder + 1;
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -343,9 +375,13 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
__block id result = nil;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
NSMutableDictionary *opInfo = ephemeralInfo[opUUID];
result = opInfo[key];
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -365,6 +401,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
if (uuid == nil) return;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
NSMutableDictionary *opInfo = ephemeralInfo[uuid];
if (opInfo)
@ -383,6 +421,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
opInfo[key] = object;
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -396,6 +436,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
__block BOOL allowed = YES;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
NSMutableDictionary *opInfo = ephemeralInfo[uuid];
if (opInfo == nil)
@ -421,6 +463,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
{
opInfo[YDBCloudCore_EphemeralKey_Status] = @(status);
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -443,6 +487,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
__block NSDate *hold = nil;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
NSMutableDictionary *opInfo = ephemeralInfo[opUUID];
if (opInfo)
@ -451,6 +497,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
status = opInfo[YDBCloudCore_EphemeralKey_Status];
hold = opInfo[YDBCloudCore_EphemeralKey_Hold];
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -505,11 +553,16 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
{
if (opUUID == nil) return;
__weak YapDatabaseCloudCorePipeline *weakSelf = self;
dispatch_block_t block = ^{ @autoreleasepool {
if ([self _setStatus:YDBCloudOperationStatus_Started forOperationUUID:opUUID])
__strong YapDatabaseCloudCorePipeline *strongSelf = weakSelf;
if (strongSelf == nil) return;
if ([strongSelf _setStatus:YDBCloudOperationStatus_Started forOperationUUID:opUUID])
{
[startedOpUUIDs addObject:opUUID];
[strongSelf->startedOpUUIDs addObject:opUUID];
}
}};
@ -528,13 +581,18 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
{
if (opUUID == nil) return;
__weak YapDatabaseCloudCorePipeline *weakSelf = self;
dispatch_block_t block = ^{ @autoreleasepool {
BOOL changed = [self _setStatus:YDBCloudOperationStatus_Pending forOperationUUID:opUUID];
__strong YapDatabaseCloudCorePipeline *strongSelf = weakSelf;
if (strongSelf == nil) return;
BOOL changed = [strongSelf _setStatus:YDBCloudOperationStatus_Pending forOperationUUID:opUUID];
if (changed)
{
[startedOpUUIDs removeObject:opUUID];
[self startNextOperationIfPossible];
[strongSelf->startedOpUUIDs removeObject:opUUID];
[strongSelf startNextOperationIfPossible];
}
}};
@ -555,21 +613,27 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
retryDelay:(NSTimeInterval)delay
{
NSDate *hold = nil;
if (delay > 0.0)
if (delay > 0.0) {
hold = [NSDate dateWithTimeIntervalSinceNow:delay];
}
__weak YapDatabaseCloudCorePipeline *weakSelf = self;
dispatch_block_t block = ^{ @autoreleasepool {
BOOL changed = [self _setStatus:YDBCloudOperationStatus_Pending forOperationUUID:opUUID];
__strong YapDatabaseCloudCorePipeline *strongSelf = weakSelf;
if (strongSelf == nil) return;
BOOL changed = [strongSelf _setStatus:YDBCloudOperationStatus_Pending forOperationUUID:opUUID];
if (changed)
{
[self _setEphemeralInfo:hold
forKey:YDBCloudCore_EphemeralKey_Hold
operationUUID:opUUID];
[strongSelf _setEphemeralInfo:hold
forKey:YDBCloudCore_EphemeralKey_Hold
operationUUID:opUUID];
[startedOpUUIDs removeObject:opUUID];
[self updateHoldTimer];
[self startNextOperationIfPossible];
[strongSelf->startedOpUUIDs removeObject:opUUID];
[strongSelf updateHoldTimer];
[strongSelf startNextOperationIfPossible];
}
}};
@ -889,8 +953,12 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
__block BOOL status = NO;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
status = isActive;
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -982,17 +1050,22 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
{
YDBLogAutoTrace();
__weak YapDatabaseCloudCorePipeline *weakSelf = self;
dispatch_block_t block = ^{ @autoreleasepool {
__strong YapDatabaseCloudCorePipeline *strongSelf = weakSelf;
if (strongSelf == nil) return;
for (YapDatabaseCloudCoreGraph *graph in inGraphs)
{
graph.pipeline = self;
}
[graphs addObjectsFromArray:inGraphs];
[strongSelf->graphs addObjectsFromArray:inGraphs];
if (graphs.count > 0) {
[self startNextOperationIfPossible];
if (strongSelf->graphs.count > 0) {
[strongSelf startNextOperationIfPossible];
}
}};
@ -1009,6 +1082,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
YDBLogAutoTrace();
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (graph)
{
@ -1073,6 +1148,8 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
// Notify listeners that the operation list in the queue changed.
[self postQueueChangedNotification];
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -1097,14 +1174,19 @@ NSString *const YDBCloudCore_EphemeralKey_Hold = @"hold";
int const flagOn = 1;
BOOL didSetFlagOn = OSAtomicCompareAndSwapInt(flagOff, flagOn, &needsStartNextOperationFlag);
if (didSetFlagOn)
{
__weak YapDatabaseCloudCorePipeline *weakSelf = self;
dispatch_async(queue, ^{ @autoreleasepool {
OSAtomicCompareAndSwapInt(flagOn, flagOff, &needsStartNextOperationFlag);
[self startNextOperationIfPossible];
__strong YapDatabaseCloudCorePipeline *strongSelf = weakSelf;
if (strongSelf)
{
OSAtomicCompareAndSwapInt(flagOn, flagOff, &strongSelf->needsStartNextOperationFlag);
[strongSelf startNextOperationIfPossible];
}
}});
}
}

View File

@ -152,6 +152,7 @@
/**
* Compares the receiver with the given operation.
* Subclasses should override this method, and add their own comparisons.
**/
- (BOOL)isEqualToOperation:(YapDatabaseCloudCoreOperation *)operation;

View File

@ -241,7 +241,7 @@ NSString *const YDBCloudCoreOperationIsReadyToStartNotification = @"YDBCloudCore
- (BOOL)pendingStatusIsSkippedOrCompleted
{
if (pendingStatus)
if (pendingStatus != nil)
{
YDBCloudCoreOperationStatus status = (YDBCloudCoreOperationStatus)[pendingStatus integerValue];
@ -255,7 +255,7 @@ NSString *const YDBCloudCoreOperationIsReadyToStartNotification = @"YDBCloudCore
- (BOOL)pendingStatusIsCompleted
{
if (pendingStatus)
if (pendingStatus != nil)
return ([pendingStatus integerValue] == YDBCloudOperationStatus_Completed);
else
return NO;
@ -263,7 +263,7 @@ NSString *const YDBCloudCoreOperationIsReadyToStartNotification = @"YDBCloudCore
- (BOOL)pendingStatusIsSkipped
{
if (pendingStatus)
if (pendingStatus != nil)
return ([pendingStatus integerValue] == YDBCloudOperationStatus_Skipped);
else
return NO;

View File

@ -4,6 +4,8 @@
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/**
* A many-to-many cache has the following features:
*
@ -89,7 +91,7 @@
* And then the key/value tuple is moved to the beginning of the most-recently-used linked-list.
**/
- (void)insertKey:(id)key value:(id)value;
- (void)insertKey:(id)key value:(id)value metadata:(id)metadata;
- (void)insertKey:(id)key value:(id)value metadata:(nullable id)metadata;
/**
* Returns whether or not the cache contains the key/value tuple.
@ -107,7 +109,7 @@
*
* If the key/value tuple exists, it's moved to the beginning of the most-recently-used linked-list.
**/
- (id)metadataForKey:(id)key value:(id)value;
- (nullable id)metadataForKey:(id)key value:(id)value;
/**
* Returns YES if the given key or value has 1 or more entries in the cache.
@ -128,15 +130,15 @@
*
* All key/value tuples accessed during enumeration are moved to the beginning of the most-recently-used linked-list.
**/
- (void)enumerateValuesForKey:(id)key withBlock:(void (^)(id value, id metadata, BOOL *stop))block;
- (void)enumerateKeysForValue:(id)value withBlock:(void (^)(id value, id metadata, BOOL *stop))block;
- (void)enumerateValuesForKey:(id)key withBlock:(void (^)(id value, __nullable id metadata, BOOL *stop))block;
- (void)enumerateKeysForValue:(id)value withBlock:(void (^)(id value, __nullable id metadata, BOOL *stop))block;
/**
* Enumerates all key/value pairs in the cache.
*
* As this method is designed to enumerate all values, it ddes not affect the most-recently-used linked-list.
**/
- (void)enumerateWithBlock:(void (^)(id key, id value, id metadata, BOOL *stop))block;
- (void)enumerateWithBlock:(void (^)(id key, id value, __nullable id metadata, BOOL *stop))block;
/**
* Removes the tuple that matches the given key/value pair.
@ -161,3 +163,5 @@
- (void)debug;
@end
NS_ASSUME_NONNULL_END

View File

@ -276,6 +276,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
__block YapDatabaseCloudCorePipeline *pipeline = nil;
dispatch_block_t block = ^{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
pipeline = pipelines[name];
@ -287,6 +289,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
pipeline = pipelines[alias];
}
}
#pragma clang diagnostic pop
};
if (dispatch_get_specific(IsOnQueueKey))
@ -316,6 +320,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
__block BOOL result = YES;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (pipelines[pipeline.name] != nil)
{
@ -342,6 +348,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
if (suspendCount > 0) {
[pipeline suspendWithCount:suspendCount];
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -360,8 +368,12 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
__block NSArray *allPipelines = nil;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
allPipelines = [pipelines allValues];
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -380,8 +392,12 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
__block NSArray *allPipelineNames = nil;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
allPipelineNames = [pipelines allKeys];
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -401,8 +417,12 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
__block NSArray *allNames = nil;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
allNames = [pipelines allKeys];
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -430,7 +450,12 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
__block NSUInteger result = 0;
dispatch_block_t block = ^{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
result = suspendCount;
#pragma clang diagnostic pop
};
if (dispatch_get_specific(IsOnQueueKey))
@ -451,6 +476,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
__block NSUInteger newSuspendCount = 0;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (suspendCount <= (NSUIntegerMax - suspendCountIncrement))
suspendCount += suspendCountIncrement;
@ -464,6 +491,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
{
[pipeline suspendWithCount:suspendCountIncrement];
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -479,7 +508,9 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
__block NSUInteger newSuspendCount = 0;
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (suspendCount > 0) {
suspendCount--;
}
@ -490,6 +521,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
{
[pipeline resume];
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -513,6 +546,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
YDBLogAutoTrace();
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
[rowidsToPipelineName enumerateKeysAndObjectsUsingBlock:^(NSNumber *rowid, NSString *pipelineName, BOOL *stop){
@ -522,6 +557,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
pipeline.rowid = [rowid longLongValue];
}
}];
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -538,6 +575,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
YDBLogAutoTrace();
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
[sortedGraphsPerPipeline enumerateKeysAndObjectsUsingBlock:
^(NSString *pipelineName, NSArray *sortedGraphs, BOOL *stop)
@ -548,6 +587,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
[pipeline restoreGraphs:sortedGraphs];
}
}];
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -573,6 +614,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
}
dispatch_block_t block = ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
for (YapDatabaseCloudCorePipeline *pipeline in [pipelines objectEnumerator])
{
@ -583,6 +626,8 @@ withRegisteredExtensions:(NSDictionary __unused *)registeredExtensions
insertedOperations:insertedForPipeline
modifiedOperations:modifiedOperations];
}
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))

View File

@ -318,11 +318,15 @@
else
{
[modifiedMappings enumerateWithBlock:^(NSNumber *rowid, NSString *path, id metadata, BOOL *stop) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (metadata == YDBCloudCore_DiryMappingMetadata_NeedsRemove)
{
[cleanMappingCache removeItemWithKey:rowid value:path];
}
#pragma clang diagnostic pop
}];
}

View File

@ -110,6 +110,18 @@
**/
- (YapDatabaseCloudCoreOperation *)operationWithUUID:(NSUUID *)uuid inPipeline:(NSString *)pipelineName;
/**
* Fetches the graph index that corresponds to newly added operations.
* That is, operations that are added during this commit (read-write transaction).
*
* This may be useful if you need to find and modify operations added during the current read/write transaction.
*
* @return
* The index of the graph that will contain newly added operations from this commit.
* Or NSNotFound if the pipeline isn't found.
**/
- (NSUInteger)graphForAddedOperationsInPipeline:(NSString *)pipelineName;
/**
* @param operation
* The operation to search for.
@ -158,6 +170,25 @@
usingBlock:(void (^)(YapDatabaseCloudCoreOperation *operation,
NSUInteger graphIdx, BOOL *stop))enumBlock;
/**
* Enumerates only those operations that have been added during this commit.
*
* That is, the operations added via the `addOperation:` method,
* within the current readWriteTransaction.
**/
- (void)enumerateAddedOperationsUsingBlock:(void (^)(YapDatabaseCloudCorePipeline *pipeline,
YapDatabaseCloudCoreOperation *operation,
NSUInteger graphIdx, BOOL *stop))enumBlock;
/**
* Enumerates only those operations that have been added during this commit.
*
* That is, the operations added via the `addOperation:` method,
* within the current readWriteTransaction.
**/
- (void)enumerateAddedOperationsInPipeline:(NSString *)pipeline
usingBlock:(void (^)(YapDatabaseCloudCoreOperation *operation,
NSUInteger graphIdx, BOOL *stop))enumBlock;
#pragma mark Tag Support
/**

View File

@ -2402,6 +2402,26 @@ static NSString *const ext_key_versionTag = @"versionTag";
return matchedOp;
}
/**
* Fetches the graph index that corresponds to newly added operations.
* That is, operations that are added during this commit (read-write transaction).
*
* This may be useful if you need to find and modify operations added during the current read/write transaction.
*
* @return
* The index of the graph that will contain newly added operations from this commit.
* Or NSNotFound if the pipeline isn't found.
**/
- (NSUInteger)graphForAddedOperationsInPipeline:(NSString *)pipelineName
{
YapDatabaseCloudCorePipeline *pipeline = [parentConnection->parent pipelineWithName:pipelineName];
if (pipeline)
return pipeline.graphCount;
else
return NSNotFound;
}
/**
* @param operation
* The operation to search for.
@ -2506,6 +2526,49 @@ static NSString *const ext_key_versionTag = @"versionTag";
}];
}
/**
* Public API
**/
- (void)enumerateAddedOperationsUsingBlock:(void (^)(YapDatabaseCloudCorePipeline *pipeline,
YapDatabaseCloudCoreOperation *operation,
NSUInteger graphIdx, BOOL *stop))enumBlock
{
if (enumBlock == nil) return;
if (databaseTransaction->isReadWriteTransaction == NO) return;
[self _enumerateAndModifyOperations:YDBCloudCore_EnumOps_Added
usingBlock:
^YapDatabaseCloudCoreOperation *(YapDatabaseCloudCorePipeline *pipeline,
YapDatabaseCloudCoreOperation *operation,
NSUInteger graphIdx, BOOL *stop)
{
enumBlock(pipeline, [operation copy], graphIdx, stop);
return nil;
}];
}
/**
* Public API
**/
- (void)enumerateAddedOperationsInPipeline:(NSString *)pipelineName
usingBlock:(void (^)(YapDatabaseCloudCoreOperation *operation,
NSUInteger graphIdx, BOOL *stop))enumBlock
{
if (enumBlock == nil) return;
if (databaseTransaction->isReadWriteTransaction == NO) return;
YapDatabaseCloudCorePipeline *pipeline = [parentConnection->parent pipelineWithName:pipelineName];
[self _enumerateAndModifyOperations:YDBCloudCore_EnumOps_All
inPipeline:pipeline
usingBlock:
^YapDatabaseCloudCoreOperation *(YapDatabaseCloudCoreOperation *operation, NSUInteger graphIdx, BOOL *stop)
{
enumBlock([operation copy], graphIdx, stop);
return nil;
}];
}
/**
* Internal enumerate method.
*
@ -2640,33 +2703,52 @@ static NSString *const ext_key_versionTag = @"versionTag";
if (enumBlock == nil) return;
__block BOOL stop = NO;
__block BOOL pipelineHasOps = NO;
__block NSUInteger lastGraphIdx = 0;
[pipeline _enumerateOperationsUsingBlock:
^(YapDatabaseCloudCoreOperation *queuedOp, NSUInteger graphIdx, BOOL *innerStop)
NSArray<NSArray<YapDatabaseCloudCoreOperation *> *> *graphOperations = pipeline.graphOperations;
[graphOperations enumerateObjectsUsingBlock:
^(NSArray<YapDatabaseCloudCoreOperation *> *operations, NSUInteger idx, BOOL *innerStop)
{
pipelineHasOps = YES;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (lastGraphIdx != graphIdx)
if (flags & YDBCloudCore_EnumOps_Existing)
{
if (flags & YDBCloudCore_EnumOps_Inserted)
for (YapDatabaseCloudCoreOperation *queuedOp in operations)
{
NSDictionary *insertedGraphs = parentConnection->operations_inserted[pipeline.name];
NSMutableArray<YapDatabaseCloudCoreOperation *> *insertedOps = insertedGraphs[@(lastGraphIdx)];
for (NSUInteger i = 0; i < insertedOps.count; i++)
YapDatabaseCloudCoreOperation *modifiedOp = parentConnection->operations_modified[queuedOp.uuid];
if (modifiedOp)
modifiedOp = enumBlock(modifiedOp, idx, &stop);
else
modifiedOp = enumBlock(queuedOp, idx, &stop);
if (modifiedOp)
{
YapDatabaseCloudCoreOperation *op = insertedOps[i];
YapDatabaseCloudCoreOperation *modifiedOp = enumBlock(op, lastGraphIdx, &stop);
if (modifiedOp)
{
insertedOps[i] = modifiedOp;
}
if (stop) break;
parentConnection->operations_modified[modifiedOp.uuid] = modifiedOp;
}
if (stop) {
*innerStop = YES;
return;
}
}
}
if (flags & YDBCloudCore_EnumOps_Inserted)
{
NSDictionary *insertedGraphs = parentConnection->operations_inserted[pipeline.name];
NSMutableArray<YapDatabaseCloudCoreOperation *> *insertedOps = insertedGraphs[@(idx)];
for (NSUInteger i = 0; i < insertedOps.count; i++)
{
YapDatabaseCloudCoreOperation *op = insertedOps[i];
YapDatabaseCloudCoreOperation *modifiedOp = enumBlock(op, idx, &stop);
if (modifiedOp)
{
insertedOps[i] = modifiedOp;
}
if (stop) {
@ -2674,31 +2756,15 @@ static NSString *const ext_key_versionTag = @"versionTag";
return;
}
}
lastGraphIdx = graphIdx;
}
if (flags & YDBCloudCore_EnumOps_Existing)
{
YapDatabaseCloudCoreOperation *modifiedOp = parentConnection->operations_modified[queuedOp.uuid];
if (modifiedOp)
modifiedOp = enumBlock(modifiedOp, graphIdx, &stop);
else
modifiedOp = enumBlock(queuedOp, graphIdx, &stop);
if (modifiedOp)
{
parentConnection->operations_modified[modifiedOp.uuid] = modifiedOp;
}
if (stop) *innerStop = YES;
}
#pragma clang diagnostic pop
}];
if (!stop && (flags & YDBCloudCore_EnumOps_Added))
{
NSUInteger nextGraphIdx = pipelineHasOps ? (lastGraphIdx + 1) : 0;
NSUInteger lastGraphIdx = graphOperations.count;
NSUInteger nextGraphIdx = (lastGraphIdx == 0) ? 0 : (lastGraphIdx + 1);
NSMutableArray<YapDatabaseCloudCoreOperation *> *addedOps =
parentConnection->operations_added[pipeline.name];
@ -3323,18 +3389,23 @@ static NSString *const ext_key_versionTag = @"versionTag";
[parentConnection->operations_added enumerateKeysAndObjectsUsingBlock:
^(NSString *pipelineName, NSArray *allAddedOperationsForPipeline, BOOL *stop)
{
YapDatabaseCloudCorePipeline *pipeline = [parentConnection->parent pipelineWithName:pipelineName];
NSUInteger graphIdx = pipeline.graphCount;
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
YapDatabaseCloudCorePipeline *pipeline = [parentConnection->parent pipelineWithName:pipelineName];
NSUInteger graphIdx = pipeline.graphCount;
NSArray *processedOperationsForPipeline =
[self processOperations:allAddedOperationsForPipeline inPipeline:pipeline withGraphIdx:graphIdx];
if (processedOperationsForPipeline.count > 0)
{
processedAddedOps[pipelineName] = processedOperationsForPipeline;
}
}];
NSArray *processedOperationsForPipeline =
[self processOperations:allAddedOperationsForPipeline inPipeline:pipeline withGraphIdx:graphIdx];
if (processedOperationsForPipeline.count > 0)
{
processedAddedOps[pipelineName] = processedOperationsForPipeline;
}
#pragma clang diagnostic pop
}];
}
// Step 3 of 5:
@ -3344,6 +3415,9 @@ static NSString *const ext_key_versionTag = @"versionTag";
[processedAddedOps enumerateKeysAndObjectsUsingBlock:
^(NSString *pipelineName, NSArray *operations, BOOL *stop)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
YapDatabaseCloudCorePipeline *pipeline = [parentConnection->parent pipelineWithName:pipelineName];
uint64_t nextGraphID = [pipeline nextGraphID];
@ -3355,6 +3429,8 @@ static NSString *const ext_key_versionTag = @"versionTag";
[[YapDatabaseCloudCoreGraph alloc] initWithPersistentOrder:nextGraphID operations:operations];
[parentConnection->graphs_added setObject:graph forKey:pipelineName];
#pragma clang diagnostic pop
}];
for (YapDatabaseCloudCorePipeline *pipeline in pipelines)
@ -3398,7 +3474,7 @@ static NSString *const ext_key_versionTag = @"versionTag";
{
[self mappingTable_insertRowWithRowid:[rowid unsignedLongLongValue] cloudURI:cloudURI];
[parentConnection->cleanMappingCache insertKey:rowid value:cloudURI];
[self->parentConnection->cleanMappingCache insertKey:rowid value:cloudURI];
}
else if (metadata == YDBCloudCore_DiryMappingMetadata_NeedsRemove)
{
@ -3429,7 +3505,7 @@ static NSString *const ext_key_versionTag = @"versionTag";
{
[self tagTable_insertOrUpdateRowWithKey:key identifier:identifier tag:tag];
[parentConnection->tagCache setObject:tag forKey:tuple];
[self->parentConnection->tagCache setObject:tag forKey:tuple];
}
}];
}

View File

@ -132,10 +132,10 @@
[inOriginalValues enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
if ([originalValues objectForKey:key] == nil)
if ([self->originalValues objectForKey:key] == nil)
{
if (newOriginalValues == nil)
newOriginalValues = [originalValues mutableCopy];
newOriginalValues = [self->originalValues mutableCopy];
[newOriginalValues setObject:obj forKey:key];
}

View File

@ -53,9 +53,9 @@
{
[newerOriginalValues enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
if ([originalValues objectForKey:key] == nil)
if ([self->originalValues objectForKey:key] == nil)
{
[originalValues setObject:obj forKey:key];
[self->originalValues setObject:obj forKey:key];
}
}];
}

View File

@ -479,63 +479,70 @@ NSString *const YapDatabaseCloudKitInFlightChangeSetChangedNotification = @"YDBC
{
YDBLogAutoTrace();
// The 'forceNotification' parameter will be YES when this method
// is being called after successfully completing a previous operation.
__weak YapDatabaseCloudKit *weakSelf = self;
dispatch_queue_t bgQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
dispatch_async(bgQueue, ^{ @autoreleasepool {
if (self.isSuspended) // this method is thread-safe
{
YDBLogVerbose(@"Skipping dispatch operation - suspended");
if (forceNotification) {
[self postInFlightChangeSetChangedNotification:[masterQueue currentChangeSetUUID]];
}
return;
}
BOOL isAlreadyInFlight = NO;
YDBCKChangeSet *nextChangeSet = nil;
nextChangeSet = [masterQueue makeInFlightChangeSet:&isAlreadyInFlight]; // this method is thread-safe
if (nextChangeSet == nil)
{
if (isAlreadyInFlight) { // <- { brackets } required when YapDatabaseLoggingTechnique_Disabled
YDBLogVerbose(@"Skipping dispatch operation - upload in progress");
}
else {
YDBLogVerbose(@"Skipping dispatch operation - nothing to upload");
}
if (forceNotification) {
[self postInFlightChangeSetChangedNotification:[masterQueue currentChangeSetUUID]];
}
return;
}
if ([nextChangeSet->deletedRecordIDs count] == 0 &&
[nextChangeSet->modifiedRecords count] == 0)
{
YDBLogVerbose(@"Dropping empty queued operation: %@", nextChangeSet);
NSString *changeSetUUID = nextChangeSet.uuid;
[self handleCompletedOperationWithChangeSet:nextChangeSet savedRecords:nil deletedRecordIDs:nil];
[self postInFlightChangeSetChangedNotification:changeSetUUID];
}
else
{
YDBLogVerbose(@"Queueing operation: %@", nextChangeSet);
NSString *changeSetUUID = nextChangeSet.uuid;
[self queueOperationForChangeSet:nextChangeSet];
[self postInFlightChangeSetChangedNotification:changeSetUUID];
}
__strong YapDatabaseCloudKit *strongSelf = weakSelf;
[strongSelf maybeDispatchNextOperation:forceNotification];
}});
}
- (void)maybeDispatchNextOperation:(BOOL)forceNotification
{
// The 'forceNotification' parameter will be YES when this method
// is being called after successfully completing a previous operation.
if (self.isSuspended) // this method is thread-safe
{
YDBLogVerbose(@"Skipping dispatch operation - suspended");
if (forceNotification) {
[self postInFlightChangeSetChangedNotification:[masterQueue currentChangeSetUUID]];
}
return;
}
BOOL isAlreadyInFlight = NO;
YDBCKChangeSet *nextChangeSet = nil;
nextChangeSet = [masterQueue makeInFlightChangeSet:&isAlreadyInFlight]; // this method is thread-safe
if (nextChangeSet == nil)
{
if (isAlreadyInFlight) { // <- { brackets } required when YapDatabaseLoggingTechnique_Disabled
YDBLogVerbose(@"Skipping dispatch operation - upload in progress");
}
else {
YDBLogVerbose(@"Skipping dispatch operation - nothing to upload");
}
if (forceNotification) {
[self postInFlightChangeSetChangedNotification:[masterQueue currentChangeSetUUID]];
}
return;
}
if ([nextChangeSet->deletedRecordIDs count] == 0 &&
[nextChangeSet->modifiedRecords count] == 0)
{
YDBLogVerbose(@"Dropping empty queued operation: %@", nextChangeSet);
NSString *changeSetUUID = nextChangeSet.uuid;
[self handleCompletedOperationWithChangeSet:nextChangeSet savedRecords:nil deletedRecordIDs:nil];
[self postInFlightChangeSetChangedNotification:changeSetUUID];
}
else
{
YDBLogVerbose(@"Queueing operation: %@", nextChangeSet);
NSString *changeSetUUID = nextChangeSet.uuid;
[self queueOperationForChangeSet:nextChangeSet];
[self postInFlightChangeSetChangedNotification:changeSetUUID];
}
}
- (YapDatabaseConnection *)completionDatabaseConnection
{
@ -677,8 +684,12 @@ NSString *const YapDatabaseCloudKitInFlightChangeSetChangedNotification = @"YDBC
NSString *databaseIdentifier = changeSet.databaseIdentifier;
dispatch_async(dispatch_get_main_queue(), ^{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
opErrorBlock(databaseIdentifier, operationError);
#pragma clang diagnostic pop
});
}
@ -741,10 +752,13 @@ NSString *const YapDatabaseCloudKitInFlightChangeSetChangedNotification = @"YDBC
deletedRecordIDs:success_deletedRecordIDs];
} completionBlock:^{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
// Inform the user about the problem via the operationErrorBlock.
opErrorBlock(databaseIdentifier, operationError);
#pragma clang diagnostic pop
}];
}

View File

@ -472,12 +472,16 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
(YapDatabaseCloudKitRecordWithKeyBlock)recordHandler->block;
RestoreRecordBlock = ^(int64_t rowid, CKRecord **inOutRecord, YDBCKRecordInfo *recordInfo) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
if (ck)
{
recordBlock(databaseTransaction, inOutRecord, recordInfo, ck.collection, ck.key);
}
#pragma clang diagnostic pop
};
}
else if (recordHandler->blockType == YapDatabaseBlockTypeWithObject)
@ -486,6 +490,8 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
(YapDatabaseCloudKitRecordWithObjectBlock)recordHandler->block;
RestoreRecordBlock = ^(int64_t rowid, CKRecord **inOutRecord, YDBCKRecordInfo *recordInfo) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
YapCollectionKey *ck = nil;
id object = nil;
@ -494,6 +500,8 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
{
recordBlock(databaseTransaction, inOutRecord, recordInfo, ck.collection, ck.key, object);
}
#pragma clang diagnostic pop
};
}
else if (recordHandler->blockType == YapDatabaseBlockTypeWithMetadata)
@ -502,6 +510,8 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
(YapDatabaseCloudKitRecordWithMetadataBlock)recordHandler->block;
RestoreRecordBlock = ^(int64_t rowid, CKRecord **inOutRecord, YDBCKRecordInfo *recordInfo) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
YapCollectionKey *ck = nil;
id metadata = nil;
@ -510,6 +520,8 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
{
recordBlock(databaseTransaction, inOutRecord, recordInfo, ck.collection, ck.key, metadata);
}
#pragma clang diagnostic pop
};
}
else // if (recordHandler->blockType == YapDatabaseBlockTypeWithRow)
@ -518,6 +530,8 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
(YapDatabaseCloudKitRecordWithRowBlock)recordHandler->block;
RestoreRecordBlock = ^(int64_t rowid, CKRecord **inOutRecord, YDBCKRecordInfo *recordInfo) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
YapCollectionKey *ck = nil;
id object = nil;
@ -527,6 +541,8 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
{
recordBlock(databaseTransaction, inOutRecord, recordInfo, ck.collection, ck.key, object, metadata);
}
#pragma clang diagnostic pop
};
}
@ -576,6 +592,8 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
void (^InsertRecord)(CKRecord*, YDBCKRecordInfo*, int64_t);
InsertRecord = ^(CKRecord *record, YDBCKRecordInfo *recordInfo, int64_t rowid) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
NSString *databaseIdentifier = recordInfo.databaseIdentifier;
NSString *hash = [self hashRecordID:record.recordID databaseIdentifier:databaseIdentifier];
@ -615,6 +633,8 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
[dirtyRecordTableInfo incrementOwnerCount];
[dirtyRecordTableInfo mergeOriginalValues:recordInfo.originalValues];
}
#pragma clang diagnostic pop
};
YDBCKRecordInfo *recordInfo = [[YDBCKRecordInfo alloc] init];
@ -636,7 +656,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
recordInfo.databaseIdentifier = nil;
recordInfo.originalValues = nil;
recordBlock(databaseTransaction, &record, recordInfo, collection, key);
recordBlock(self->databaseTransaction, &record, recordInfo, collection, key);
if (record) {
InsertRecord(record, recordInfo, rowid);
@ -649,7 +669,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
if ([allowedCollections isAllowed:collection])
{
[databaseTransaction _enumerateKeysInCollections:@[ collection ] usingBlock:enumBlock];
[self->databaseTransaction _enumerateKeysInCollections:@[ collection ] usingBlock:enumBlock];
}
}];
}
@ -670,7 +690,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
recordInfo.databaseIdentifier = nil;
recordInfo.originalValues = nil;
recordBlock(databaseTransaction, &record, recordInfo, collection, key, object);
recordBlock(self->databaseTransaction, &record, recordInfo, collection, key, object);
if (record) {
InsertRecord(record, recordInfo, rowid);
@ -683,7 +703,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
if ([allowedCollections isAllowed:collection])
{
[databaseTransaction _enumerateKeysAndObjectsInCollections:@[ collection ] usingBlock:enumBlock];
[self->databaseTransaction _enumerateKeysAndObjectsInCollections:@[ collection ] usingBlock:enumBlock];
}
}];
}
@ -704,7 +724,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
recordInfo.databaseIdentifier = nil;
recordInfo.originalValues = nil;
recordBlock(databaseTransaction, &record, recordInfo, collection, key, metadata);
recordBlock(self->databaseTransaction, &record, recordInfo, collection, key, metadata);
if (record) {
InsertRecord(record, recordInfo, rowid);
@ -717,7 +737,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
if ([allowedCollections isAllowed:collection])
{
[databaseTransaction _enumerateKeysAndMetadataInCollections:@[ collection ] usingBlock:enumBlock];
[self->databaseTransaction _enumerateKeysAndMetadataInCollections:@[ collection ] usingBlock:enumBlock];
}
}];
}
@ -738,7 +758,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
recordInfo.databaseIdentifier = nil;
recordInfo.originalValues = nil;
recordBlock(databaseTransaction, &record, recordInfo, collection, key, object, metadata);
recordBlock(self->databaseTransaction, &record, recordInfo, collection, key, object, metadata);
if (record) {
InsertRecord(record, recordInfo, rowid);
@ -751,7 +771,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
if ([allowedCollections isAllowed:collection])
{
[databaseTransaction _enumerateRowsInCollections:@[ collection ] usingBlock:enumBlock];
[self->databaseTransaction _enumerateRowsInCollections:@[ collection ] usingBlock:enumBlock];
}
}];
}
@ -816,7 +836,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
enumBlock = ^(int64_t rowid, NSString *collection, NSString *key, BOOL *stop) {
enumHelperBlock(rowid);
recordBlock(databaseTransaction, &record, recordInfo, collection, key);
recordBlock(self->databaseTransaction, &record, recordInfo, collection, key);
[self processRecord:record recordInfo:recordInfo
preCalculatedHash:nil
@ -832,7 +852,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
if ([allowedCollections isAllowed:collection])
{
[databaseTransaction _enumerateKeysInCollections:@[ collection ] usingBlock:enumBlock];
[self->databaseTransaction _enumerateKeysInCollections:@[ collection ] usingBlock:enumBlock];
}
}];
}
@ -850,7 +870,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
enumBlock = ^(int64_t rowid, NSString *collection, NSString *key, id object, BOOL *stop) {
enumHelperBlock(rowid);
recordBlock(databaseTransaction, &record, recordInfo, collection, key, object);
recordBlock(self->databaseTransaction, &record, recordInfo, collection, key, object);
[self processRecord:record recordInfo:recordInfo
preCalculatedHash:nil
@ -866,7 +886,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
if ([allowedCollections isAllowed:collection])
{
[databaseTransaction _enumerateKeysAndObjectsInCollections:@[ collection ] usingBlock:enumBlock];
[self->databaseTransaction _enumerateKeysAndObjectsInCollections:@[ collection ] usingBlock:enumBlock];
}
}];
}
@ -884,7 +904,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
enumBlock = ^(int64_t rowid, NSString *collection, NSString *key, id metadata, BOOL *stop) {
enumHelperBlock(rowid);
recordBlock(databaseTransaction, &record, recordInfo, collection, key, metadata);
recordBlock(self->databaseTransaction, &record, recordInfo, collection, key, metadata);
[self processRecord:record recordInfo:recordInfo
preCalculatedHash:nil
@ -900,7 +920,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
if ([allowedCollections isAllowed:collection])
{
[databaseTransaction _enumerateKeysAndMetadataInCollections:@[ collection ] usingBlock:enumBlock];
[self->databaseTransaction _enumerateKeysAndMetadataInCollections:@[ collection ] usingBlock:enumBlock];
}
}];
}
@ -918,7 +938,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
enumBlock = ^(int64_t rowid, NSString *collection, NSString *key, id object, id metadata, BOOL *stop) {
enumHelperBlock(rowid);
recordBlock(databaseTransaction, &record, recordInfo, collection, key, object, metadata);
recordBlock(self->databaseTransaction, &record, recordInfo, collection, key, object, metadata);
[self processRecord:record recordInfo:recordInfo
preCalculatedHash:nil
@ -934,7 +954,7 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
if ([allowedCollections isAllowed:collection])
{
[databaseTransaction _enumerateRowsInCollections:@[ collection ] usingBlock:enumBlock];
[self->databaseTransaction _enumerateRowsInCollections:@[ collection ] usingBlock:enumBlock];
}
}];
}
@ -2898,6 +2918,8 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
// Update mapping table.
[parentConnection->dirtyMappingTableInfoDict enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
__unsafe_unretained NSNumber *rowidNumber = (NSNumber *)key;
__unsafe_unretained YDBCKDirtyMappingTableInfo *dirtyMappingTableInfo = (YDBCKDirtyMappingTableInfo *)obj;
@ -2923,6 +2945,8 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
[parentConnection->changeset_mappingTableInfo setObject:cleanMappingTableInfo forKey:rowidNumber];
[parentConnection->cleanMappingTableInfoCache setObject:cleanMappingTableInfo forKey:rowidNumber];
}
#pragma clang diagnostic pop
}];
// Step 2 of 6:
@ -2930,6 +2954,8 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
// Update record table.
[parentConnection->dirtyRecordTableInfoDict enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
__unsafe_unretained NSString *hash = (NSString *)key;
__unsafe_unretained YDBCKDirtyRecordTableInfo *dirtyRecordTableInfo = (YDBCKDirtyRecordTableInfo *)obj;
@ -2985,6 +3011,8 @@ static BOOL ClassVersionsAreCompatible(int oldClassVersion, int newClassVersion)
[parentConnection->changeset_recordTableInfo setObject:cleanRecordTableInfo forKey:hash];
[parentConnection->cleanRecordTableInfoCache setObject:cleanRecordTableInfo forKey:hash];
}
#pragma clang diagnostic pop
}];
// Step 3 of 6:

View File

@ -0,0 +1,84 @@
#import <Foundation/Foundation.h>
#import "YapDatabase.h"
NS_ASSUME_NONNULL_BEGIN
/**
* The connection pool class was designed to help you optimize background read-only transactions.
* As a reminder:
*
* - You're encouraged to use a dedicated read-only connection for the main thread.
* https://github.com/yapstudios/YapDatabase/wiki/Performance-Primer#readonly_vs_readwrite_transactions
*
* - You're encouraged to share the dedicated read-only main-thread connection between your viewControllers:
* https://github.com/yapstudios/YapDatabase/wiki/Performance-Pro#sharing_the_ui_databaseconnection
*
* - You're encouraged to create a dedicated read-write connection for read-write transactions:
* (Because there can only be a single read-write transaction per database at any one time.)
* https://github.com/yapstudios/YapDatabase/wiki/Performance-Primer
*
* This leaves only non-main-thread read-only transactions. What's the recommendation for them?
* You could create a single read-only connection that will be shared by all background tasks.
* However, since all transactions are serialized via the shared connection,
* this implies that background task A may have to wait for background task B to finish its read-only transaction
* before background task A can execute its transaction.
* And for background tasks, this is likely not the intended result.
*
* The connection pool was designed to increase the performance in these scenarios.
* It will create connections on demand, up to (but not over) the connectionLimit.
* And it will vend connections using a simple load balancer that's based on the number of pending
* transactions that each connection has.
* (So you'll be handed the connection with the smallest queue of pending "work".)
*
* This allows for increased parallelization amongst your background tasks.
**/
@interface YapDatabaseConnectionPool : NSObject
/**
* Initializes a new connction pool with default configuration values.
* All database connections are created on demand, so you can configure the pool after initialization.
**/
- (instancetype)initWithDatabase:(YapDatabase *)database;
/**
* Specifies the maximum number of connections the pool is allowed to create.
* Connections are created on demand, so the limit may never be reached.
*
* You can update this property at anytime.
*
* The default value is 3.
* Zero is not a valid number, and will be treated as the default value.
**/
@property (atomic, assign, readwrite) NSUInteger connectionLimit;
/**
* By default, new database connections inherit their default configuration settings via
* YapDatabase.connectionDefaults, the same way that all connections do when one invokes [database newConnection].
* You may optionally configure an alternative set of defaults specifically for connections created via this pool.
*
* The default value for this property is nil,
* which means new database connections will inherit their configuration from YapDatabase.connectionDefaults.
**/
@property (atomic, strong, readwrite) YapDatabaseConnectionConfig *connectionDefaults;
/**
* Allows you to perform additional configuration on a newly created connection.
* This block is invoked BEFORE the connection is returned to the caller.
**/
@property (atomic, copy, readwrite) void(^didCreateNewConnectionBlock)(YapDatabaseConnection *newConnection);
/**
* Returns an existing connection from the pool, or creates a new connection, depending upon the pool's configuration,
* and the number of pending/active transactions for existing connections.
*
* - If there's an existing connection in the pool that doesn't have pending/active transactions,
* then that connection is returned.
* - Otherwise, if the connection count is below connectionCount, a new connection is created & returned.
* - Otherwise, an existing connection will be automatically chosen based on the number of pending/active transactions.
**/
- (YapDatabaseConnection *)connection;
@end
NS_ASSUME_NONNULL_END

View File

@ -0,0 +1,147 @@
#import "YapDatabaseConnectionPool.h"
#define DEFAULT_CONNECTION_LIMIT ((NSUInteger)3)
@implementation YapDatabaseConnectionPool {
YapDatabase *database;
dispatch_queue_t queue;
NSMutableArray<YapDatabaseConnection *> *connections;
NSUInteger connectionLimit;
YapDatabaseConnectionConfig *connectionDefaults;
}
@dynamic connectionLimit;
@dynamic connectionDefaults;
@synthesize didCreateNewConnectionBlock;
- (instancetype)initWithDatabase:(YapDatabase *)inDatabase
{
NSParameterAssert(inDatabase != nil);
if ((self = [super init]))
{
database = inDatabase;
queue = dispatch_queue_create("YapDatabaseConnectionPool", DISPATCH_QUEUE_SERIAL);
connections = [[NSMutableArray alloc] init];
connectionLimit = DEFAULT_CONNECTION_LIMIT;
}
return self;
}
- (NSUInteger)connectionLimit
{
__block NSUInteger result = 0;
dispatch_sync(queue, ^{
result = self->connectionLimit;
});
return result;
}
- (void)setConnectionLimit:(NSUInteger)limit
{
if (limit == 0) {
limit = DEFAULT_CONNECTION_LIMIT;
}
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
connectionLimit = limit;
while (connections.count > connectionLimit)
{
[connections removeLastObject];
}
#pragma clang diagnostic pop
}});
}
- (YapDatabaseConnectionConfig *)connectionDefaults
{
__block YapDatabaseConnectionConfig *result = nil;
dispatch_sync(queue, ^{
result = self->connectionDefaults;
});
return result;
}
- (void)setConnectionDefaults:(YapDatabaseConnectionConfig *)config
{
dispatch_sync(queue, ^{
self->connectionDefaults = config;
});
}
- (YapDatabaseConnection *)connection
{
__block YapDatabaseConnection *result = nil;
__block BOOL isNewConnection = NO;
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
uint64_t minLoad = 0;
for (YapDatabaseConnection *connection in connections)
{
uint64_t load = connection.pendingTransactionCount;
if (!result || load < minLoad)
{
result = connection;
minLoad = load;
}
if (minLoad == 0) {
// Found what we needed.
// We can stop looking now.
break;
}
}
BOOL createNewConnection = NO;
if (result == nil)
{
createNewConnection = YES;
}
else if (minLoad > 0)
{
if (connections.count < connectionLimit) {
createNewConnection = YES;
}
}
if (createNewConnection)
{
result = [database newConnection:connectionDefaults];
[connections addObject:result];
isNewConnection = YES;
}
#pragma clang diagnostic pop
}});
if (isNewConnection)
{
void (^block)(YapDatabaseConnection*) = self.didCreateNewConnectionBlock;
if (block) { @autoreleasepool {
block(result);
}}
}
return result;
}
@end

View File

@ -194,35 +194,20 @@ NS_ASSUME_NONNULL_BEGIN
- (void)removeObjectsForKeys:(NSArray<NSString *> *)keys inCollection:(nullable NSString *)collection;
/**
* Immediately discards all changes that were queued to be written to the database.
* Thus any pending changes are not written to the database,
* and any currently queued readWriteTransaction is aborted.
* Tells the proxy to discard pending changes (if any) for the given <collection, key> tuple.
*
* This method is typically used if you intend to clear the database.
* For example:
*
* // blacklist everything - act as if db is empty
* YapWhitelistBlacklist *whitelist = [[YapWhitelistBlacklist alloc] initWithWhitelist:nil];
* [connectionProxy abortAndReset:whitelist];
*
* // Then actually clear the db - but asynchronously
* [connectionProxy.readWriteConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction){
*
* [transaction removeAllObjectsInAllCollections];
*
* } completionBlock:^{
*
* // allow the connectionProxy to start reading from the db again
* connectionProxy.fetchedCollectionsFilter = nil;
* }];
*
* @param fetchedCollectionsFilter
* This parameter allows you to instruct the connectionProxy to act as if
* the readOnlyConnection doesn't see any objects within certain collections.
*
* @see fetchedCollectionsFilter
* That is, IF the proxy has a pending change (for the tuple) that it intends to write to the database
* during the next flush, it will drop the pending change (and not write it to the database).
**/
- (void)abortAndReset:(nullable YapWhitelistBlacklist *)fetchedCollectionsFilter;
- (void)resetObjectForKey:(NSString *)key inCollection:(nullable NSString *)collection;
/**
* Tells the proxy to discard ALL pending changes.
*
* That is, IF the proxy has pending changes that it intends to write to the database
* during the next flush, it will instead drop all those pending changes (and not write any of them).
**/
- (void)reset;
/**
* The fetchedCollectionsFilter is useful when you need to delete one or more collections from the database.
@ -251,6 +236,27 @@ NS_ASSUME_NONNULL_BEGIN
**/
@property (atomic, strong, readwrite, nullable) YapWhitelistBlacklist *fetchedCollectionsFilter;
/**
* Replace with the following code:
*
* // blacklist everything - act as if db is empty
* YapWhitelistBlacklist *whitelist = [[YapWhitelistBlacklist alloc] initWithWhitelist:nil];
* connectionProxy.fetchedCollectionsFilter = whitelist;
* [connectionProxy reset];
*
* // Then actually clear the db - but asynchronously
* [databaseConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction){
*
* [transaction removeAllObjectsInAllCollections];
*
* } completionBlock:^{
*
* // allow the connectionProxy to start reading from the db again
* connectionProxy.fetchedCollectionsFilter = nil;
* }];
**/
- (void)abortAndReset:(nullable YapWhitelistBlacklist *)fetchedCollectionsFilter __attribute((deprecated));
@end
NS_ASSUME_NONNULL_END

View File

@ -49,9 +49,7 @@
NSMutableArray<NSMutableSet *> *pendingObjectBatches;
NSMutableArray<NSMutableSet *> *pendingMetadataBatches;
NSMutableArray<NSNumber *> *pendingBatchCommits;
uint64_t abortAndResetCount;
YapWhitelistBlacklist *fetchedCollectionsFilter;
}
@ -101,7 +99,6 @@
pendingObjectBatches = [[NSMutableArray alloc] initWithCapacity:4];
pendingMetadataBatches = [[NSMutableArray alloc] initWithCapacity:4];
pendingBatchCommits = [[NSMutableArray alloc] initWithCapacity:4];
if (inReadOnlyConnection)
{
@ -139,22 +136,17 @@
#pragma mark Batch Logic
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
- (void)queueBatchForCommit:(uint64_t)commit
withObjects:(NSMutableDictionary **)objectBatchPtr
metadata:(NSMutableDictionary **)metadataBatchPtr
- (void)queueBatchWithObjects:(NSMutableDictionary **)objectBatchPtr
metadata:(NSMutableDictionary **)metadataBatchPtr
{
YDBLogTrace(@"%@ %llu", THIS_METHOD, commit);
YDBLogAutoTrace();
__block NSMutableDictionary *objectBatch = nil;
__block NSMutableDictionary *metadataBatch = nil;
dispatch_sync(queue, ^{ @autoreleasepool {
if (abortAndResetCount > 0) // user asked to abort this write
{
abortAndResetCount--;
return;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
NSUInteger oCount = currentObjectBatch.count;
NSUInteger mCount = currentMetadataBatch.count;
@ -187,28 +179,24 @@
[pendingObjectBatches addObject:currentObjectBatch];
[pendingMetadataBatches addObject:currentMetadataBatch];
[pendingBatchCommits addObject:@(commit)];
currentObjectBatch = [[NSMutableSet alloc] init];
currentMetadataBatch = [[NSMutableSet alloc] init];
#pragma clang diagnostic pop
}});
if (objectBatchPtr) *objectBatchPtr = objectBatch;
if (metadataBatchPtr) *metadataBatchPtr = metadataBatch;
}
- (void)dequeueBatchForCommit:(uint64_t)commit
- (void)dequeueBatch
{
YDBLogTrace(@"%@ %llu", THIS_METHOD, commit);
YDBLogAutoTrace();
dispatch_block_t block = ^{ @autoreleasepool {
NSNumber *nextCommit = [pendingBatchCommits firstObject];
if (!nextCommit || (nextCommit.unsignedLongLongValue != commit))
{
// This is not the commit we're looking for
return;
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
for (YapCollectionKey *ck in [pendingObjectBatches firstObject])
{
@ -227,7 +215,8 @@
[pendingObjectBatches removeObjectAtIndex:0];
[pendingMetadataBatches removeObjectAtIndex:0];
[pendingBatchCommits removeObjectAtIndex:0];
#pragma clang diagnostic pop
}};
if (dispatch_get_specific(IsOnQueueKey))
@ -240,21 +229,18 @@
{
YDBLogAutoTrace();
__block uint64_t commit = 0;
__weak YapDatabaseConnectionProxy *weakSelf = self;
#pragma clang diagnostic push
#pragma clang diagnostic warning "-Wimplicit-retain-self"
#pragma clang diagnostic warning "-Wimplicit-retain-self" // Turning warnings *** ON ***
[readWriteConnection asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction) {
__strong YapDatabaseConnectionProxy *strongSelf = weakSelf;
if (strongSelf == nil) return;
commit = transaction.connection.snapshot + 1;
NSMutableDictionary *objectBatch = nil;
NSMutableDictionary *metadataBatch = nil;
[strongSelf queueBatchForCommit:commit withObjects:&objectBatch metadata:&metadataBatch];
[strongSelf queueBatchWithObjects:&objectBatch metadata:&metadataBatch];
YapNull *yapnull = [YapNull null];
@ -296,7 +282,7 @@
__strong YapDatabaseConnectionProxy *strongSelf = weakSelf;
if (strongSelf)
{
[strongSelf dequeueBatchForCommit:commit];
[strongSelf dequeueBatch];
}
}];
#pragma clang diagnostic pop
@ -322,12 +308,16 @@
__block BOOL collectionFiltered = NO;
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
object = [pendingObjectCache objectForKey:ck];
if (!object && fetchedCollectionsFilter) {
collectionFiltered = ![fetchedCollectionsFilter isAllowed:collection];
}
#pragma clang diagnostic pop
}});
if (object)
@ -365,12 +355,16 @@
__block BOOL collectionFiltered = NO;
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
metadata = [pendingMetadataCache objectForKey:ck];
if (!metadata && fetchedCollectionsFilter) {
collectionFiltered = ![fetchedCollectionsFilter isAllowed:collection];
}
#pragma clang diagnostic pop
}});
if (metadata)
@ -417,6 +411,8 @@
__block BOOL collectionFiltered = NO;
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
object = [pendingObjectCache objectForKey:ck];
metadata = [pendingMetadataCache objectForKey:ck];
@ -424,6 +420,8 @@
if ((!object || !metadata) && fetchedCollectionsFilter) {
collectionFiltered = ![fetchedCollectionsFilter isAllowed:collection];
}
#pragma clang diagnostic pop
}});
if (object && metadata)
@ -506,17 +504,24 @@
__block BOOL needsWrite = NO;
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
needsWrite = ((currentObjectBatch.count == 0) && (currentMetadataBatch.count == 0));
[pendingObjectCache setObject:object forKey:ck];
[currentObjectBatch addObject:ck];
if (metadata)
if (metadata) {
[pendingMetadataCache setObject:metadata forKey:ck];
else
}
else {
[pendingMetadataCache setObject:[YapNull null] forKey:ck];
}
[currentMetadataBatch addObject:ck];
#pragma clang diagnostic pop
}});
if (needsWrite) {
@ -550,10 +555,14 @@
__block BOOL collectionFiltered = NO;
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (fetchedCollectionsFilter) {
collectionFiltered = ![fetchedCollectionsFilter isAllowed:collection];
}
#pragma clang diagnostic pop
}});
__block BOOL existsInDatabase = NO;
@ -569,6 +578,8 @@
__block BOOL needsWrite = NO;
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
id existing_object = [pendingObjectCache objectForKey:ck];
@ -594,6 +605,8 @@
[pendingObjectCache setObject:object forKey:ck];
[currentObjectBatch addObject:ck];
}
#pragma clang diagnostic pop
}});
if (needsWrite) {
@ -621,10 +634,14 @@
__block BOOL collectionFiltered = NO;
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (fetchedCollectionsFilter) {
collectionFiltered = ![fetchedCollectionsFilter isAllowed:collection];
}
#pragma clang diagnostic pop
}});
__block BOOL existsInDatabase = NO;
@ -640,6 +657,8 @@
__block BOOL needsWrite = NO;
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
// Check pendingObjectCache (NOT pendingMetadataCache) to determine row status.
@ -664,12 +683,17 @@
{
needsWrite = ((currentObjectBatch.count == 0) && (currentMetadataBatch.count == 0));
if (metadata)
if (metadata) {
[pendingMetadataCache setObject:metadata forKey:ck];
else
}
else {
[pendingMetadataCache setObject:[YapNull null] forKey:ck];
}
[currentMetadataBatch addObject:ck];
}
#pragma clang diagnostic pop
}});
if (needsWrite) {
@ -696,6 +720,8 @@
__block BOOL needsWrite = NO;
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
needsWrite = ((currentObjectBatch.count == 0) && (currentMetadataBatch.count == 0));
@ -704,6 +730,8 @@
[pendingMetadataCache setObject:[YapNull null] forKey:ck];
[currentMetadataBatch addObject:ck];
#pragma clang diagnostic pop
}});
if (needsWrite) {
@ -729,6 +757,8 @@
__block BOOL needsWrite = NO;
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
needsWrite = ((currentObjectBatch.count == 0) && (currentMetadataBatch.count == 0));
@ -742,6 +772,8 @@
[pendingMetadataCache setObject:[YapNull null] forKey:ck];
[currentMetadataBatch addObject:ck];
}
#pragma clang diagnostic pop
}});
if (needsWrite) {
@ -750,34 +782,48 @@
}
/**
* Immediately discards all changes that were queued to written to the database.
* Thus the changes are not written to the database,
* and any currently queued readWriteTransaction is aborted.
* Tells the proxy to discard pending changes (if any) for the given <collection, key> tuple.
*
* This method is typically used if you intend to clear the database.
* E.g.:
*
* [connectionProxy abortAndReset];
* [connectionProxy.readWriteTransaction readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction){
*
* [transaction removeAllObjectsInAllCollections];
* }];
* That is, IF the proxy has a pending change (for the tuple) that it intends to write to the database
* during the next flush, it will drop the pending change (and not write it to the database).
**/
- (void)abortAndReset:(YapWhitelistBlacklist *)filter
- (void)resetObjectForKey:(NSString *)key inCollection:(nullable NSString *)collection
{
YapCollectionKey *ck = [[YapCollectionKey alloc] initWithCollection:collection key:key];
dispatch_sync(queue, ^{ @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
[pendingObjectCache removeObjectForKey:ck];
[currentObjectBatch removeObject:ck];
[pendingMetadataCache removeObjectForKey:ck];
[currentMetadataBatch removeObject:ck];
#pragma clang diagnostic pop
}});
}
/**
* Tells the proxy to discard ALL pending changes.
*
* That is, IF the proxy has pending changes that it intends to write to the database
* during the next flush, it will instead drop all those pending changes (and not write any of them).
**/
- (void)reset
{
dispatch_sync(queue, ^{ @autoreleasepool {
if ((currentObjectBatch.count > 0) && (currentMetadataBatch.count > 0))
{
abortAndResetCount++;
}
fetchedCollectionsFilter = filter;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
[pendingObjectCache removeAllObjects];
[currentObjectBatch removeAllObjects];
[pendingMetadataCache removeAllObjects];
[currentMetadataBatch removeAllObjects];
#pragma clang diagnostic pop
}});
}
@ -811,7 +857,7 @@
__block YapWhitelistBlacklist *filter = nil;
dispatch_block_t block = ^{
filter = fetchedCollectionsFilter;
filter = self->fetchedCollectionsFilter;
};
if (dispatch_get_specific(IsOnQueueKey))
@ -825,7 +871,7 @@
- (void)setFetchedCollectionsFilter:(YapWhitelistBlacklist *)filter
{
dispatch_block_t block = ^{
fetchedCollectionsFilter = filter;
self->fetchedCollectionsFilter = filter;
};
if (dispatch_get_specific(IsOnQueueKey))
@ -834,4 +880,14 @@
dispatch_sync(queue, block);
}
/**
* DEPRECATED
**/
- (void)abortAndReset:(YapWhitelistBlacklist *)filter
{
self.fetchedCollectionsFilter = filter;
[self reset];
}
@end

View File

@ -68,7 +68,6 @@ static pid_t currentPid() {
}
- (void)dealloc {
NSLog(@"DEALLOC!");
[self stop];
}
@ -76,8 +75,7 @@ static pid_t currentPid() {
[self stop];
const char* name = [[self channel] cStringUsingEncoding:NSUTF8StringEncoding];
NSLog(@"register: %s", name);
__weak YapDatabaseCrossProcessNotification* wSelf = self;
notify_register_dispatch(name, &notifyToken, dispatch_get_main_queue(), ^(int token) {
@ -87,7 +85,7 @@ static pid_t currentPid() {
BOOL isExternal = fromPid != (uint64_t)currentPid();
if (isExternal)
{
NSLog(@"received external modification from %llu", fromPid);
YDBLogVerbose(@"received external modification from %llu", fromPid);
[[NSNotificationCenter defaultCenter] postNotificationName:YapDatabaseModifiedExternallyNotification object:[wSelf registeredDatabase]];
}

View File

@ -73,7 +73,7 @@
__block YapDatabaseViewFiltering *mostRecentFiltering = nil;
dispatch_block_t block = ^{
mostRecentFiltering = filtering;
mostRecentFiltering = self->filtering;
};
__strong YapDatabase *database = self.registeredDatabase;
@ -167,7 +167,7 @@
dispatch_block_t block = ^{
mostRecentFiltering = filtering;
mostRecentFiltering = self->filtering;
};
__strong YapDatabase *database = self.registeredDatabase;

View File

@ -67,7 +67,7 @@
InvokeFilterBlock = ^(NSString *group, int64_t __unused rowid, YapCollectionKey *ck){
return filterBlock(databaseTransaction, group, ck.collection, ck.key);
return filterBlock(self->databaseTransaction, group, ck.collection, ck.key);
};
}
else if (filtering->blockType == YapDatabaseBlockTypeWithObject)
@ -77,9 +77,9 @@
InvokeFilterBlock = ^(NSString *group, int64_t rowid, YapCollectionKey *ck){
id object = [databaseTransaction objectForCollectionKey:ck withRowid:rowid];
id object = [self->databaseTransaction objectForCollectionKey:ck withRowid:rowid];
return filterBlock(databaseTransaction, group, ck.collection, ck.key, object);
return filterBlock(self->databaseTransaction, group, ck.collection, ck.key, object);
};
}
else if (filtering->blockType == YapDatabaseBlockTypeWithMetadata)
@ -89,9 +89,9 @@
InvokeFilterBlock = ^(NSString *group, int64_t rowid, YapCollectionKey *ck){
id metadata = [databaseTransaction metadataForCollectionKey:ck withRowid:rowid];
id metadata = [self->databaseTransaction metadataForCollectionKey:ck withRowid:rowid];
return filterBlock(databaseTransaction, group, ck.collection, ck.key, metadata);
return filterBlock(self->databaseTransaction, group, ck.collection, ck.key, metadata);
};
}
else // if (filtering->blockType == YapDatabaseBlockTypeWithRow)
@ -103,9 +103,9 @@
id object = nil;
id metadata = nil;
[databaseTransaction getObject:&object metadata:&metadata forCollectionKey:ck withRowid:rowid];
[self->databaseTransaction getObject:&object metadata:&metadata forCollectionKey:ck withRowid:rowid];
return filterBlock(databaseTransaction, group, ck.collection, ck.key, object, metadata);
return filterBlock(self->databaseTransaction, group, ck.collection, ck.key, object, metadata);
};
}
@ -118,7 +118,7 @@
[parentViewTransaction enumerateRowidsInGroup:group
usingBlock:^(int64_t rowid, NSUInteger __unused parentIndex, BOOL __unused *stop)
{
YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
YapCollectionKey *ck = [self->databaseTransaction collectionKeyForRowid:rowid];
if (InvokeFilterBlock(group, rowid, ck))
{
@ -168,6 +168,8 @@
// The changeset mechanism will automatically consolidate all changes to the minimum.
[self enumerateGroupsUsingBlock:^(NSString *group, BOOL __unused *outerStop) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
// We must add the changes in reverse order.
// Either that, or the change index of each item would have to be zero,
@ -184,6 +186,8 @@
}];
[parentConnection->changes addObject:[YapDatabaseViewSectionChange deleteGroup:group]];
#pragma clang diagnostic pop
}];
isRepopulate = YES;
@ -236,7 +240,7 @@
InvokeFilterBlock = ^(NSString *group, int64_t __unused rowid, YapCollectionKey *ck){
return filterBlock(databaseTransaction, group, ck.collection, ck.key);
return filterBlock(self->databaseTransaction, group, ck.collection, ck.key);
};
}
else if (filtering->blockType == YapDatabaseBlockTypeWithObject)
@ -246,9 +250,9 @@
InvokeFilterBlock = ^(NSString *group, int64_t rowid, YapCollectionKey *ck){
id object = [databaseTransaction objectForCollectionKey:ck withRowid:rowid];
id object = [self->databaseTransaction objectForCollectionKey:ck withRowid:rowid];
return filterBlock(databaseTransaction, group, ck.collection, ck.key, object);
return filterBlock(self->databaseTransaction, group, ck.collection, ck.key, object);
};
}
else if (filtering->blockType == YapDatabaseBlockTypeWithMetadata)
@ -258,9 +262,9 @@
InvokeFilterBlock = ^(NSString *group, int64_t rowid, YapCollectionKey *ck){
id metadata = [databaseTransaction metadataForCollectionKey:ck withRowid:rowid];
id metadata = [self->databaseTransaction metadataForCollectionKey:ck withRowid:rowid];
return filterBlock(databaseTransaction, group, ck.collection, ck.key, metadata);
return filterBlock(self->databaseTransaction, group, ck.collection, ck.key, metadata);
};
}
else // if (filtering->blockType == YapDatabaseBlockTypeWithRow)
@ -272,9 +276,9 @@
id object = nil;
id metadata = nil;
[databaseTransaction getObject:&object metadata:&metadata forCollectionKey:ck withRowid:rowid];
[self->databaseTransaction getObject:&object metadata:&metadata forCollectionKey:ck withRowid:rowid];
return filterBlock(databaseTransaction, group, ck.collection, ck.key, object, metadata);
return filterBlock(self->databaseTransaction, group, ck.collection, ck.key, object, metadata);
};
}
@ -296,6 +300,9 @@
[parentViewTransaction enumerateRowidsInGroup:group
usingBlock:^(int64_t rowid, NSUInteger __unused parentIndex, BOOL __unused *stop)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (existing && ((existingRowid == rowid)))
{
// Shortcut #1
@ -375,6 +382,8 @@
// and is still not in our view (filtered).
}
}
#pragma clang diagnostic pop
}];
while (existing)
@ -438,7 +447,7 @@
InvokeFilterBlock = ^(NSString *group, int64_t __unused rowid, YapCollectionKey *ck){
return filterBlock(databaseTransaction, group, ck.collection, ck.key);
return filterBlock(self->databaseTransaction, group, ck.collection, ck.key);
};
}
else if (filtering->blockType == YapDatabaseBlockTypeWithObject)
@ -448,9 +457,9 @@
InvokeFilterBlock = ^(NSString *group, int64_t rowid, YapCollectionKey *ck){
id object = [databaseTransaction objectForCollectionKey:ck withRowid:rowid];
id object = [self->databaseTransaction objectForCollectionKey:ck withRowid:rowid];
return filterBlock(databaseTransaction, group, ck.collection, ck.key, object);
return filterBlock(self->databaseTransaction, group, ck.collection, ck.key, object);
};
}
else if (filtering->blockType == YapDatabaseBlockTypeWithMetadata)
@ -460,9 +469,9 @@
InvokeFilterBlock = ^(NSString *group, int64_t rowid, YapCollectionKey *ck){
id metadata = [databaseTransaction metadataForCollectionKey:ck withRowid:rowid];
id metadata = [self->databaseTransaction metadataForCollectionKey:ck withRowid:rowid];
return filterBlock(databaseTransaction, group, ck.collection, ck.key, metadata);
return filterBlock(self->databaseTransaction, group, ck.collection, ck.key, metadata);
};
}
else // if (filteringBlockType == YapDatabaseBlockTypeWithRow)
@ -474,9 +483,9 @@
id object = nil;
id metadata = nil;
[databaseTransaction getObject:&object metadata:&metadata forCollectionKey:ck withRowid:rowid];
[self->databaseTransaction getObject:&object metadata:&metadata forCollectionKey:ck withRowid:rowid];
return filterBlock(databaseTransaction, group, ck.collection, ck.key, object, metadata);
return filterBlock(self->databaseTransaction, group, ck.collection, ck.key, object, metadata);
};
}
@ -494,7 +503,7 @@
[parentViewTransaction enumerateRowidsInGroup:group
usingBlock:^(int64_t rowid, NSUInteger __unused parentIndex, BOOL __unused *stop)
{
YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
YapCollectionKey *ck = [self->databaseTransaction collectionKeyForRowid:rowid];
if (InvokeFilterBlock(group, rowid, ck))
{
@ -1273,7 +1282,7 @@
if ([extDependencies containsObject:registeredName])
{
YapDatabaseExtensionTransaction *extTransaction = [databaseTransaction ext:extName];
YapDatabaseExtensionTransaction *extTransaction = [self->databaseTransaction ext:extName];
if ([extTransaction respondsToSelector:@selector(view:didRepopulateWithFlags:)])
{
@ -1336,7 +1345,7 @@
if ([extDependencies containsObject:registeredName])
{
YapDatabaseExtensionTransaction *extTransaction = [databaseTransaction ext:extName];
YapDatabaseExtensionTransaction *extTransaction = [self->databaseTransaction ext:extName];
if ([extTransaction respondsToSelector:@selector(view:didRepopulateWithFlags:)])
{

View File

@ -1,6 +1,8 @@
#import <Foundation/Foundation.h>
#import "YapDatabaseExtensionTypes.h"
@class YapDatabaseReadTransaction;
NS_ASSUME_NONNULL_BEGIN
/**
@ -22,16 +24,16 @@ NS_ASSUME_NONNULL_BEGIN
typedef id YapDatabaseFullTextSearchBlock; // One of YapDatabaseFullTextSearchXBlock types
typedef void (^YapDatabaseFullTextSearchWithKeyBlock)
(NSMutableDictionary *dict, NSString *collection, NSString *key);
(YapDatabaseReadTransaction *transaction, NSMutableDictionary *dict, NSString *collection, NSString *key);
typedef void (^YapDatabaseFullTextSearchWithObjectBlock)
(NSMutableDictionary *dict, NSString *collection, NSString *key, id object);
(YapDatabaseReadTransaction *transaction, NSMutableDictionary *dict, NSString *collection, NSString *key, id object);
typedef void (^YapDatabaseFullTextSearchWithMetadataBlock)
(NSMutableDictionary *dict, NSString *collection, NSString *key, __nullable id metadata);
(YapDatabaseReadTransaction *transaction, NSMutableDictionary *dict, NSString *collection, NSString *key, __nullable id metadata);
typedef void (^YapDatabaseFullTextSearchWithRowBlock)
(NSMutableDictionary *dict, NSString *collection, NSString *key, id object, __nullable id metadata);
(YapDatabaseReadTransaction *transaction, NSMutableDictionary *dict, NSString *collection, NSString *key, id object, __nullable id metadata);
+ (instancetype)withKeyBlock:(YapDatabaseFullTextSearchWithKeyBlock)block;
+ (instancetype)withObjectBlock:(YapDatabaseFullTextSearchWithObjectBlock)block;

View File

@ -36,13 +36,13 @@ NS_ASSUME_NONNULL_BEGIN
usingBlock:(void (^)(NSString *collection, NSString *key, BOOL *stop))block;
- (void)enumerateKeysAndMetadataMatching:(NSString *)query
usingBlock:(void (^)(NSString *collection, NSString *key, id metadata, BOOL *stop))block;
usingBlock:(void (^)(NSString *collection, NSString *key, __nullable id metadata, BOOL *stop))block;
- (void)enumerateKeysAndObjectsMatching:(NSString *)query
usingBlock:(void (^)(NSString *collection, NSString *key, id object, BOOL *stop))block;
- (void)enumerateRowsMatching:(NSString *)query
usingBlock:(void (^)(NSString *collection, NSString *key, id object, id metadata, BOOL *stop))block;
usingBlock:(void (^)(NSString *collection, NSString *key, id object, __nullable id metadata, BOOL *stop))block;
// FTS5 bm25 ordering
@ -52,7 +52,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)enumerateBm25OrderedKeysAndMetadataMatching:(NSString *)query
withWeights:(nullable NSArray<NSNumber *> *)weights
usingBlock:(void (^)(NSString *collection, NSString *key, id metadata, BOOL *stop))block;
usingBlock:(void (^)(NSString *collection, NSString *key, __nullable id metadata, BOOL *stop))block;
- (void)enumerateBm25OrderedKeysAndObjectsMatching:(NSString *)query
withWeights:(nullable NSArray<NSNumber *> *)weights
@ -60,7 +60,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)enumerateBm25OrderedRowsMatching:(NSString *)query
withWeights:(nullable NSArray<NSNumber *> *)weights
usingBlock:(void (^)(NSString *collection, NSString *key, id object, id metadata, BOOL *stop))block;
usingBlock:(void (^)(NSString *collection, NSString *key, id object, __nullable id metadata, BOOL *stop))block;
// Query matching + Snippets
@ -72,7 +72,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)enumerateKeysAndMetadataMatching:(NSString *)query
withSnippetOptions:(nullable YapDatabaseFullTextSearchSnippetOptions *)options
usingBlock:
(void (^)(NSString *snippet, NSString *collection, NSString *key, id metadata, BOOL *stop))block;
(void (^)(NSString *snippet, NSString *collection, NSString *key, __nullable id metadata, BOOL *stop))block;
- (void)enumerateKeysAndObjectsMatching:(NSString *)query
withSnippetOptions:(nullable YapDatabaseFullTextSearchSnippetOptions *)options
@ -82,7 +82,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)enumerateRowsMatching:(NSString *)query
withSnippetOptions:(nullable YapDatabaseFullTextSearchSnippetOptions *)options
usingBlock:
(void (^)(NSString *snippet, NSString *collection, NSString *key, id object, id metadata, BOOL *stop))block;
(void (^)(NSString *snippet, NSString *collection, NSString *key, id object, __nullable id metadata, BOOL *stop))block;
@end

View File

@ -108,6 +108,7 @@ static NSString *const ext_key__version_deprecated = @"version";
if (![self populate]) return NO;
[self setStringValue:versionTag forExtensionKey:ext_key__versionTag persistent:YES];
[self setStringValue:ftsVersion forExtensionKey:ext_key__ftsVersion persistent:YES];
if (hasOldVersion_deprecated)
[self removeValueForExtensionKey:ext_key__version_deprecated persistent:YES];
@ -243,15 +244,20 @@ static NSString *const ext_key__version_deprecated = @"version";
(YapDatabaseFullTextSearchWithKeyBlock)handler->block;
[databaseTransaction _enumerateKeysInAllCollectionsUsingBlock:
^(int64_t rowid, NSString *collection, NSString *key, BOOL __unused *stop) {
^(int64_t rowid, NSString *collection, NSString *key, BOOL __unused *stop)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
block(parentConnection->blockDict, collection, key);
block(databaseTransaction, parentConnection->blockDict, collection, key);
if ([parentConnection->blockDict count] > 0)
{
[self addRowid:rowid isNew:YES];
[parentConnection->blockDict removeAllObjects];
}
#pragma clang diagnostic pop
}];
}
else if (handler->blockType == YapDatabaseBlockTypeWithObject)
@ -260,15 +266,20 @@ static NSString *const ext_key__version_deprecated = @"version";
(YapDatabaseFullTextSearchWithObjectBlock)handler->block;
[databaseTransaction _enumerateKeysAndObjectsInAllCollectionsUsingBlock:
^(int64_t rowid, NSString *collection, NSString *key, id object, BOOL __unused *stop) {
^(int64_t rowid, NSString *collection, NSString *key, id object, BOOL __unused *stop)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
block(parentConnection->blockDict, collection, key, object);
block(databaseTransaction, parentConnection->blockDict, collection, key, object);
if ([parentConnection->blockDict count] > 0)
{
[self addRowid:rowid isNew:YES];
[parentConnection->blockDict removeAllObjects];
}
#pragma clang diagnostic pop
}];
}
else if (handler->blockType == YapDatabaseBlockTypeWithMetadata)
@ -277,15 +288,20 @@ static NSString *const ext_key__version_deprecated = @"version";
(YapDatabaseFullTextSearchWithMetadataBlock)handler->block;
[databaseTransaction _enumerateKeysAndMetadataInAllCollectionsUsingBlock:
^(int64_t rowid, NSString *collection, NSString *key, id metadata, BOOL __unused *stop) {
^(int64_t rowid, NSString *collection, NSString *key, id metadata, BOOL __unused *stop)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
block(parentConnection->blockDict, collection, key, metadata);
block(databaseTransaction, parentConnection->blockDict, collection, key, metadata);
if ([parentConnection->blockDict count] > 0)
{
[self addRowid:rowid isNew:YES];
[parentConnection->blockDict removeAllObjects];
}
#pragma clang diagnostic pop
}];
}
else // if (handler->blockType == YapDatabaseBlockTypeWithRow)
@ -294,15 +310,20 @@ static NSString *const ext_key__version_deprecated = @"version";
(YapDatabaseFullTextSearchWithRowBlock)handler->block;
[databaseTransaction _enumerateRowsInAllCollectionsUsingBlock:
^(int64_t rowid, NSString *collection, NSString *key, id object, id metadata, BOOL __unused *stop) {
^(int64_t rowid, NSString *collection, NSString *key, id object, id metadata, BOOL __unused *stop)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
block(parentConnection->blockDict, collection, key, object, metadata);
block(databaseTransaction, parentConnection->blockDict, collection, key, object, metadata);
if ([parentConnection->blockDict count] > 0)
{
[self addRowid:rowid isNew:YES];
[parentConnection->blockDict removeAllObjects];
}
#pragma clang diagnostic pop
}];
}
@ -572,28 +593,28 @@ static NSString *const ext_key__version_deprecated = @"version";
__unsafe_unretained YapDatabaseFullTextSearchWithKeyBlock block =
(YapDatabaseFullTextSearchWithKeyBlock)handler->block;
block(parentConnection->blockDict, collection, key);
block(databaseTransaction, parentConnection->blockDict, collection, key);
}
else if (handler->blockType == YapDatabaseBlockTypeWithObject)
{
__unsafe_unretained YapDatabaseFullTextSearchWithObjectBlock block =
(YapDatabaseFullTextSearchWithObjectBlock)handler->block;
block(parentConnection->blockDict, collection, key, object);
block(databaseTransaction, parentConnection->blockDict, collection, key, object);
}
else if (handler->blockType == YapDatabaseBlockTypeWithMetadata)
{
__unsafe_unretained YapDatabaseFullTextSearchWithMetadataBlock block =
(YapDatabaseFullTextSearchWithMetadataBlock)handler->block;
block(parentConnection->blockDict, collection, key, metadata);
block(databaseTransaction, parentConnection->blockDict, collection, key, metadata);
}
else
{
__unsafe_unretained YapDatabaseFullTextSearchWithRowBlock block =
(YapDatabaseFullTextSearchWithRowBlock)handler->block;
block(parentConnection->blockDict, collection, key, object, metadata);
block(databaseTransaction, parentConnection->blockDict, collection, key, object, metadata);
}
if ([parentConnection->blockDict count] == 0)
@ -913,7 +934,7 @@ static NSString *const ext_key__version_deprecated = @"version";
{
[self enumerateRowidsMatching:query usingBlock:^(int64_t rowid, BOOL *stop) {
YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
YapCollectionKey *ck = [self->databaseTransaction collectionKeyForRowid:rowid];
block(ck.collection, ck.key, stop);
}];
@ -926,7 +947,7 @@ static NSString *const ext_key__version_deprecated = @"version";
YapCollectionKey *ck = nil;
id metadata = nil;
[databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
[self->databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
block(ck.collection, ck.key, metadata, stop);
}];
@ -939,7 +960,7 @@ static NSString *const ext_key__version_deprecated = @"version";
YapCollectionKey *ck = nil;
id object = nil;
[databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
[self->databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
block(ck.collection, ck.key, object, stop);
}];
@ -953,7 +974,7 @@ static NSString *const ext_key__version_deprecated = @"version";
YapCollectionKey *ck = nil;
id object = nil;
id metadata = nil;
[databaseTransaction getCollectionKey:&ck object:&object metadata:&metadata forRowid:rowid];
[self->databaseTransaction getCollectionKey:&ck object:&object metadata:&metadata forRowid:rowid];
block(ck.collection, ck.key, object, metadata, stop);
}];
@ -1026,7 +1047,7 @@ static NSString *const ext_key__version_deprecated = @"version";
usingBlock:(void (^)(NSString *collection, NSString *key, BOOL *stop))block {
[self enumerateBm25OrderedRowidsMatching:query withWeights:weights usingBlock:^(int64_t rowid, BOOL *stop) {
YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
YapCollectionKey *ck = [self->databaseTransaction collectionKeyForRowid:rowid];
block(ck.collection, ck.key, stop);
}];
@ -1039,7 +1060,7 @@ static NSString *const ext_key__version_deprecated = @"version";
YapCollectionKey *ck = nil;
id metadata = nil;
[databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
[self->databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
block(ck.collection, ck.key, metadata, stop);
}];
@ -1052,7 +1073,7 @@ static NSString *const ext_key__version_deprecated = @"version";
YapCollectionKey *ck = nil;
id object = nil;
[databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
[self->databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
block(ck.collection, ck.key, object, stop);
}];
@ -1066,7 +1087,7 @@ static NSString *const ext_key__version_deprecated = @"version";
YapCollectionKey *ck = nil;
id object = nil;
id metadata = nil;
[databaseTransaction getCollectionKey:&ck object:&object metadata:&metadata forRowid:rowid];
[self->databaseTransaction getCollectionKey:&ck object:&object metadata:&metadata forRowid:rowid];
block(ck.collection, ck.key, object, metadata, stop);
}];
@ -1180,7 +1201,7 @@ static NSString *const ext_key__version_deprecated = @"version";
withSnippetOptions:options
usingBlock:^(NSString *snippet, int64_t rowid, BOOL *stop)
{
YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
YapCollectionKey *ck = [self->databaseTransaction collectionKeyForRowid:rowid];
block(snippet, ck.collection, ck.key, stop);
}];
@ -1197,7 +1218,7 @@ static NSString *const ext_key__version_deprecated = @"version";
{
YapCollectionKey *ck = nil;
id metadata = nil;
[databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
[self->databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
block(snippet, ck.collection, ck.key, metadata, stop);
}];
@ -1214,7 +1235,7 @@ static NSString *const ext_key__version_deprecated = @"version";
{
YapCollectionKey *ck = nil;
id object = nil;
[databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
[self->databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
block(snippet, ck.collection, ck.key, object, stop);
}];
@ -1232,7 +1253,7 @@ static NSString *const ext_key__version_deprecated = @"version";
YapCollectionKey *ck = nil;
id object = nil;
id metadata = nil;
[databaseTransaction getCollectionKey:&ck object:&object metadata:&metadata forRowid:rowid];
[self->databaseTransaction getCollectionKey:&ck object:&object metadata:&metadata forRowid:rowid];
block(snippet, ck.collection, ck.key, object, metadata, stop);
}];

View File

@ -99,7 +99,7 @@ static const int ydbLogLevel = YDB_LOG_LEVEL_WARN;
dispatch_block_t block = ^{
result = (queryCache == nil) ? NO : YES;
result = (self->queryCache == nil) ? NO : YES;
};
if (dispatch_get_specific(databaseConnection->IsOnConnectionQueueKey))
@ -116,16 +116,16 @@ static const int ydbLogLevel = YDB_LOG_LEVEL_WARN;
if (queryCacheEnabled)
{
if (queryCache == nil)
if (self->queryCache == nil)
{
queryCache = [[YapCache alloc] initWithCountLimit:queryCacheLimit];
queryCache.allowedKeyClasses = [NSSet setWithObject:[NSString class]];
queryCache.allowedObjectClasses = [NSSet setWithObject:[YapDatabaseStatement class]];
self->queryCache = [[YapCache alloc] initWithCountLimit:self->queryCacheLimit];
self->queryCache.allowedKeyClasses = [NSSet setWithObject:[NSString class]];
self->queryCache.allowedObjectClasses = [NSSet setWithObject:[YapDatabaseStatement class]];
}
}
else
{
queryCache = nil;
self->queryCache = nil;
}
};
@ -141,7 +141,7 @@ static const int ydbLogLevel = YDB_LOG_LEVEL_WARN;
dispatch_block_t block = ^{
result = queryCacheLimit;
result = self->queryCacheLimit;
};
if (dispatch_get_specific(databaseConnection->IsOnConnectionQueueKey))
@ -156,8 +156,8 @@ static const int ydbLogLevel = YDB_LOG_LEVEL_WARN;
{
dispatch_block_t block = ^{
queryCacheLimit = newQueryCacheLimit;
queryCache.countLimit = queryCacheLimit;
self->queryCacheLimit = newQueryCacheLimit;
self->queryCache.countLimit = self->queryCacheLimit;
};
if (dispatch_get_specific(databaseConnection->IsOnConnectionQueueKey))

View File

@ -245,6 +245,9 @@ static NSString *const ext_key_version_deprecated = @"version";
**/
- (BOOL)populate
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
// Remove everything from the database
[self removeAllRowids];
@ -388,6 +391,8 @@ static NSString *const ext_key_version_deprecated = @"version";
}
return YES;
#pragma clang diagnostic pop
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
@ -1113,7 +1118,7 @@ static NSString *const ext_key_version_deprecated = @"version";
BOOL result = [self _enumerateRowidsMatchingQuery:query usingBlock:^(int64_t rowid, BOOL *stop) {
YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
YapCollectionKey *ck = [self->databaseTransaction collectionKeyForRowid:rowid];
block(ck.collection, ck.key, stop);
}];
@ -1132,7 +1137,7 @@ static NSString *const ext_key_version_deprecated = @"version";
YapCollectionKey *ck = nil;
id metadata = nil;
[databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
[self->databaseTransaction getCollectionKey:&ck metadata:&metadata forRowid:rowid];
block(ck.collection, ck.key, metadata, stop);
}];
@ -1151,7 +1156,7 @@ static NSString *const ext_key_version_deprecated = @"version";
YapCollectionKey *ck = nil;
id object = nil;
[databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
[self->databaseTransaction getCollectionKey:&ck object:&object forRowid:rowid];
block(ck.collection, ck.key, object, stop);
}];
@ -1171,7 +1176,7 @@ static NSString *const ext_key_version_deprecated = @"version";
YapCollectionKey *ck = nil;
id object = nil;
id metadata = nil;
[databaseTransaction getCollectionKey:&ck object:&object metadata:&metadata forRowid:rowid];
[self->databaseTransaction getCollectionKey:&ck object:&object metadata:&metadata forRowid:rowid];
block(ck.collection, ck.key, object, metadata, stop);
}];

View File

@ -118,7 +118,7 @@ static NSString *const changeset_key_reset = @"reset";
- (sqlite3_stmt *)enumerateDstFileURLWithSrcStatement:(BOOL *)needsFinalizePtr;
- (sqlite3_stmt *)enumerateDstFileURLWithSrcNameStatement:(BOOL *)needsFinalizePtr;
- (sqlite3_stmt *)enumerateDstFileURLWithNameStatement:(BOOL *)needsFinalizePtr;
- (sqlite3_stmt *)enumerateDstFileURLWithNameExcludingSrcStatement:(BOOL *)needsFinalizePtr;
- (sqlite3_stmt *)enumerateDstFileURLExcludingSrcStatement:(BOOL *)needsFinalizePtr;
- (sqlite3_stmt *)enumerateAllDstFileURLStatement:(BOOL *)needsFinalizePtr;
- (sqlite3_stmt *)enumerateForSrcStatement:(BOOL *)needsFinalizePtr;
- (sqlite3_stmt *)enumerateForDstStatement:(BOOL *)needsFinalizePtr;
@ -127,8 +127,8 @@ static NSString *const changeset_key_reset = @"reset";
- (sqlite3_stmt *)enumerateForNameStatement:(BOOL *)needsFinalizePtr;
- (sqlite3_stmt *)enumerateForSrcDstStatement:(BOOL *)needsFinalizePtr;
- (sqlite3_stmt *)enumerateForSrcDstNameStatement:(BOOL *)needsFinalizePtr;
- (sqlite3_stmt *)countForSrcNameExcludingDstStatement;
- (sqlite3_stmt *)countForDstNameExcludingSrcStatement;
- (sqlite3_stmt *)countForSrcExcludingDstStatement;
- (sqlite3_stmt *)countForDstExcludingSrcStatement;
- (sqlite3_stmt *)countForNameStatement;
- (sqlite3_stmt *)countForSrcStatement;
- (sqlite3_stmt *)countForSrcNameStatement;

View File

@ -36,7 +36,7 @@
sqlite3_stmt *enumerateDstFileURLWithSrcStatement;
sqlite3_stmt *enumerateDstFileURLWithSrcNameStatement;
sqlite3_stmt *enumerateDstFileURLWithNameStatement;
sqlite3_stmt *enumerateDstFileURLWithNameExcludingSrcStatement;
sqlite3_stmt *enumerateDstFileURLExcludingSrcStatement;
sqlite3_stmt *enumerateAllDstFileURLStatement;
sqlite3_stmt *enumerateForSrcStatement;
sqlite3_stmt *enumerateForDstStatement;
@ -52,8 +52,8 @@
sqlite3_stmt *countForNameStatement;
sqlite3_stmt *countForSrcDstStatement;
sqlite3_stmt *countForSrcDstNameStatement;
sqlite3_stmt *countForSrcNameExcludingDstStatement;
sqlite3_stmt *countForDstNameExcludingSrcStatement;
sqlite3_stmt *countForSrcExcludingDstStatement;
sqlite3_stmt *countForDstExcludingSrcStatement;
sqlite3_stmt *removeAllStatement;
sqlite3_stmt *removeAllProtocolStatement;
}
@ -93,7 +93,7 @@
sqlite_finalize_null(&enumerateDstFileURLWithSrcStatement);
sqlite_finalize_null(&enumerateDstFileURLWithSrcNameStatement);
sqlite_finalize_null(&enumerateDstFileURLWithNameStatement);
sqlite_finalize_null(&enumerateDstFileURLWithNameExcludingSrcStatement);
sqlite_finalize_null(&enumerateDstFileURLExcludingSrcStatement);
sqlite_finalize_null(&enumerateAllDstFileURLStatement);
sqlite_finalize_null(&enumerateForSrcStatement);
sqlite_finalize_null(&enumerateForDstStatement);
@ -109,8 +109,8 @@
sqlite_finalize_null(&countForNameStatement);
sqlite_finalize_null(&countForSrcDstStatement);
sqlite_finalize_null(&countForSrcDstNameStatement);
sqlite_finalize_null(&countForSrcNameExcludingDstStatement);
sqlite_finalize_null(&countForDstNameExcludingSrcStatement);
sqlite_finalize_null(&countForSrcExcludingDstStatement);
sqlite_finalize_null(&countForDstExcludingSrcStatement);
sqlite_finalize_null(&removeAllStatement);
sqlite_finalize_null(&removeAllProtocolStatement);
}
@ -515,7 +515,7 @@
NSString *string = [NSString stringWithFormat:
@"SELECT \"rowid\", \"name\", \"dst\", \"rules\", \"manual\" FROM \"%@\""
@" WHERE \"dst\" > %lld AND \"src\" = ?;",
[parent tableName], INT64_MAX];
[self->parent tableName], INT64_MAX];
sqlite3_stmt *stmt = NULL;
[self prepareStatement:&stmt withString:string caller:_cmd];
@ -568,7 +568,7 @@
NSString *string = [NSString stringWithFormat:
@"SELECT \"rowid\", \"dst\", \"rules\", \"manual\" FROM \"%@\""
@" WHERE \"dst\" > %lld AND \"src\" = ? AND \"name\" = ?;",
[parent tableName], INT64_MAX];
[self->parent tableName], INT64_MAX];
sqlite3_stmt *stmt = NULL;
[self prepareStatement:&stmt withString:string caller:_cmd];
@ -621,7 +621,7 @@
NSString *string = [NSString stringWithFormat:
@"SELECT \"rowid\", \"src\", \"dst\", \"rules\", \"manual\" FROM \"%@\""
@" WHERE \"dst\" > %lld AND \"name\" = ?;",
[parent tableName], INT64_MAX];
[self->parent tableName], INT64_MAX];
sqlite3_stmt *stmt = NULL;
[self prepareStatement:&stmt withString:string caller:_cmd];
@ -651,9 +651,9 @@
return result;
}
- (sqlite3_stmt *)enumerateDstFileURLWithNameExcludingSrcStatement:(BOOL *)needsFinalizePtr
- (sqlite3_stmt *)enumerateDstFileURLExcludingSrcStatement:(BOOL *)needsFinalizePtr
{
sqlite3_stmt **statement = &enumerateDstFileURLWithNameExcludingSrcStatement;
sqlite3_stmt **statement = &enumerateDstFileURLExcludingSrcStatement;
sqlite3_stmt* (^CreateStatement)(void) = ^{
@ -672,9 +672,9 @@
// For more information, see the documentation: http://www.sqlite.org/datatype3.html
NSString *string = [NSString stringWithFormat:
@"SELECT \"rowid\", \"src\", \"dst\", \"rules\", \"manual\" FROM \"%@\""
@" WHERE \"dst\" > %lld AND \"src\" != ? AND \"name\" = ?;",
[parent tableName], INT64_MAX];
@"SELECT \"rowid\", \"name\", \"src\", \"dst\", \"rules\", \"manual\" FROM \"%@\""
@" WHERE \"dst\" > %lld AND \"src\" != ?;",
[self->parent tableName], INT64_MAX];
sqlite3_stmt *stmt = NULL;
[self prepareStatement:&stmt withString:string caller:_cmd];
@ -726,7 +726,7 @@
NSString *string = [NSString stringWithFormat:
@"SELECT \"rowid\", \"name\", \"src\", \"dst\", \"rules\", \"manual\" FROM \"%@\" WHERE \"dst\" > %lld;",
[parent tableName], INT64_MAX];
[self->parent tableName], INT64_MAX];
sqlite3_stmt *stmt = NULL;
[self prepareStatement:&stmt withString:string caller:_cmd];
@ -764,7 +764,7 @@
NSString *string = [NSString stringWithFormat:
@"SELECT \"rowid\", \"name\", \"dst\", \"rules\", \"manual\" FROM \"%@\" WHERE \"src\" = ?;",
[parent tableName]];
[self->parent tableName]];
sqlite3_stmt *stmt = NULL;
[self prepareStatement:&stmt withString:string caller:_cmd];
@ -802,7 +802,7 @@
NSString *string = [NSString stringWithFormat:
@"SELECT \"rowid\", \"name\", \"src\", \"rules\", \"manual\" FROM \"%@\" WHERE \"dst\" = ?;",
[parent tableName]];
[self->parent tableName]];
sqlite3_stmt *stmt = NULL;
[self prepareStatement:&stmt withString:string caller:_cmd];
@ -840,7 +840,7 @@
NSString *string = [NSString stringWithFormat:
@"SELECT \"rowid\", \"dst\", \"rules\", \"manual\" FROM \"%@\" WHERE \"src\" = ? AND \"name\" = ?;",
[parent tableName]];
[self->parent tableName]];
sqlite3_stmt *stmt = NULL;
[self prepareStatement:&stmt withString:string caller:_cmd];
@ -878,7 +878,7 @@
NSString *string = [NSString stringWithFormat:
@"SELECT \"rowid\", \"src\", \"rules\", \"manual\" FROM \"%@\" WHERE \"dst\" = ? AND \"name\" = ?;",
[parent tableName]];
[self->parent tableName]];
sqlite3_stmt *stmt = NULL;
[self prepareStatement:&stmt withString:string caller:_cmd];
@ -916,7 +916,7 @@
NSString *string = [NSString stringWithFormat:
@"SELECT \"rowid\", \"src\", \"dst\", \"rules\", \"manual\" FROM \"%@\" WHERE \"name\" = ?;",
[parent tableName]];
[self->parent tableName]];
sqlite3_stmt *stmt = NULL;
[self prepareStatement:&stmt withString:string caller:_cmd];
@ -954,7 +954,7 @@
NSString *string = [NSString stringWithFormat:
@"SELECT \"rowid\", \"name\", \"rules\", \"manual\" FROM \"%@\" WHERE \"src\" = ? AND \"dst\" = ?;",
[parent tableName]];
[self->parent tableName]];
sqlite3_stmt *stmt = NULL;
[self prepareStatement:&stmt withString:string caller:_cmd];
@ -992,7 +992,7 @@
NSString *string = [NSString stringWithFormat:
@"SELECT \"rowid\", \"rules\", \"manual\" FROM \"%@\" WHERE \"src\" = ? AND \"dst\" = ? AND \"name\" = ?;",
[parent tableName]];
[self->parent tableName]];
sqlite3_stmt *stmt = NULL;
[self prepareStatement:&stmt withString:string caller:_cmd];
@ -1022,13 +1022,13 @@
return result;
}
- (sqlite3_stmt *)countForSrcNameExcludingDstStatement
- (sqlite3_stmt *)countForSrcExcludingDstStatement
{
sqlite3_stmt **statement = &countForSrcNameExcludingDstStatement;
sqlite3_stmt **statement = &countForSrcExcludingDstStatement;
if (*statement == NULL)
{
NSString *string = [NSString stringWithFormat:
@"SELECT COUNT(*) AS NumberOfRows FROM \"%@\" WHERE \"src\" = ? AND \"dst\" != ? AND \"name\" = ?;",
@"SELECT COUNT(*) AS NumberOfRows FROM \"%@\" WHERE \"src\" = ? AND \"dst\" != ?;",
[parent tableName]];
[self prepareStatement:statement withString:string caller:_cmd];
@ -1037,13 +1037,13 @@
return *statement;
}
- (sqlite3_stmt *)countForDstNameExcludingSrcStatement
- (sqlite3_stmt *)countForDstExcludingSrcStatement
{
sqlite3_stmt **statement = &countForDstNameExcludingSrcStatement;
sqlite3_stmt **statement = &countForDstExcludingSrcStatement;
if (*statement == NULL)
{
NSString *string = [NSString stringWithFormat:
@"SELECT COUNT(*) AS NumberOfRows FROM \"%@\" WHERE \"dst\" = ? AND \"src\" != ? AND \"name\" = ?;",
@"SELECT COUNT(*) AS NumberOfRows FROM \"%@\" WHERE \"dst\" = ? AND \"src\" != ?;",
[parent tableName]];
[self prepareStatement:statement withString:string caller:_cmd];

View File

@ -528,7 +528,7 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
[edges addObject:cleanEdge];
}
[parentConnection->protocolChanges setObject:edges forKey:@(rowid)];
[self->parentConnection->protocolChanges setObject:edges forKey:@(rowid)];
}
};
@ -541,7 +541,7 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
if ([allowedCollections isAllowed:collection])
{
[databaseTransaction _enumerateKeysAndObjectsInCollection:collection usingBlock:
[self->databaseTransaction _enumerateKeysAndObjectsInCollection:collection usingBlock:
^(int64_t rowid, NSString *key, id object, BOOL __unused *innerStop)
{
ProcessRow(rowid, collection, key, object);
@ -1983,29 +1983,26 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
}
/**
* Queries the database for the number of edges matching the given source and name.
* Queries the database for the number of edges matching the given source.
* This method only queries the database, and doesn't inspect anything in memory.
**/
- (int64_t)edgeCountWithSource:(int64_t)srcRowid name:(NSString *)name excludingDestination:(int64_t)dstRowid
- (int64_t)edgeCountWithSource:(int64_t)srcRowid
excludingDestination:(int64_t)dstRowid
{
sqlite3_stmt *statement = [parentConnection countForSrcNameExcludingDstStatement];
sqlite3_stmt *statement = [parentConnection countForSrcExcludingDstStatement];
if (statement == NULL) return 0;
int64_t count = 0;
// SELECT COUNT(*) AS NumberOfRows FROM "tableName" WHERE "src" = ? AND "dst" != ? AND "name" = ?;
// SELECT COUNT(*) AS NumberOfRows FROM "tableName" WHERE "src" = ? AND "dst" != ?;
int const column_idx_count = SQLITE_COLUMN_START;
int const bind_idx_src = SQLITE_BIND_START + 0;
int const bind_idx_dst = SQLITE_BIND_START + 1;
int const bind_idx_name = SQLITE_BIND_START + 2;
sqlite3_bind_int64(statement, bind_idx_src, srcRowid);
sqlite3_bind_int64(statement, bind_idx_dst, dstRowid);
YapDatabaseString _name; MakeYapDatabaseString(&_name, name);
sqlite3_bind_text(statement, bind_idx_name, _name.str, _name.length, SQLITE_STATIC);
int status = sqlite3_step(statement);
if (status == SQLITE_ROW)
{
@ -2019,37 +2016,31 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
sqlite3_clear_bindings(statement);
sqlite3_reset(statement);
FreeYapDatabaseString(&_name);
return count;
}
/**
* Queries the database for the number of edges matching the given destination and name.
* Queries the database for the number of edges matching the given destination.
* This method only queries the database, and doesn't inspect anything in memory.
**/
- (int64_t)edgeCountWithDestination:(int64_t)dstRowid name:(NSString *)name excludingSource:(int64_t)srcRowid
- (int64_t)edgeCountWithDestination:(int64_t)dstRowid
excludingSource:(int64_t)srcRowid
{
NSAssert(name != nil, @"Internal logic error");
sqlite3_stmt *statement = [parentConnection countForDstNameExcludingSrcStatement];
sqlite3_stmt *statement = [parentConnection countForDstExcludingSrcStatement];
if (statement == NULL) return 0;
int64_t count = 0;
// SELECT COUNT(*) AS NumberOfRows FROM "tableName" WHERE "dst" = ? AND "src" != ? AND "name" = ?;
// SELECT COUNT(*) AS NumberOfRows FROM "tableName" WHERE "dst" = ? AND "src" != ?;
int const column_idx_count = SQLITE_COLUMN_START;
int const bind_idx_dst = SQLITE_BIND_START + 0;
int const bind_idx_src = SQLITE_BIND_START + 1;
int const bind_idx_name = SQLITE_BIND_START + 2;
sqlite3_bind_int64(statement, bind_idx_dst, dstRowid);
sqlite3_bind_int64(statement, bind_idx_src, srcRowid);
YapDatabaseString _name; MakeYapDatabaseString(&_name, name);
sqlite3_bind_text(statement, bind_idx_name, _name.str, _name.length, SQLITE_STATIC);
int status = sqlite3_step(statement);
if (status == SQLITE_ROW)
{
@ -2063,7 +2054,6 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
sqlite3_clear_bindings(statement);
sqlite3_reset(statement);
FreeYapDatabaseString(&_name);
return count;
}
@ -2073,37 +2063,32 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
* This method only queries the database, and doesn't inspect anything in memory.
**/
- (int64_t)edgeCountWithDestinationFileURL:(NSURL *)dstFileURL
name:(NSString *)name
excludingSource:(int64_t)exclSrcRowid
{
NSAssert(dstFileURL != nil, @"Internal logic error");
NSAssert(name != nil, @"Internal logic error");
BOOL needsFinalize;
sqlite3_stmt *statement = [parentConnection enumerateDstFileURLWithNameExcludingSrcStatement:&needsFinalize];
sqlite3_stmt *statement = [parentConnection enumerateDstFileURLExcludingSrcStatement:&needsFinalize];
if (statement == NULL) return 0;
int64_t count = 0;
// SELECT "rowid", "src", "dst", "rules", "manual" FROM "tableName"
// WHERE "dst" > INT64_MAX AND "src" != ? AND "name" = ?;
// SELECT "rowid", "name", "src", "dst", "rules", "manual" FROM "tableName"
// WHERE "dst" > INT64_MAX AND "src" != ?;
//
// AKA: typeof(dst) IS BLOB
int const column_idx_rowid = SQLITE_COLUMN_START + 0;
int const column_idx_src = SQLITE_COLUMN_START + 1;
int const column_idx_dst = SQLITE_COLUMN_START + 2;
int const column_idx_rules = SQLITE_COLUMN_START + 3;
int const column_idx_manual = SQLITE_COLUMN_START + 4;
int const column_idx_name = SQLITE_COLUMN_START + 1;
int const column_idx_src = SQLITE_COLUMN_START + 2;
int const column_idx_dst = SQLITE_COLUMN_START + 3;
int const column_idx_rules = SQLITE_COLUMN_START + 4;
int const column_idx_manual = SQLITE_COLUMN_START + 5;
int const bind_idx_src = SQLITE_BIND_START + 0;
int const bind_idx_name = SQLITE_BIND_START + 1;
sqlite3_bind_int64(statement, bind_idx_src, exclSrcRowid);
YapDatabaseString _name; MakeYapDatabaseString(&_name, name);
sqlite3_bind_text(statement, bind_idx_name, _name.str, _name.length, SQLITE_STATIC);
int status;
while ((status = sqlite3_step(statement)) == SQLITE_ROW)
{
@ -2119,6 +2104,11 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
{
int64_t srcRowid = sqlite3_column_int64(statement, column_idx_src);
const unsigned char *text = sqlite3_column_text(statement, column_idx_name);
int textSize = sqlite3_column_bytes(statement, column_idx_name);
NSString *name = [[NSString alloc] initWithBytes:text length:textSize encoding:NSUTF8StringEncoding];
int64_t dstRowid = 0;
NSData *dstFileURLData = nil;
@ -2164,7 +2154,6 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
}
sqlite3_reset(statement);
FreeYapDatabaseString(&_name);
return count;
}
@ -2431,23 +2420,9 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
//
// Pre-process the updated edges.
// This involves looking up the destinationRowid for each edge.
//
// Implementation details:
//
// We use the offset & protocolEdgesCount to mark the range of unprocessed edges in the array:
// - All nodes at index < offset have already been processed.
// - All nodes at index >= protocolEdgesCount were added to the array and should be ignored.
//
// These added nodes represent existing edges in the database that were
// implicitly deleted by removing from edge list.
__block NSUInteger offset = 0;
NSUInteger protocolEdgesCount = [protocolEdges count];
for (NSUInteger i = 0; i < protocolEdgesCount; i++)
for (YapDatabaseRelationshipEdge *edge in protocolEdges)
{
YapDatabaseRelationshipEdge *edge = [protocolEdges objectAtIndex:i];
if (edge->state & YDB_EdgeState_DestinationFileURL)
{
continue;
@ -2469,23 +2444,38 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
edge->action = YDB_EdgeAction_Delete;
edge->flags |= YDB_EdgeFlags_DestinationDeleted;
edge->flags |= YDB_EdgeFlags_BadDestination;
[protocolEdges exchangeObjectAtIndex:i withObjectAtIndex:offset];
offset++;
}
else if (dstDeleted)
{
edge->action = YDB_EdgeAction_Delete;
edge->flags |= YDB_EdgeFlags_DestinationDeleted;
}
// Note: We're not done processing this edge yet.
// We still don't know if it actually exists in the databse yet.
// So we may not need to (be able to) delete it.
}
}
// Step 2 :
//
// Enumerate the existing edges in the database, and try to match them up with edges from the new set.
//
// Implementation notes:
//
// We use the offset & protocolEdgesCount to mark the range of unprocessed edges in the array:
// - All nodes at index < offset have already been matched.
// - All nodes at index >= protocolEdgesCount were added to the array and should be ignored (by step 3).
//
// These added nodes represent existing edges in the database that were
// implicitly deleted by removing from edge list.
__block NSUInteger offset = 0;
NSUInteger protocolEdgesCount = protocolEdges.count;
[self enumerateExistingEdgesWithSource:srcRowid usingBlock:^(YapDatabaseRelationshipEdge *existingEdge) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
// Ignore manually created edges
if (existingEdge->isManualEdge) return; // continue (next matching row)
@ -2568,8 +2558,11 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
}
[protocolEdges addObject:edge];
// Note: Do NOT increment protocolEdgesCount.
// Do NOT increment offset.
// Do NOT increment protocolEdgesCount.
}
#pragma clang diagnostic pop
}];
// Step 3 :
@ -2580,13 +2573,12 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
{
YapDatabaseRelationshipEdge *edge = [protocolEdges objectAtIndex:i];
edge->action = YDB_EdgeAction_Insert;
edge->flags |= YDB_EdgeFlags_EdgeNotInDatabase;
if (srcDeleted)
{
edge->action = YDB_EdgeAction_Delete;
edge->flags |= YDB_EdgeFlags_SourceDeleted;
edge->flags |= YDB_EdgeFlags_EdgeNotInDatabase;
}
if (!(edge->state & YDB_EdgeState_DestinationFileURL) &&
@ -2594,7 +2586,11 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
{
edge->action = YDB_EdgeAction_Delete;
edge->flags |= YDB_EdgeFlags_DestinationDeleted;
edge->flags |= YDB_EdgeFlags_EdgeNotInDatabase;
}
if (edge->action == YDB_EdgeAction_None) // May have been set to Delete in step 1
{
edge->action = YDB_EdgeAction_Insert;
}
}
}
@ -3063,6 +3059,8 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
// So this block need only look at the edgeAction and flags to decide how to process each edge.
void (^ProcessEdges)(NSArray *edges) = ^(NSArray *edges){ @autoreleasepool{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
for (YapDatabaseRelationshipEdge *edge in edges)
{
@ -3317,6 +3315,7 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
} // end for (YapDatabaseRelationshipEdge *edge in edges)
#pragma clang diagnostic pop
}}; // end block ProcessEdges(NSMutableArray *edges)
@ -3330,6 +3329,8 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
// - deleting edges that were manually removed from the list
[parentConnection->protocolChanges enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL __unused *stop){
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
__unsafe_unretained NSNumber *srcRowidNumber = (NSNumber *)key;
__unsafe_unretained NSMutableArray *protocolEdges = (NSMutableArray *)obj;
@ -3359,6 +3360,8 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
// We're ready for normal edge processing.
ProcessEdges(protocolEdges);
#pragma clang diagnostic pop
}];
[parentConnection->protocolChanges removeAllObjects];
@ -3400,10 +3403,9 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
{
if (edge->nodeDeleteRules & YDB_DeleteDestinationIfAllSourcesDeleted)
{
// Delete destination node IF there are no other edges pointing to it with the same name
// Delete destination file IF there are no other edges pointing to it
int64_t count = [self edgeCountWithDestinationFileURL:edge->destinationFileURL
name:edge->name
excludingSource:edge->sourceRowid];
if (count == 0)
{
@ -3425,10 +3427,9 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
}
else
{
// Delete destination node IF there are no other edges pointing to it with the same name
// Delete destination node IF there are no other edges pointing to it
int64_t count = [self edgeCountWithDestination:edge->destinationRowid
name:edge->name
excludingSource:edge->sourceRowid];
if (count == 0)
{
@ -3474,10 +3475,9 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
}
else
{
// Delete source node IF there are no other edges pointing from it with the same name
// Delete source node IF there are no other edges pointing from it
int64_t count = [self edgeCountWithSource:edge->sourceRowid
name:edge->name
excludingDestination:edge->destinationRowid];
if (count == 0)
{
@ -3545,6 +3545,8 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
YapCollectionKey *src = deletedCollectionKey;
[self enumerateExistingEdgesWithSource:srcRowid usingBlock:^(YapDatabaseRelationshipEdge *edge) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
// Reminder:
//
@ -3560,7 +3562,7 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
{
if (edge->nodeDeleteRules & YDB_DeleteDestinationIfAllSourcesDeleted)
{
// Delete the destination node IF there are no other edges pointing to it with the same name
// Delete the destination file IF there are no other edges pointing to it
if (!(edge->state & YDB_EdgeState_HasDestinationFileURL))
{
@ -3570,7 +3572,6 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
if (edge->destinationFileURL)
{
int64_t count = [self edgeCountWithDestinationFileURL:edge->destinationFileURL
name:edge->name
excludingSource:srcRowid];
if (count == 0)
{
@ -3606,11 +3607,10 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
if (edge->nodeDeleteRules & YDB_DeleteDestinationIfAllSourcesDeleted)
{
// Delete the destination node IF there are no other edges pointing to it with the same name
// Delete the destination node IF there are no other edges pointing to it
int64_t count = [self edgeCountWithDestination:edge->destinationRowid
name:edge->name
excludingSource:srcRowid];
excludingSource:srcRowid];
if (count == 0)
{
shouldDeleteDestination = YES;
@ -3708,6 +3708,8 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
}
}
} // end else if (!dstFilePath)
#pragma clang diagnostic pop
}]; // end enumerateExistingRowsWithSrc:usingBlock:
} // end "Enumerate all edges where source node is the deleted node"
@ -3719,6 +3721,8 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
YapCollectionKey *dst = deletedCollectionKey;
[self enumerateExistingEdgesWithDestination:dstRowid usingBlock:^(YapDatabaseRelationshipEdge *edge) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
// Reminder:
//
@ -3740,11 +3744,10 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
if (edge->nodeDeleteRules & YDB_DeleteSourceIfAllDestinationsDeleted)
{
// Delete the source node IF there are no other edges pointing from it with the same name
// Delete the source node IF there are no other edges pointing from it
int64_t count = [self edgeCountWithSource:edge->sourceRowid
name:edge->name
excludingDestination:dstRowid];
excludingDestination:dstRowid];
if (count == 0)
{
shouldDeleteSource = YES;
@ -3840,7 +3843,8 @@ NS_INLINE BOOL URLMatchesURL(NSURL *url1, NSURL *url2)
withRowid:edge->sourceRowid];
}
}
#pragma clang diagnostic pop
}]; // end enumerateExistingRowsWithDst:usingBlock:
} // end "Enumerate all edges where destination node is the deleted node"

View File

@ -141,7 +141,7 @@
dispatch_block_t block = ^{
result = query;
result = self->query;
};
if (dispatch_get_specific(databaseConnection->IsOnConnectionQueueKey))

View File

@ -207,6 +207,8 @@ static NSString *const ext_key_query = @"query";
__block int processed = 0;
[ftsTransaction enumerateRowidsMatching:[self query] usingBlock:^(int64_t rowid, BOOL *stop) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
YapRowidSetAdd(ftsRowids, rowid);
@ -217,6 +219,8 @@ static NSString *const ext_key_query = @"query";
*stop = YES;
}
}
#pragma clang diagnostic pop
}];
}
@ -252,6 +256,8 @@ static NSString *const ext_key_query = @"query";
// The changeset mechanism will automatically consolidate all changes to the minimum.
[self enumerateGroupsUsingBlock:^(NSString *group, BOOL __unused *outerStop) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
// We must add the changes in reverse order.
// Either that, or the change index of each item would have to be zero,
@ -268,6 +274,8 @@ static NSString *const ext_key_query = @"query";
}];
[parentConnection->changes addObject:[YapDatabaseViewSectionChange deleteGroup:group]];
#pragma clang diagnostic pop
}];
isRepopulate = YES;
@ -362,6 +370,9 @@ static NSString *const ext_key_query = @"query";
[parentViewTransaction enumerateRowidsInGroup:group usingBlock:
^(int64_t rowid, NSUInteger __unused parentIndex, BOOL __unused *stop)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (existing && ((existingRowid == rowid)))
{
// Shortcut #1
@ -440,6 +451,8 @@ static NSString *const ext_key_query = @"query";
// and is still not in our view (filtered).
}
}
#pragma clang diagnostic pop
}];
while (existing)
@ -1439,7 +1452,7 @@ static NSString *const ext_key_query = @"query";
if ([extDependencies containsObject:registeredName])
{
YapDatabaseExtensionTransaction *extTransaction = [databaseTransaction ext:extName];
YapDatabaseExtensionTransaction *extTransaction = [self->databaseTransaction ext:extName];
if ([extTransaction respondsToSelector:@selector(view:didRepopulateWithFlags:)])
{
@ -1560,6 +1573,9 @@ static NSString *const ext_key_query = @"query";
[parentViewTransaction enumerateRowidsInGroup:group
usingBlock:^(int64_t rowid, NSUInteger parentIndex, BOOL *stop)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (YapRowidSetContains(ftsRowids, rowid))
{
// The item matches the FTS query (should be in view)
@ -1623,6 +1639,8 @@ static NSString *const ext_key_query = @"query";
*stop = YES;
}
}
#pragma clang diagnostic pop
}];
if ([searchQueue shouldAbortSearchInProgressAndRollback:NULL]) {
@ -1674,6 +1692,9 @@ static NSString *const ext_key_query = @"query";
range:range
usingBlock:^(int64_t rowid, NSUInteger index, BOOL *stop)
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
if (YapRowidSetContains(ftsRowidsLeft, rowid))
{
// The row was previously in the view (in old search results),
@ -1721,6 +1742,8 @@ static NSString *const ext_key_query = @"query";
done = YES;
}
}
#pragma clang diagnostic pop
}];
} while (!done);
@ -1746,6 +1769,8 @@ static NSString *const ext_key_query = @"query";
sorting:&sorting];
YapRowidSetEnumerate(ftsRowidsLeft, ^(int64_t rowid, BOOL *stop) { @autoreleasepool {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wimplicit-retain-self"
YapCollectionKey *ck = [databaseTransaction collectionKeyForRowid:rowid];
@ -1838,6 +1863,8 @@ static NSString *const ext_key_query = @"query";
*stop = YES;
}
}
#pragma clang diagnostic pop
}});
// Dealloc the temporary c++ set

Some files were not shown because too many files have changed in this diff Show More