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,541 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
|
3
|
+
@class YapDatabaseConnection;
|
4
|
+
|
5
|
+
/**
|
6
|
+
* Welcome to YapDatabase!
|
7
|
+
*
|
8
|
+
* The project page has a wealth of documentation if you have any questions.
|
9
|
+
* https://github.com/yaptv/YapDatabase
|
10
|
+
*
|
11
|
+
* If you're new to the project you may want to visit the wiki.
|
12
|
+
* https://github.com/yaptv/YapDatabase/wiki
|
13
|
+
*
|
14
|
+
* Transactions represent atomic access to a database.
|
15
|
+
* There are two types of transactions:
|
16
|
+
* - Read-Only transactions
|
17
|
+
* - Read-Write transactions
|
18
|
+
*
|
19
|
+
* Once a transaction is started, all data access within the transaction from that point forward until completion
|
20
|
+
* represents an atomic "snapshot" of the current state of the database. For example, if a read-write operation
|
21
|
+
* occurs in parallel with a read-only transaction, the read-only transaction won't see the changes made by
|
22
|
+
* the read-write operation. But once the read-write operation completes, all transactions started from that point
|
23
|
+
* forward will see the changes.
|
24
|
+
*
|
25
|
+
* You first create and configure a YapDatabase instance.
|
26
|
+
* Then you can spawn one or more connections to the database file.
|
27
|
+
* Each connection allows you to execute transactions in a serial fashion.
|
28
|
+
* For concurrent access, you can create multiple connections,
|
29
|
+
* and execute transactions on each connection simulataneously.
|
30
|
+
*
|
31
|
+
* Concurrency is straight-forward. Here are the rules:
|
32
|
+
*
|
33
|
+
* - You can have multiple connections.
|
34
|
+
* - Every connection is thread-safe.
|
35
|
+
* - You can have multiple read-only transactions simultaneously without blocking.
|
36
|
+
* (Each simultaneous transaction would be going through a separate connection.)
|
37
|
+
* - You can have multiple read-only transactions and a single read-write transaction simultaneously without blocking.
|
38
|
+
* (Each simultaneous transaction would be going through a separate connection.)
|
39
|
+
* - There can only be a single transaction per connection at a time.
|
40
|
+
* (Transactions go through a per-connection serial queue.)
|
41
|
+
* - There can only be a single read-write transaction at a time.
|
42
|
+
* (Read-write transactions go through a per-database serial queue.)
|
43
|
+
**/
|
44
|
+
|
45
|
+
/**
|
46
|
+
* A YapDatabaseReadTransaction encompasses a single read-only database transaction.
|
47
|
+
* You can execute multiple operations within a single transaction.
|
48
|
+
*
|
49
|
+
* A transaction allows you to safely access the database as needed in a thread-safe and optimized manner.
|
50
|
+
**/
|
51
|
+
@interface YapDatabaseReadTransaction : NSObject
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Transactions are light-weight objects created by connections.
|
55
|
+
*
|
56
|
+
* Connections are the parent objects of transactions.
|
57
|
+
* Connections own the transaction objects.
|
58
|
+
*
|
59
|
+
* Transactions store nearly all their state in the parent connection object.
|
60
|
+
* This reduces the memory requirements for transactions objects,
|
61
|
+
* and reduces the overhead associated in creating them.
|
62
|
+
**/
|
63
|
+
@property (nonatomic, unsafe_unretained, readonly) YapDatabaseConnection *connection;
|
64
|
+
|
65
|
+
#pragma mark Count
|
66
|
+
|
67
|
+
/**
|
68
|
+
* Returns the total number of collections.
|
69
|
+
* Each collection may have 1 or more key/object pairs.
|
70
|
+
**/
|
71
|
+
- (NSUInteger)numberOfCollections;
|
72
|
+
|
73
|
+
/**
|
74
|
+
* Returns the total number of keys in the given collection.
|
75
|
+
* Returns zero if the collection doesn't exist (or all key/object pairs from the collection have been removed).
|
76
|
+
**/
|
77
|
+
- (NSUInteger)numberOfKeysInCollection:(NSString *)collection;
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Returns the total number of key/object pairs in the entire database (including all collections).
|
81
|
+
**/
|
82
|
+
- (NSUInteger)numberOfKeysInAllCollections;
|
83
|
+
|
84
|
+
#pragma mark List
|
85
|
+
|
86
|
+
/**
|
87
|
+
* Returns a list of all collection names.
|
88
|
+
**/
|
89
|
+
- (NSArray *)allCollections;
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Returns a list of all keys in the given collection.
|
93
|
+
**/
|
94
|
+
- (NSArray *)allKeysInCollection:(NSString *)collection;
|
95
|
+
|
96
|
+
#pragma mark Primitive
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Primitive access.
|
100
|
+
*
|
101
|
+
* These are available for in-case you store irregular data
|
102
|
+
* that shouldn't go through configured serializer/deserializer.
|
103
|
+
*
|
104
|
+
* @see objectForKey:inCollection:
|
105
|
+
* @see metadataForKey:inCollection:
|
106
|
+
**/
|
107
|
+
- (NSData *)primitiveDataForKey:(NSString *)key inCollection:(NSString *)collection;
|
108
|
+
- (NSData *)primitiveMetadataForKey:(NSString *)key inCollection:(NSString *)collection;
|
109
|
+
- (BOOL)getPrimitiveData:(NSData **)dataPtr
|
110
|
+
primitiveMetadata:(NSData **)primitiveMetadataPtr
|
111
|
+
forKey:(NSString *)key
|
112
|
+
inCollection:(NSString *)collection;
|
113
|
+
|
114
|
+
#pragma mark Object & Metadata
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Object access.
|
118
|
+
* Objects are automatically deserialized using database's configured deserializer.
|
119
|
+
**/
|
120
|
+
- (id)objectForKey:(NSString *)key inCollection:(NSString *)collection;
|
121
|
+
|
122
|
+
/**
|
123
|
+
* Returns whether or not the given key/collection exists in the database.
|
124
|
+
**/
|
125
|
+
- (BOOL)hasObjectForKey:(NSString *)key inCollection:(NSString *)collection;
|
126
|
+
|
127
|
+
/**
|
128
|
+
* Provides access to both object and metadata in a single call.
|
129
|
+
*
|
130
|
+
* @return YES if the key exists in the database. NO otherwise, in which case both object and metadata will be nil.
|
131
|
+
**/
|
132
|
+
- (BOOL)getObject:(id *)objectPtr metadata:(id *)metadataPtr forKey:(NSString *)key inCollection:(NSString *)collection;
|
133
|
+
|
134
|
+
/**
|
135
|
+
* Provides access to the metadata.
|
136
|
+
* This fetches directly from the metadata dictionary stored in memory, and thus never hits the disk.
|
137
|
+
**/
|
138
|
+
- (id)metadataForKey:(NSString *)key inCollection:(NSString *)collection;
|
139
|
+
|
140
|
+
#pragma mark Enumerate
|
141
|
+
|
142
|
+
/**
|
143
|
+
* Fast enumeration over all the collections in the database.
|
144
|
+
*
|
145
|
+
* This uses a "SELECT collection FROM database" operation,
|
146
|
+
* and then steps over the results invoking the given block handler.
|
147
|
+
**/
|
148
|
+
- (void)enumerateCollectionsUsingBlock:(void (^)(NSString *collection, BOOL *stop))block;
|
149
|
+
|
150
|
+
/**
|
151
|
+
* This method is rarely needed, but may be helpful in certain situations.
|
152
|
+
*
|
153
|
+
* This method may be used if you have the key, but not the collection for a particular item.
|
154
|
+
* Please note that this is not the ideal situation.
|
155
|
+
*
|
156
|
+
* Since there may be numerous collections for a given key, this method enumerates all possible collections.
|
157
|
+
**/
|
158
|
+
- (void)enumerateCollectionsForKey:(NSString *)key usingBlock:(void (^)(NSString *collection, BOOL *stop))block;
|
159
|
+
|
160
|
+
/**
|
161
|
+
* Fast enumeration over all keys in the given collection.
|
162
|
+
*
|
163
|
+
* This uses a "SELECT key FROM database WHERE collection = ?" operation,
|
164
|
+
* and then steps over the results invoking the given block handler.
|
165
|
+
**/
|
166
|
+
- (void)enumerateKeysInCollection:(NSString *)collection
|
167
|
+
usingBlock:(void (^)(NSString *key, BOOL *stop))block;
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Fast enumeration over all keys in the given collection.
|
171
|
+
*
|
172
|
+
* This uses a "SELECT collection, key FROM database" operation,
|
173
|
+
* and then steps over the results invoking the given block handler.
|
174
|
+
**/
|
175
|
+
- (void)enumerateKeysInAllCollectionsUsingBlock:(void (^)(NSString *collection, NSString *key, BOOL *stop))block;
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Fast enumeration over all keys and associated metadata in the given collection.
|
179
|
+
*
|
180
|
+
* This uses a "SELECT key, metadata FROM database WHERE collection = ?" operation and steps over the results.
|
181
|
+
*
|
182
|
+
* If you only need to enumerate over certain items (e.g. keys with a particular prefix),
|
183
|
+
* consider using the alternative version below which provides a filter,
|
184
|
+
* allowing you to skip the deserialization step for those items you're not interested in.
|
185
|
+
*
|
186
|
+
* Keep in mind that you cannot modify the collection mid-enumeration (just like any other kind of enumeration).
|
187
|
+
**/
|
188
|
+
- (void)enumerateKeysAndMetadataInCollection:(NSString *)collection
|
189
|
+
usingBlock:(void (^)(NSString *key, id metadata, BOOL *stop))block;
|
190
|
+
|
191
|
+
/**
|
192
|
+
* Fast enumeration over all keys and associated metadata in the given collection.
|
193
|
+
*
|
194
|
+
* From the filter block, simply return YES if you'd like the block handler to be invoked for the given key.
|
195
|
+
* If the filter block returns NO, then the block handler is skipped for the given key,
|
196
|
+
* which avoids the cost associated with deserializing the object.
|
197
|
+
*
|
198
|
+
* Keep in mind that you cannot modify the collection mid-enumeration (just like any other kind of enumeration).
|
199
|
+
**/
|
200
|
+
- (void)enumerateKeysAndMetadataInCollection:(NSString *)collection
|
201
|
+
usingBlock:(void (^)(NSString *key, id metadata, BOOL *stop))block
|
202
|
+
withFilter:(BOOL (^)(NSString *key))filter;
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
/**
|
207
|
+
* Fast enumeration over all key/metadata pairs in all collections.
|
208
|
+
*
|
209
|
+
* This uses a "SELECT metadata FROM database ORDER BY collection ASC" operation, and steps over the results.
|
210
|
+
*
|
211
|
+
* If you only need to enumerate over certain objects (e.g. keys with a particular prefix),
|
212
|
+
* consider using the alternative version below which provides a filter,
|
213
|
+
* allowing you to skip the deserialization step for those objects you're not interested in.
|
214
|
+
*
|
215
|
+
* Keep in mind that you cannot modify the database mid-enumeration (just like any other kind of enumeration).
|
216
|
+
**/
|
217
|
+
- (void)enumerateKeysAndMetadataInAllCollectionsUsingBlock:
|
218
|
+
(void (^)(NSString *collection, NSString *key, id metadata, BOOL *stop))block;
|
219
|
+
|
220
|
+
/**
|
221
|
+
* Fast enumeration over all key/metadata pairs in all collections.
|
222
|
+
*
|
223
|
+
* This uses a "SELECT metadata FROM database ORDER BY collection ASC" operation and steps over the results.
|
224
|
+
*
|
225
|
+
* From the filter block, simply return YES if you'd like the block handler to be invoked for the given key.
|
226
|
+
* If the filter block returns NO, then the block handler is skipped for the given key,
|
227
|
+
* which avoids the cost associated with deserializing the object.
|
228
|
+
*
|
229
|
+
* Keep in mind that you cannot modify the database mid-enumeration (just like any other kind of enumeration).
|
230
|
+
**/
|
231
|
+
- (void)enumerateKeysAndMetadataInAllCollectionsUsingBlock:
|
232
|
+
(void (^)(NSString *collection, NSString *key, id metadata, BOOL *stop))block
|
233
|
+
withFilter:(BOOL (^)(NSString *collection, NSString *key))filter;
|
234
|
+
|
235
|
+
/**
|
236
|
+
* Fast enumeration over all objects in the database.
|
237
|
+
*
|
238
|
+
* This uses a "SELECT key, object from database WHERE collection = ?" operation, and then steps over the results,
|
239
|
+
* deserializing each object, and then invoking the given block handler.
|
240
|
+
*
|
241
|
+
* If you only need to enumerate over certain objects (e.g. keys with a particular prefix),
|
242
|
+
* consider using the alternative version below which provides a filter,
|
243
|
+
* allowing you to skip the serialization step for those objects you're not interested in.
|
244
|
+
**/
|
245
|
+
- (void)enumerateKeysAndObjectsInCollection:(NSString *)collection
|
246
|
+
usingBlock:(void (^)(NSString *key, id object, BOOL *stop))block;
|
247
|
+
|
248
|
+
/**
|
249
|
+
* Fast enumeration over objects in the database for which you're interested in.
|
250
|
+
* The filter block allows you to decide which objects you're interested in.
|
251
|
+
*
|
252
|
+
* From the filter block, simply return YES if you'd like the block handler to be invoked for the given key.
|
253
|
+
* If the filter block returns NO, then the block handler is skipped for the given key,
|
254
|
+
* which avoids the cost associated with deserializing the object.
|
255
|
+
**/
|
256
|
+
- (void)enumerateKeysAndObjectsInCollection:(NSString *)collection
|
257
|
+
usingBlock:(void (^)(NSString *key, id object, BOOL *stop))block
|
258
|
+
withFilter:(BOOL (^)(NSString *key))filter;
|
259
|
+
|
260
|
+
/**
|
261
|
+
* Enumerates all key/object pairs in all collections.
|
262
|
+
*
|
263
|
+
* The enumeration is sorted by collection. That is, it will enumerate fully over a single collection
|
264
|
+
* before moving onto another collection.
|
265
|
+
*
|
266
|
+
* If you only need to enumerate over certain objects (e.g. subset of collections, or keys with a particular prefix),
|
267
|
+
* consider using the alternative version below which provides a filter,
|
268
|
+
* allowing you to skip the serialization step for those objects you're not interested in.
|
269
|
+
**/
|
270
|
+
- (void)enumerateKeysAndObjectsInAllCollectionsUsingBlock:
|
271
|
+
(void (^)(NSString *collection, NSString *key, id object, BOOL *stop))block;
|
272
|
+
|
273
|
+
/**
|
274
|
+
* Enumerates all key/object pairs in all collections.
|
275
|
+
* The filter block allows you to decide which objects you're interested in.
|
276
|
+
*
|
277
|
+
* The enumeration is sorted by collection. That is, it will enumerate fully over a single collection
|
278
|
+
* before moving onto another collection.
|
279
|
+
*
|
280
|
+
* From the filter block, simply return YES if you'd like the block handler to be invoked for the given
|
281
|
+
* collection/key pair. If the filter block returns NO, then the block handler is skipped for the given pair,
|
282
|
+
* which avoids the cost associated with deserializing the object.
|
283
|
+
**/
|
284
|
+
- (void)enumerateKeysAndObjectsInAllCollectionsUsingBlock:
|
285
|
+
(void (^)(NSString *collection, NSString *key, id object, BOOL *stop))block
|
286
|
+
withFilter:(BOOL (^)(NSString *collection, NSString *key))filter;
|
287
|
+
|
288
|
+
/**
|
289
|
+
* Fast enumeration over all rows in the database.
|
290
|
+
*
|
291
|
+
* This uses a "SELECT key, data, metadata from database WHERE collection = ?" operation,
|
292
|
+
* and then steps over the results, deserializing each object & metadata, and then invoking the given block handler.
|
293
|
+
*
|
294
|
+
* If you only need to enumerate over certain rows (e.g. keys with a particular prefix),
|
295
|
+
* consider using the alternative version below which provides a filter,
|
296
|
+
* allowing you to skip the serialization step for those rows you're not interested in.
|
297
|
+
**/
|
298
|
+
- (void)enumerateRowsInCollection:(NSString *)collection
|
299
|
+
usingBlock:(void (^)(NSString *key, id object, id metadata, BOOL *stop))block;
|
300
|
+
|
301
|
+
/**
|
302
|
+
* Fast enumeration over rows in the database for which you're interested in.
|
303
|
+
* The filter block allows you to decide which rows you're interested in.
|
304
|
+
*
|
305
|
+
* From the filter block, simply return YES if you'd like the block handler to be invoked for the given key.
|
306
|
+
* If the filter block returns NO, then the block handler is skipped for the given key,
|
307
|
+
* which avoids the cost associated with deserializing the object & metadata.
|
308
|
+
**/
|
309
|
+
- (void)enumerateRowsInCollection:(NSString *)collection
|
310
|
+
usingBlock:(void (^)(NSString *key, id object, id metadata, BOOL *stop))block
|
311
|
+
withFilter:(BOOL (^)(NSString *key))filter;
|
312
|
+
|
313
|
+
/**
|
314
|
+
* Enumerates all rows in all collections.
|
315
|
+
*
|
316
|
+
* The enumeration is sorted by collection. That is, it will enumerate fully over a single collection
|
317
|
+
* before moving onto another collection.
|
318
|
+
*
|
319
|
+
* If you only need to enumerate over certain rows (e.g. subset of collections, or keys with a particular prefix),
|
320
|
+
* consider using the alternative version below which provides a filter,
|
321
|
+
* allowing you to skip the serialization step for those objects you're not interested in.
|
322
|
+
**/
|
323
|
+
- (void)enumerateRowsInAllCollectionsUsingBlock:
|
324
|
+
(void (^)(NSString *collection, NSString *key, id object, id metadata, BOOL *stop))block;
|
325
|
+
|
326
|
+
/**
|
327
|
+
* Enumerates all rows in all collections.
|
328
|
+
* The filter block allows you to decide which objects you're interested in.
|
329
|
+
*
|
330
|
+
* The enumeration is sorted by collection. That is, it will enumerate fully over a single collection
|
331
|
+
* before moving onto another collection.
|
332
|
+
*
|
333
|
+
* From the filter block, simply return YES if you'd like the block handler to be invoked for the given
|
334
|
+
* collection/key pair. If the filter block returns NO, then the block handler is skipped for the given pair,
|
335
|
+
* which avoids the cost associated with deserializing the object.
|
336
|
+
**/
|
337
|
+
- (void)enumerateRowsInAllCollectionsUsingBlock:
|
338
|
+
(void (^)(NSString *collection, NSString *key, id object, id metadata, BOOL *stop))block
|
339
|
+
withFilter:(BOOL (^)(NSString *collection, NSString *key))filter;
|
340
|
+
|
341
|
+
/**
|
342
|
+
* Enumerates over the given list of keys (unordered).
|
343
|
+
*
|
344
|
+
* This method is faster than fetching individual items as it optimizes cache access.
|
345
|
+
* That is, it will first enumerate over items in the cache and then fetch items from the database,
|
346
|
+
* thus optimizing the cache and reducing query size.
|
347
|
+
*
|
348
|
+
* If any keys are missing from the database, the 'metadata' parameter will be nil.
|
349
|
+
*
|
350
|
+
* IMPORTANT:
|
351
|
+
* Due to cache optimizations, the items may not be enumerated in the same order as the 'keys' parameter.
|
352
|
+
**/
|
353
|
+
- (void)enumerateMetadataForKeys:(NSArray *)keys
|
354
|
+
inCollection:(NSString *)collection
|
355
|
+
unorderedUsingBlock:(void (^)(NSUInteger keyIndex, id metadata, BOOL *stop))block;
|
356
|
+
|
357
|
+
/**
|
358
|
+
* Enumerates over the given list of keys (unordered).
|
359
|
+
*
|
360
|
+
* This method is faster than fetching individual items as it optimizes cache access.
|
361
|
+
* That is, it will first enumerate over items in the cache and then fetch items from the database,
|
362
|
+
* thus optimizing the cache and reducing query size.
|
363
|
+
*
|
364
|
+
* If any keys are missing from the database, the 'object' parameter will be nil.
|
365
|
+
*
|
366
|
+
* IMPORTANT:
|
367
|
+
* Due to cache optimizations, the items may not be enumerated in the same order as the 'keys' parameter.
|
368
|
+
**/
|
369
|
+
- (void)enumerateObjectsForKeys:(NSArray *)keys
|
370
|
+
inCollection:(NSString *)collection
|
371
|
+
unorderedUsingBlock:(void (^)(NSUInteger keyIndex, id object, BOOL *stop))block;
|
372
|
+
|
373
|
+
/**
|
374
|
+
* Enumerates over the given list of keys (unordered).
|
375
|
+
*
|
376
|
+
* This method is faster than fetching individual items as it optimizes cache access.
|
377
|
+
* That is, it will first enumerate over items in the cache and then fetch items from the database,
|
378
|
+
* thus optimizing the cache and reducing query size.
|
379
|
+
*
|
380
|
+
* If any keys are missing from the database, the 'object' and 'metadata' parameter will be nil.
|
381
|
+
*
|
382
|
+
* IMPORTANT:
|
383
|
+
* Due to cache optimizations, the items may not be enumerated in the same order as the 'keys' parameter.
|
384
|
+
**/
|
385
|
+
- (void)enumerateRowsForKeys:(NSArray *)keys
|
386
|
+
inCollection:(NSString *)collection
|
387
|
+
unorderedUsingBlock:(void (^)(NSUInteger keyIndex, id object, id metadata, BOOL *stop))block;
|
388
|
+
|
389
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
390
|
+
#pragma mark Extensions
|
391
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
392
|
+
|
393
|
+
/**
|
394
|
+
* Returns an extension transaction corresponding to the extension type registered under the given name.
|
395
|
+
* If the extension has not yet been opened, it is done so automatically.
|
396
|
+
*
|
397
|
+
* @return
|
398
|
+
* A subclass of YapDatabaseExtensionTransaction,
|
399
|
+
* according to the type of extension registered under the given name.
|
400
|
+
*
|
401
|
+
* One must register an extension with the database before it can be accessed from within connections or transactions.
|
402
|
+
* After registration everything works automatically using just the registered extension name.
|
403
|
+
*
|
404
|
+
* @see [YapDatabase registerExtension:withName:]
|
405
|
+
**/
|
406
|
+
- (id)extension:(NSString *)extensionName;
|
407
|
+
- (id)ext:(NSString *)extensionName; // <-- Shorthand (same as extension: method)
|
408
|
+
|
409
|
+
@end
|
410
|
+
|
411
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
412
|
+
#pragma mark -
|
413
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
414
|
+
|
415
|
+
@interface YapDatabaseReadWriteTransaction : YapDatabaseReadTransaction
|
416
|
+
|
417
|
+
/**
|
418
|
+
* Under normal circumstances, when a read-write transaction block completes,
|
419
|
+
* the changes are automatically committed. If, however, something goes wrong and
|
420
|
+
* you'd like to abort and discard all changes made within the transaction,
|
421
|
+
* then invoke this method.
|
422
|
+
*
|
423
|
+
* You should generally return (exit the transaction block) after invoking this method.
|
424
|
+
* Any changes made within the the transaction before and after invoking this method will be discarded.
|
425
|
+
**/
|
426
|
+
- (void)rollback;
|
427
|
+
|
428
|
+
/**
|
429
|
+
* The YapDatabaseModifiedNotification is posted following a readwrite transaction which made changes.
|
430
|
+
*
|
431
|
+
* These notifications are used in a variety of ways:
|
432
|
+
* - They may be used as a general notification mechanism to detect changes to the database.
|
433
|
+
* - They may be used by extensions to post change information.
|
434
|
+
* For example, YapDatabaseView will post the index changes, which can easily be used to animate a tableView.
|
435
|
+
* - They are integrated into the architecture of long-lived transactions in order to maintain a steady state.
|
436
|
+
*
|
437
|
+
* Thus it is recommended you integrate your own notification information into this existing notification,
|
438
|
+
* as opposed to broadcasting your own separate notification.
|
439
|
+
**/
|
440
|
+
- (void)setCustomObjectForYapDatabaseModifiedNotification:(id)object;
|
441
|
+
|
442
|
+
#pragma mark Primitive
|
443
|
+
|
444
|
+
/**
|
445
|
+
* Primitive access.
|
446
|
+
*
|
447
|
+
* These are available in-case you store irregular data
|
448
|
+
* that shouldn't go through configured serializer/deserializer.
|
449
|
+
*
|
450
|
+
* @see objectForKey:collection:
|
451
|
+
**/
|
452
|
+
- (void)setPrimitiveData:(NSData *)data forKey:(NSString *)key inCollection:(NSString *)collection;
|
453
|
+
- (void)setPrimitiveData:(NSData *)data
|
454
|
+
forKey:(NSString *)key
|
455
|
+
inCollection:(NSString *)collection
|
456
|
+
withPrimitiveMetadata:(NSData *)primitiveMetadata;
|
457
|
+
- (void)setPrimitiveMetadata:(NSData *)primitiveMetadata forKey:(NSString *)key inCollection:(NSString *)collection;
|
458
|
+
|
459
|
+
#pragma mark Object & Metadata
|
460
|
+
|
461
|
+
/**
|
462
|
+
* Sets the object for the given key/collection.
|
463
|
+
* Objects are automatically serialized using the database's configured serializer.
|
464
|
+
*
|
465
|
+
* You may optionally pass metadata about the object.
|
466
|
+
* The metadata is also written to the database for persistent storage, and thus persists between sessions.
|
467
|
+
* Metadata is serialized/deserialized to/from disk just like the object.
|
468
|
+
**/
|
469
|
+
- (void)setObject:(id)object forKey:(NSString *)key inCollection:(NSString *)collection;
|
470
|
+
- (void)setObject:(id)object forKey:(NSString *)key inCollection:(NSString *)collection withMetadata:(id)metadata;
|
471
|
+
|
472
|
+
/**
|
473
|
+
* Updates the metadata, and only the metadata, for the given key/collection.
|
474
|
+
* The object for the key doesn't change.
|
475
|
+
*
|
476
|
+
* Note: If there is no stored object for the given key/collection, this method does nothing.
|
477
|
+
* If you pass nil for the metadata, any given metadata associated with the key/colleciton is removed.
|
478
|
+
**/
|
479
|
+
- (void)setMetadata:(id)metadata forKey:(NSString *)key inCollection:(NSString *)collection;
|
480
|
+
|
481
|
+
#pragma mark Touch
|
482
|
+
|
483
|
+
/**
|
484
|
+
* You can touch an object if you want to mark it as updated without actually writing any changes to disk.
|
485
|
+
*
|
486
|
+
* For example:
|
487
|
+
*
|
488
|
+
* You have a BNBook object in your database.
|
489
|
+
* One of the properties of the book object is a URL pointing to an image for the front cover of the book.
|
490
|
+
* This image gets changed. Thus the UI representation of the book needs to be updated to reflect the updated image.
|
491
|
+
* You realize that all your views are already listening for YapDatabaseModified notifications,
|
492
|
+
* so if you update the object in the database, all your views are already wired to update the UI appropriately.
|
493
|
+
* However, the actual object itself didn't change. So while there technically isn't any reason to
|
494
|
+
* update the object on disk, doing so would be the most efficient way to keep the UI up-to-date.
|
495
|
+
*
|
496
|
+
* And this is exactly what the touch methods were designed for.
|
497
|
+
* It won't actually cause the object to get rewritten to disk.
|
498
|
+
* However, it will mark the object as "updated" within the YapDatabaseModified notification,
|
499
|
+
* so any UI components listening for changes will see this object as updated, and can update as appropriate.
|
500
|
+
*
|
501
|
+
* The touchObjectForKey:inCollection: method is similar to calling setObject:forKey:inCollection:withMetadata:,
|
502
|
+
* and passing the object & metadata that already exists for the key. But without the overhead of fetching the items,
|
503
|
+
* or re-writing the items to disk.
|
504
|
+
*
|
505
|
+
* The touchMetadataForKey: method is similar to calling setMetadata:forKey:,
|
506
|
+
* and passing the metadata that already exists for the key. But without the overhead of fetching the metadata,
|
507
|
+
* or re-writing the metadata to disk.
|
508
|
+
*
|
509
|
+
* Note: It is safe to touch objects during enumeration.
|
510
|
+
* Normally, altering the database while enumerating it will result in an exception (just like altering an array
|
511
|
+
* while enumerating it). However, it's safe to touch objects during enumeration.
|
512
|
+
**/
|
513
|
+
- (void)touchObjectForKey:(NSString *)key inCollection:(NSString *)collection;
|
514
|
+
- (void)touchMetadataForKey:(NSString *)key inCollection:(NSString *)collection;
|
515
|
+
|
516
|
+
#pragma mark Remove
|
517
|
+
|
518
|
+
/**
|
519
|
+
* Deletes the database row with the given key/collection.
|
520
|
+
* This method is automatically called if you invoke
|
521
|
+
* setObject:forKey:collection: or setPrimitiveData:forKey:collection: and pass nil object/data.
|
522
|
+
**/
|
523
|
+
- (void)removeObjectForKey:(NSString *)key inCollection:(NSString *)collection;
|
524
|
+
|
525
|
+
/**
|
526
|
+
* Deletes the database rows with the given keys in the given collection.
|
527
|
+
**/
|
528
|
+
- (void)removeObjectsForKeys:(NSArray *)keys inCollection:(NSString *)collection;
|
529
|
+
|
530
|
+
/**
|
531
|
+
* Deletes every key/object pair from the given collection.
|
532
|
+
* No trace of the collection will remain afterwards.
|
533
|
+
**/
|
534
|
+
- (void)removeAllObjectsInCollection:(NSString *)collection;
|
535
|
+
|
536
|
+
/**
|
537
|
+
* Removes every key/object pair in the entire database (from all collections).
|
538
|
+
**/
|
539
|
+
- (void)removeAllObjectsInAllCollections;
|
540
|
+
|
541
|
+
@end
|