motion-yapper 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +20 -0
- data/.travis.yml +6 -0
- data/Gemfile +5 -0
- data/Gemfile.lock +63 -0
- data/README.md +16 -0
- data/Rakefile +20 -0
- data/app/app_delegate.rb +5 -0
- data/lib/yapper.rb +30 -0
- data/lib/yapper/attachment.rb +48 -0
- data/lib/yapper/bson.rb +20 -0
- data/lib/yapper/config.rb +18 -0
- data/lib/yapper/db.rb +151 -0
- data/lib/yapper/document.rb +54 -0
- data/lib/yapper/document/attachment.rb +26 -0
- data/lib/yapper/document/callbacks.rb +86 -0
- data/lib/yapper/document/persistance.rb +171 -0
- data/lib/yapper/document/relation.rb +84 -0
- data/lib/yapper/document/selection.rb +100 -0
- data/lib/yapper/extensions.rb +80 -0
- data/lib/yapper/log.rb +5 -0
- data/lib/yapper/sync.rb +134 -0
- data/lib/yapper/sync/data.rb +12 -0
- data/lib/yapper/sync/event.rb +194 -0
- data/lib/yapper/sync/queue.rb +164 -0
- data/lib/yapper/timestamps.rb +16 -0
- data/lib/yapper/version.rb +3 -0
- data/lib/yapper/yapper.rb +2 -0
- data/spec/helpers/time_helper.rb +3 -0
- data/spec/integration/all_spec.rb +40 -0
- data/spec/integration/callback_spec.rb +87 -0
- data/spec/integration/db_spec.rb +40 -0
- data/spec/integration/find_spec.rb +51 -0
- data/spec/integration/persistance_spec.rb +118 -0
- data/spec/integration/relation_spec.rb +174 -0
- data/spec/integration/sync_spec.rb +42 -0
- data/spec/integration/timestamps_spec.rb +34 -0
- data/spec/integration/types_spec.rb +23 -0
- data/spec/integration/when_spec.rb +29 -0
- data/spec/integration/where_spec.rb +132 -0
- data/vendor/Podfile.lock +24 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +641 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +1396 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +133 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +327 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +113 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +321 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +71 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +150 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +75 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +157 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +43 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +68 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +143 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +370 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +848 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +89 -0
- data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +167 -0
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +78 -0
- data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +191 -0
- data/vendor/Pods/AFNetworking/LICENSE +19 -0
- data/vendor/Pods/AFNetworking/README.md +208 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +641 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +133 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +113 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +71 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +75 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +43 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +68 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +370 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +89 -0
- data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +78 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/ContextFilterLogFormatter.h +65 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +41 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +102 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +334 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +601 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +167 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DispatchQueueLogFormatter.h +116 -0
- data/vendor/Pods/BuildHeaders/NSData+MD5Digest/NSData+MD5Digest.h +18 -0
- data/vendor/Pods/BuildHeaders/Reachability/Reachability.h +109 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +90 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +20 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +547 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +447 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnectionState.h +29 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +37 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtension.h +15 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionConnection.h +11 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +440 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionTransaction.h +11 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +108 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewConnection.h +12 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +19 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +39 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearch.h +89 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchConnection.h +32 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +69 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +79 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchTransaction.h +68 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseLogging.h +158 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseManager.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +424 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseQuery.h +42 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +100 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexConnection.h +33 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +73 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetup.h +33 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +58 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseStatement.h +13 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseString.h +121 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +541 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +186 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +272 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChangePrivate.h +94 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +115 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +825 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappingsPrivate.h +72 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +56 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPage.h +36 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPageMetadata.h +27 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +153 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptions.h +330 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +447 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapMemoryTable.h +74 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapNull.h +17 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapSet.h +41 -0
- data/vendor/Pods/BuildHeaders/YapDatabase/YapTouch.h +15 -0
- data/vendor/Pods/CocoaLumberjack/LICENSE.txt +18 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +41 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +99 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +102 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +727 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +334 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1353 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +601 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +1083 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +167 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +1479 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.h +65 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.m +191 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.h +116 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.m +251 -0
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +7 -0
- data/vendor/Pods/CocoaLumberjack/README.markdown +37 -0
- data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +641 -0
- data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +133 -0
- data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +113 -0
- data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +71 -0
- data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +75 -0
- data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +43 -0
- data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +68 -0
- data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +370 -0
- data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +89 -0
- data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +78 -0
- data/vendor/Pods/Headers/CocoaLumberjack/ContextFilterLogFormatter.h +65 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +41 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +102 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +334 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +601 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +167 -0
- data/vendor/Pods/Headers/CocoaLumberjack/DispatchQueueLogFormatter.h +116 -0
- data/vendor/Pods/Headers/NSData+MD5Digest/NSData+MD5Digest.h +18 -0
- data/vendor/Pods/Headers/Reachability/Reachability.h +109 -0
- data/vendor/Pods/Headers/YapDatabase/YapCache.h +90 -0
- data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +20 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +547 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +447 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnectionState.h +29 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseDefaults.h +37 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtension.h +15 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionConnection.h +11 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionPrivate.h +440 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionTransaction.h +11 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +108 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewConnection.h +12 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewPrivate.h +19 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +39 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearch.h +89 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchConnection.h +32 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchPrivate.h +69 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +79 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchTransaction.h +68 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseLogging.h +158 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseManager.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabasePrivate.h +424 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseQuery.h +42 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +100 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexConnection.h +33 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +73 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexSetup.h +33 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +58 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseStatement.h +13 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseString.h +121 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +541 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +186 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +272 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChangePrivate.h +94 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +115 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +825 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappingsPrivate.h +72 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +56 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPage.h +36 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPageMetadata.h +27 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPrivate.h +153 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptions.h +330 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +447 -0
- data/vendor/Pods/Headers/YapDatabase/YapMemoryTable.h +74 -0
- data/vendor/Pods/Headers/YapDatabase/YapNull.h +17 -0
- data/vendor/Pods/Headers/YapDatabase/YapSet.h +41 -0
- data/vendor/Pods/Headers/YapDatabase/YapTouch.h +15 -0
- data/vendor/Pods/Headers/____Pods-AFNetworking-prefix.h +17 -0
- data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +5 -0
- data/vendor/Pods/Headers/____Pods-NSData+MD5Digest-prefix.h +5 -0
- data/vendor/Pods/Headers/____Pods-Reachability-prefix.h +5 -0
- data/vendor/Pods/Headers/____Pods-YapDatabase-prefix.h +5 -0
- data/vendor/Pods/Headers/____Pods-environment.h +38 -0
- data/vendor/Pods/Manifest.lock +24 -0
- data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.h +18 -0
- data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.m +39 -0
- data/vendor/Pods/NSData+MD5Digest/README.md +11 -0
- data/vendor/Pods/Pods-AFNetworking-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-AFNetworking-dummy.m +5 -0
- data/vendor/Pods/Pods-AFNetworking-prefix.pch +17 -0
- data/vendor/Pods/Pods-AFNetworking.xcconfig +1 -0
- data/vendor/Pods/Pods-Acknowledgements.markdown +96 -0
- data/vendor/Pods/Pods-Acknowledgements.plist +142 -0
- data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-CocoaLumberjack-dummy.m +5 -0
- data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +5 -0
- data/vendor/Pods/Pods-CocoaLumberjack.xcconfig +0 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-dummy.m +5 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-prefix.pch +5 -0
- data/vendor/Pods/Pods-NSData+MD5Digest.xcconfig +0 -0
- data/vendor/Pods/Pods-Reachability-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-Reachability-dummy.m +5 -0
- data/vendor/Pods/Pods-Reachability-prefix.pch +5 -0
- data/vendor/Pods/Pods-Reachability.xcconfig +1 -0
- data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +5 -0
- data/vendor/Pods/Pods-YapDatabase-dummy.m +5 -0
- data/vendor/Pods/Pods-YapDatabase-prefix.pch +5 -0
- data/vendor/Pods/Pods-YapDatabase.xcconfig +1 -0
- data/vendor/Pods/Pods-dummy.m +5 -0
- data/vendor/Pods/Pods-environment.h +38 -0
- data/vendor/Pods/Pods-resources.sh +68 -0
- data/vendor/Pods/Pods.bridgesupport +5096 -0
- data/vendor/Pods/Pods.xcconfig +5 -0
- data/vendor/Pods/Pods.xcodeproj/project.pbxproj +5536 -0
- data/vendor/Pods/Reachability/LICENCE.txt +24 -0
- data/vendor/Pods/Reachability/README.md +65 -0
- data/vendor/Pods/Reachability/Reachability.h +109 -0
- data/vendor/Pods/Reachability/Reachability.m +527 -0
- data/vendor/Pods/YapDatabase/LICENSE.txt +18 -0
- data/vendor/Pods/YapDatabase/README.md +30 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +19 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +108 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +175 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.h +12 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.m +41 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +39 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +966 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +69 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.h +89 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.m +146 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.h +32 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +298 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.h +79 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.m +95 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.h +68 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +1352 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +440 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.h +15 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +58 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.h +11 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +46 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.h +11 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +180 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +73 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +100 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +149 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.h +33 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +330 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.h +33 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +184 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.h +58 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +1166 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewChangePrivate.h +94 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewMappingsPrivate.h +72 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.h +36 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.mm +296 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.h +27 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.m +28 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +153 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewRangeOptionsPrivate.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +272 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +2494 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +825 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +1567 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.h +330 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.m +141 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +186 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +191 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +115 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +897 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +56 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.m +27 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +447 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +4505 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +90 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +453 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.h +29 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.m +48 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +37 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +83 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.h +158 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.m +73 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.m +56 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +424 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.h +13 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.m +26 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseString.h +121 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.h +74 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.m +603 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.h +17 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +31 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.h +15 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.m +31 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +20 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +194 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.h +42 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.m +96 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.h +41 -0
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.m +82 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +547 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +2022 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +447 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +3874 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +541 -0
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +5282 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +16 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +13 -0
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +20 -0
- data/yapper.gemspec +24 -0
- metadata +458 -0
@@ -0,0 +1,29 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
#import "YapDatabaseConnection.h"
|
3
|
+
|
4
|
+
|
5
|
+
@interface YapDatabaseConnectionState : NSObject {
|
6
|
+
@private
|
7
|
+
dispatch_semaphore_t writeSemaphore;
|
8
|
+
|
9
|
+
@public
|
10
|
+
__weak YapDatabaseConnection *connection;
|
11
|
+
|
12
|
+
BOOL yapLevelSharedReadLock;
|
13
|
+
BOOL sqlLevelSharedReadLock;
|
14
|
+
BOOL longLivedReadTransaction;
|
15
|
+
|
16
|
+
BOOL yapLevelExclusiveWriteLock;
|
17
|
+
BOOL waitingForWriteLock;
|
18
|
+
|
19
|
+
uint64_t lastKnownSnapshot;
|
20
|
+
}
|
21
|
+
|
22
|
+
- (id)initWithConnection:(YapDatabaseConnection *)connection;
|
23
|
+
|
24
|
+
- (void)prepareWriteLock;
|
25
|
+
|
26
|
+
- (void)waitForWriteLock;
|
27
|
+
- (void)signalWriteLock;
|
28
|
+
|
29
|
+
@end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#import "YapDatabaseConnectionState.h"
|
2
|
+
|
3
|
+
#if ! __has_feature(objc_arc)
|
4
|
+
#warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC).
|
5
|
+
#endif
|
6
|
+
|
7
|
+
|
8
|
+
@implementation YapDatabaseConnectionState
|
9
|
+
|
10
|
+
- (id)initWithConnection:(YapDatabaseConnection *)inConnection
|
11
|
+
{
|
12
|
+
if ((self = [super init]))
|
13
|
+
{
|
14
|
+
connection = inConnection;
|
15
|
+
}
|
16
|
+
return self;
|
17
|
+
}
|
18
|
+
|
19
|
+
- (void)dealloc
|
20
|
+
{
|
21
|
+
#if !OS_OBJECT_USE_OBJC
|
22
|
+
if (writeSemaphore)
|
23
|
+
dispatch_release(writeSemaphore);
|
24
|
+
#endif
|
25
|
+
}
|
26
|
+
|
27
|
+
- (void)prepareWriteLock;
|
28
|
+
{
|
29
|
+
if (writeSemaphore == NULL) {
|
30
|
+
writeSemaphore = dispatch_semaphore_create(0);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
|
34
|
+
- (void)waitForWriteLock
|
35
|
+
{
|
36
|
+
if (writeSemaphore) {
|
37
|
+
dispatch_semaphore_wait(writeSemaphore, DISPATCH_TIME_FOREVER);
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
- (void)signalWriteLock
|
42
|
+
{
|
43
|
+
if (writeSemaphore) {
|
44
|
+
dispatch_semaphore_signal(writeSemaphore);
|
45
|
+
}
|
46
|
+
}
|
47
|
+
|
48
|
+
@end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
|
3
|
+
#import "YapDatabaseConnection.h"
|
4
|
+
|
5
|
+
/**
|
6
|
+
* When a connection is created via [database newConnection] is will be handed one of these objects.
|
7
|
+
* Thus the connection will inherit its initial configuration via the defaults configured for the parent database.
|
8
|
+
*
|
9
|
+
* Of course, the connection may then override these default configuration values, and configure itself as needed.
|
10
|
+
*
|
11
|
+
* @see YapDatabase defaultObjectCacheEnabled
|
12
|
+
* @see YapDatabase defaultObjectCacheLimit
|
13
|
+
*
|
14
|
+
* @see YapDatabase defaultMetadataCacheEnabled
|
15
|
+
* @see YapDatabase defaultMetadataCacheLimit
|
16
|
+
*
|
17
|
+
* @see YapDatabase defaultObjectPolicy
|
18
|
+
* @see YapDatabase defaultMetadataPolicy
|
19
|
+
*
|
20
|
+
* @see YapDatabase defaultAutoFlushMemoryLevel
|
21
|
+
**/
|
22
|
+
@interface YapDatabaseDefaults : NSObject <NSCopying>
|
23
|
+
|
24
|
+
@property (nonatomic, assign, readwrite) BOOL objectCacheEnabled;
|
25
|
+
@property (nonatomic, assign, readwrite) NSUInteger objectCacheLimit;
|
26
|
+
|
27
|
+
@property (nonatomic, assign, readwrite) BOOL metadataCacheEnabled;
|
28
|
+
@property (nonatomic, assign, readwrite) NSUInteger metadataCacheLimit;
|
29
|
+
|
30
|
+
@property (nonatomic, assign, readwrite) YapDatabasePolicy objectPolicy;
|
31
|
+
@property (nonatomic, assign, readwrite) YapDatabasePolicy metadataPolicy;
|
32
|
+
|
33
|
+
#if TARGET_OS_IPHONE
|
34
|
+
@property (nonatomic, assign, readwrite) int autoFlushMemoryLevel;
|
35
|
+
#endif
|
36
|
+
|
37
|
+
@end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
#import "YapDatabaseDefaults.h"
|
2
|
+
|
3
|
+
|
4
|
+
@implementation YapDatabaseDefaults
|
5
|
+
|
6
|
+
@synthesize objectCacheEnabled = objectCacheEnabled;
|
7
|
+
@synthesize objectCacheLimit = objectCacheLimit;
|
8
|
+
|
9
|
+
@synthesize metadataCacheEnabled = metadataCacheEnabled;
|
10
|
+
@synthesize metadataCacheLimit = metadataCacheLimit;
|
11
|
+
|
12
|
+
@synthesize objectPolicy = objectPolicy;
|
13
|
+
@synthesize metadataPolicy = metadataPolicy;
|
14
|
+
|
15
|
+
#if TARGET_OS_IPHONE
|
16
|
+
@synthesize autoFlushMemoryLevel = autoFlushMemoryLevel;
|
17
|
+
#endif
|
18
|
+
|
19
|
+
- (id)init
|
20
|
+
{
|
21
|
+
if ((self = [super init]))
|
22
|
+
{
|
23
|
+
objectCacheEnabled = YES;
|
24
|
+
objectCacheLimit = 250;
|
25
|
+
|
26
|
+
metadataCacheEnabled = YES;
|
27
|
+
metadataCacheLimit = 500;
|
28
|
+
|
29
|
+
objectPolicy = YapDatabasePolicyContainment;
|
30
|
+
metadataPolicy = YapDatabasePolicyContainment;
|
31
|
+
|
32
|
+
#if TARGET_OS_IPHONE
|
33
|
+
autoFlushMemoryLevel = YapDatabaseConnectionFlushMemoryLevelMild;
|
34
|
+
#endif
|
35
|
+
}
|
36
|
+
return self;
|
37
|
+
}
|
38
|
+
|
39
|
+
- (id)copyWithZone:(NSZone *)zone
|
40
|
+
{
|
41
|
+
YapDatabaseDefaults *copy = [[[self class] alloc] init];
|
42
|
+
|
43
|
+
copy->objectCacheEnabled = objectCacheEnabled;
|
44
|
+
copy->objectCacheLimit = objectCacheLimit;
|
45
|
+
|
46
|
+
copy->metadataCacheEnabled = metadataCacheEnabled;
|
47
|
+
copy->metadataCacheLimit = metadataCacheLimit;
|
48
|
+
|
49
|
+
copy->objectPolicy = objectPolicy;
|
50
|
+
copy->metadataPolicy = metadataPolicy;
|
51
|
+
|
52
|
+
#if TARGET_OS_IPHONE
|
53
|
+
copy->autoFlushMemoryLevel = autoFlushMemoryLevel;
|
54
|
+
#endif
|
55
|
+
|
56
|
+
return copy;
|
57
|
+
}
|
58
|
+
|
59
|
+
- (void)setObjectPolicy:(YapDatabasePolicy)newObjectPolicy
|
60
|
+
{
|
61
|
+
// sanity check
|
62
|
+
switch (newObjectPolicy)
|
63
|
+
{
|
64
|
+
case YapDatabasePolicyContainment :
|
65
|
+
case YapDatabasePolicyShare :
|
66
|
+
case YapDatabasePolicyCopy : objectPolicy = newObjectPolicy; break;
|
67
|
+
default : objectPolicy = YapDatabasePolicyContainment; // revert to default
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
- (void)setMetadataPolicy:(YapDatabasePolicy)newMetadataPolicy
|
72
|
+
{
|
73
|
+
// sanity check
|
74
|
+
switch (newMetadataPolicy)
|
75
|
+
{
|
76
|
+
case YapDatabasePolicyContainment :
|
77
|
+
case YapDatabasePolicyShare :
|
78
|
+
case YapDatabasePolicyCopy : metadataPolicy = newMetadataPolicy; break;
|
79
|
+
default : metadataPolicy = YapDatabasePolicyContainment; // revert to default
|
80
|
+
}
|
81
|
+
}
|
82
|
+
|
83
|
+
@end
|
@@ -0,0 +1,158 @@
|
|
1
|
+
/**
|
2
|
+
* Logging plays a very important role in open-source libraries.
|
3
|
+
*
|
4
|
+
* Good documentation and comments decrease the learning time required to use a library.
|
5
|
+
* But proper logging takes this futher by:
|
6
|
+
* - Providing a way to trace the execution of the library
|
7
|
+
* - Allowing developers to quickly identify subsets of the code that need analysis
|
8
|
+
* - Making it easier for developers to find potential bugs, either in their code or the library
|
9
|
+
* - Drawing attention to potential mis-configurations or mis-uses of the API
|
10
|
+
*
|
11
|
+
* Ultimately logging is an interactive extension to comments.
|
12
|
+
**/
|
13
|
+
|
14
|
+
/**
|
15
|
+
* Define log levels.
|
16
|
+
* YapDatabase uses 4 log levels:
|
17
|
+
*
|
18
|
+
* error - For critical errors that will likely break functionality
|
19
|
+
* warn - For problems that are concerning, but not quite critical
|
20
|
+
* info - For general, but important, information such as performing a database upgrade
|
21
|
+
* verbose - For all the other low-level debugging type information
|
22
|
+
*
|
23
|
+
* Notice that the levels are actually defined using bitwise flags.
|
24
|
+
* This means you have full control to flip individual logs on/off.
|
25
|
+
* For example, you could enable errors and info, but not warnings, if you wanted.
|
26
|
+
**/
|
27
|
+
|
28
|
+
#define YDB_LOG_FLAG_ERROR (1 << 0) // 0...00001
|
29
|
+
#define YDB_LOG_FLAG_WARN (1 << 1) // 0...00010
|
30
|
+
#define YDB_LOG_FLAG_INFO (1 << 2) // 0...00100
|
31
|
+
#define YDB_LOG_FLAG_VERBOSE (1 << 3) // 0...01000
|
32
|
+
|
33
|
+
#define YDB_LOG_LEVEL_OFF 0 // 0...00000
|
34
|
+
#define YDB_LOG_LEVEL_ERROR (YDB_LOG_LEVEL_OFF | YDB_LOG_FLAG_ERROR) // 0...00001
|
35
|
+
#define YDB_LOG_LEVEL_WARN (YDB_LOG_LEVEL_ERROR | YDB_LOG_FLAG_WARN) // 0...00011
|
36
|
+
#define YDB_LOG_LEVEL_INFO (YDB_LOG_LEVEL_WARN | YDB_LOG_FLAG_INFO) // 0...00111
|
37
|
+
#define YDB_LOG_LEVEL_VERBOSE (YDB_LOG_LEVEL_INFO | YDB_LOG_FLAG_VERBOSE) // 0...01111
|
38
|
+
|
39
|
+
#define YDB_LOG_ERROR (ydbLogLevel & YDB_LOG_LEVEL_ERROR)
|
40
|
+
#define YDB_LOG_WARN (ydbLogLevel & YDB_LOG_LEVEL_WARN)
|
41
|
+
#define YDB_LOG_INFO (ydbLogLevel & YDB_LOG_LEVEL_INFO)
|
42
|
+
#define YDB_LOG_VERBOSE (ydbLogLevel & YDB_LOG_LEVEL_VERBOSE)
|
43
|
+
|
44
|
+
/**
|
45
|
+
* Define trace, which is in addition to log levels.
|
46
|
+
* It may be turned on/off independent of the log level.
|
47
|
+
**/
|
48
|
+
|
49
|
+
#define YDB_LOG_FLAG_TRACE (1 << 4) // 0...10000
|
50
|
+
|
51
|
+
/**
|
52
|
+
* YapDatabase supports multiple logging techniques.
|
53
|
+
*
|
54
|
+
* YapDatabase supports the CocoaLumberjack logging framework.
|
55
|
+
* This is a professional open-source logging library for Mac and iOS development.
|
56
|
+
*
|
57
|
+
* If you're not using Lumberjack then you can downgrade to NSLog.
|
58
|
+
* You can also completely disable logging throughout the entire library.
|
59
|
+
*
|
60
|
+
* You are strongly discouraged from modifying this file.
|
61
|
+
* If you do, you make it more difficult on yourself to merge future bug fixes and improvements from the project.
|
62
|
+
* Instead, you should override the default values in your own application.
|
63
|
+
**/
|
64
|
+
|
65
|
+
#define YapDatabaseLoggingTechnique_Lumberjack 2 // optimal
|
66
|
+
#define YapDatabaseLoggingTechnique_NSLog 1 // slower
|
67
|
+
#define YapDatabaseLoggingTechnique_Disabled 0 // disabled
|
68
|
+
|
69
|
+
#ifndef YapDatabaseLoggingTechnique
|
70
|
+
#define YapDatabaseLoggingTechnique YapDatabaseLoggingTechnique_Lumberjack
|
71
|
+
#endif
|
72
|
+
|
73
|
+
/**
|
74
|
+
* CocoaLumberjack has several useful macros and functions.
|
75
|
+
* If not using Lumberjack, we re-define these macros for our own use.
|
76
|
+
**/
|
77
|
+
|
78
|
+
#if YapDatabaseLoggingTechnique != YapDatabaseLoggingTechnique_Lumberjack
|
79
|
+
|
80
|
+
#ifndef THIS_METHOD
|
81
|
+
#define THIS_METHOD NSStringFromSelector(_cmd)
|
82
|
+
#endif
|
83
|
+
|
84
|
+
#ifndef THIS_FILE
|
85
|
+
NSString *YDBExtractFileNameWithoutExtension(const char *filePath);
|
86
|
+
#define THIS_FILE (YDBExtractFileNameWithoutExtension(__FILE__))
|
87
|
+
#endif
|
88
|
+
|
89
|
+
#endif
|
90
|
+
|
91
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
92
|
+
#if (YapDatabaseLoggingTechnique == YapDatabaseLoggingTechnique_Lumberjack)
|
93
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
94
|
+
|
95
|
+
// Logging Enabled.
|
96
|
+
// Logging uses the CocoaLumberjack framework. (optimal)
|
97
|
+
//
|
98
|
+
// There is a TON of documentation available from the project page:
|
99
|
+
// https://github.com/robbiehanson/CocoaLumberjack
|
100
|
+
|
101
|
+
#import "DDLog.h"
|
102
|
+
|
103
|
+
#define YDBLogAsync NO
|
104
|
+
#define YDBLogContext 27017
|
105
|
+
|
106
|
+
#define YDBLogMaybe(flg, frmt, ...) LOG_OBJC_MAYBE(YDBLogAsync, ydbLogLevel, flg, YDBLogContext, frmt, ##__VA_ARGS__)
|
107
|
+
|
108
|
+
#define YDBLogError(frmt, ...) YDBLogMaybe(YDB_LOG_FLAG_ERROR, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__)
|
109
|
+
#define YDBLogWarn(frmt, ...) YDBLogMaybe(YDB_LOG_FLAG_WARN, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__)
|
110
|
+
#define YDBLogInfo(frmt, ...) YDBLogMaybe(YDB_LOG_FLAG_INFO, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__)
|
111
|
+
#define YDBLogVerbose(frmt, ...) YDBLogMaybe(YDB_LOG_FLAG_VERBOSE, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__)
|
112
|
+
|
113
|
+
#define YDBLogTrace(frmt, ...) YDBLogMaybe(YDB_LOG_FLAG_TRACE, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__)
|
114
|
+
#define YDBLogAutoTrace() YDBLogMaybe(YDB_LOG_FLAG_TRACE, @"%@: %@", THIS_FILE, THIS_METHOD)
|
115
|
+
|
116
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
117
|
+
#elif (YapDatabaseLoggingTechnique == YapDatabaseLoggingTechnique_NSLog)
|
118
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
119
|
+
|
120
|
+
// Logging Enabled.
|
121
|
+
// Logging uses plain old NSLog. (slower)
|
122
|
+
|
123
|
+
#define YDBLogMaybe(flg, frmt, ...) \
|
124
|
+
do{ if(ydbLogLevel & flg) NSLog((@"%@: " frmt), THIS_FILE, ##__VA_ARGS__); } while(0)
|
125
|
+
|
126
|
+
#define YDBLogError(frmt, ...) YDBLogMaybe(YDB_LOG_FLAG_ERROR, frmt, ##__VA_ARGS__)
|
127
|
+
#define YDBLogWarn(frmt, ...) YDBLogMaybe(YDB_LOG_FLAG_WARN, frmt, ##__VA_ARGS__)
|
128
|
+
#define YDBLogInfo(frmt, ...) YDBLogMaybe(YDB_LOG_FLAG_INFO, frmt, ##__VA_ARGS__)
|
129
|
+
#define YDBLogVerbose(frmt, ...) YDBLogMaybe(YDB_LOG_FLAG_VERBOSE, frmt, ##__VA_ARGS__)
|
130
|
+
|
131
|
+
#define YDBLogTrace(frmt, ...) YDBLogMaybe(YDB_LOG_FLAG_TRACE, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__)
|
132
|
+
#define YDBLogAutoTrace() YDBLogMaybe(YDB_LOG_FLAG_TRACE, @"%@: %@", THIS_FILE, THIS_METHOD)
|
133
|
+
|
134
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
135
|
+
#else
|
136
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
137
|
+
|
138
|
+
// Logging Disabled
|
139
|
+
|
140
|
+
#undef YDB_LOG_ERROR
|
141
|
+
#undef YDB_LOG_WARN
|
142
|
+
#undef YDB_LOG_INFO
|
143
|
+
#undef YDB_LOG_VERBOSE
|
144
|
+
|
145
|
+
#define YDB_LOG_ERROR (NO)
|
146
|
+
#define YDB_LOG_WARN (NO)
|
147
|
+
#define YDB_LOG_INFO (NO)
|
148
|
+
#define YDB_LOG_VERBOSE (NO)
|
149
|
+
|
150
|
+
#define YDBLogError(frmt, ...) {}
|
151
|
+
#define YDBLogWarn(frmt, ...) {}
|
152
|
+
#define YDBLogInfo(frmt, ...) {}
|
153
|
+
#define YDBLogVerbose(frmt, ...) {}
|
154
|
+
|
155
|
+
#define YDBLogTrace(frmt, ...) {}
|
156
|
+
#define YDBLogAutoTrace() {}
|
157
|
+
|
158
|
+
#endif
|
@@ -0,0 +1,73 @@
|
|
1
|
+
#import "YapDatabaseLogging.h"
|
2
|
+
|
3
|
+
|
4
|
+
#if YapDatabaseLoggingTechnique != YapDatabaseLoggingTechnique_Lumberjack
|
5
|
+
|
6
|
+
/**
|
7
|
+
* This method is based on CocoaLumberjack's DDExtractFileNameWithoutExtension function.
|
8
|
+
* The copy option has been removed, as we only use __FILE__ as the filePath parameter.
|
9
|
+
**/
|
10
|
+
NSString *YDBExtractFileNameWithoutExtension(const char *filePath)
|
11
|
+
{
|
12
|
+
if (filePath == NULL) return nil;
|
13
|
+
|
14
|
+
char *lastSlash = NULL;
|
15
|
+
char *lastDot = NULL;
|
16
|
+
|
17
|
+
char *p = (char *)filePath;
|
18
|
+
|
19
|
+
while (*p != '\0')
|
20
|
+
{
|
21
|
+
if (*p == '/')
|
22
|
+
lastSlash = p;
|
23
|
+
else if (*p == '.')
|
24
|
+
lastDot = p;
|
25
|
+
|
26
|
+
p++;
|
27
|
+
}
|
28
|
+
|
29
|
+
char *subStr;
|
30
|
+
NSUInteger subLen;
|
31
|
+
|
32
|
+
if (lastSlash)
|
33
|
+
{
|
34
|
+
if (lastDot)
|
35
|
+
{
|
36
|
+
// lastSlash -> lastDot
|
37
|
+
subStr = lastSlash + 1;
|
38
|
+
subLen = lastDot - subStr;
|
39
|
+
}
|
40
|
+
else
|
41
|
+
{
|
42
|
+
// lastSlash -> endOfString
|
43
|
+
subStr = lastSlash + 1;
|
44
|
+
subLen = p - subStr;
|
45
|
+
}
|
46
|
+
}
|
47
|
+
else
|
48
|
+
{
|
49
|
+
if (lastDot)
|
50
|
+
{
|
51
|
+
// startOfString -> lastDot
|
52
|
+
subStr = (char *)filePath;
|
53
|
+
subLen = lastDot - subStr;
|
54
|
+
}
|
55
|
+
else
|
56
|
+
{
|
57
|
+
// startOfString -> endOfString
|
58
|
+
subStr = (char *)filePath;
|
59
|
+
subLen = p - subStr;
|
60
|
+
}
|
61
|
+
}
|
62
|
+
|
63
|
+
// We can take advantage of the fact that __FILE__ is a string literal.
|
64
|
+
// Specifically, we don't need to waste time copying the string.
|
65
|
+
// We can just tell NSString to point to a range within the string literal.
|
66
|
+
|
67
|
+
return [[NSString alloc] initWithBytesNoCopy:subStr
|
68
|
+
length:subLen
|
69
|
+
encoding:NSUTF8StringEncoding
|
70
|
+
freeWhenDone:NO];
|
71
|
+
}
|
72
|
+
|
73
|
+
#endif
|
@@ -0,0 +1,17 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
|
3
|
+
/**
|
4
|
+
* There should only be one YapDatabase or YapCollectionDatabase per file.
|
5
|
+
*
|
6
|
+
* The architecture design is to create a single parent database instance,
|
7
|
+
* and then spawn connections to the database as needed from the parent.
|
8
|
+
*
|
9
|
+
* The architecture is built around this restriction, and is dependent upon it for proper operation.
|
10
|
+
* This class simply helps maintain this requirement.
|
11
|
+
**/
|
12
|
+
@interface YapDatabaseManager : NSObject
|
13
|
+
|
14
|
+
+ (BOOL)registerDatabaseForPath:(NSString *)path;
|
15
|
+
+ (void)deregisterDatabaseForPath:(NSString *)path;
|
16
|
+
|
17
|
+
@end
|