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,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,15 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
|
3
|
+
#import "YapDatabaseExtensionConnection.h"
|
4
|
+
#import "YapDatabaseExtensionTransaction.h"
|
5
|
+
|
6
|
+
|
7
|
+
@interface YapDatabaseExtension : NSObject
|
8
|
+
|
9
|
+
/**
|
10
|
+
* After an extension has been successfully registered with a database,
|
11
|
+
* the registeredName property will be set by the database.
|
12
|
+
**/
|
13
|
+
@property (atomic, copy, readonly) NSString *registeredName;
|
14
|
+
|
15
|
+
@end
|
@@ -0,0 +1,440 @@
|
|
1
|
+
#import <Foundation/Foundation.h>
|
2
|
+
|
3
|
+
#import "YapDatabaseExtension.h"
|
4
|
+
#import "YapDatabaseExtensionConnection.h"
|
5
|
+
#import "YapDatabaseExtensionTransaction.h"
|
6
|
+
|
7
|
+
#import "YapDatabase.h"
|
8
|
+
#import "YapDatabaseConnection.h"
|
9
|
+
#import "YapDatabaseTransaction.h"
|
10
|
+
|
11
|
+
#import "sqlite3.h"
|
12
|
+
|
13
|
+
|
14
|
+
@interface YapDatabaseExtension ()
|
15
|
+
|
16
|
+
/**
|
17
|
+
* Subclasses MUST implement this method.
|
18
|
+
*
|
19
|
+
* This method is used when unregistering an extension in order to drop the related tables.
|
20
|
+
**/
|
21
|
+
+ (void)dropTablesForRegisteredName:(NSString *)registeredName
|
22
|
+
withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Subclasses may OPTIONALLY implement this method.
|
26
|
+
*
|
27
|
+
* If an extension class is renamed this method should be used to properly transition.
|
28
|
+
* The extension architecture will verify that a re-registered extension is using the same
|
29
|
+
* extension class that it was previously using. If the class names differ, then the extension architecture
|
30
|
+
* will automatically try to unregister the previous extension using the previous extension class.
|
31
|
+
*
|
32
|
+
* That is, it will attempt to invoke [PreviousExtensionClass dropTablesForRegisteredName: withTransaction:].
|
33
|
+
* Of course this won't work because the PreviousExtensionClass no longer exists.
|
34
|
+
* So the end result is that you will likely see the database spit out a warning like this:
|
35
|
+
*
|
36
|
+
* - Dropping tables for previously registered extension with name(order),
|
37
|
+
* class(YapDatabaseQuack) for new class(YapDatabaseDuck)
|
38
|
+
* - Unable to drop tables for previously registered extension with name(order),
|
39
|
+
* unknown class(YapDatabaseQuack)
|
40
|
+
*
|
41
|
+
* This method helps the extension architecture to understand what's happening, and it won't spit out any warnings.
|
42
|
+
*
|
43
|
+
* The default implementation returns nil.
|
44
|
+
**/
|
45
|
+
+ (NSArray *)previousClassNames;
|
46
|
+
|
47
|
+
/**
|
48
|
+
* After an extension has been successfully registered with a database,
|
49
|
+
* the registeredName property will be set by the database.
|
50
|
+
*
|
51
|
+
* This property is set by YapDatabase after a successful registration.
|
52
|
+
* It should be considered read-only once set.
|
53
|
+
**/
|
54
|
+
@property (atomic, copy, readwrite) NSString *registeredName;
|
55
|
+
|
56
|
+
/**
|
57
|
+
* Subclasses MUST implement this method.
|
58
|
+
* This method is called during the view registration process to enusre the extension supports the database type.
|
59
|
+
* The registered extensions are passed too, in case dependencies need to be checked.
|
60
|
+
*
|
61
|
+
* Return YES if the class/instance supports the database configuration.
|
62
|
+
**/
|
63
|
+
- (BOOL)supportsDatabase:(YapDatabase *)database withRegisteredExtensions:(NSDictionary *)registeredExtensions;
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Subclasses MUST implement this method IF they have dependencies.
|
67
|
+
* This method is called during the view registration simply to record the needed dependencies.
|
68
|
+
* If any of the dependencies are unregistered, this extension will automatically be unregistered.
|
69
|
+
*
|
70
|
+
* Return a set of NSString objects, representing the name(s) of registered extensions
|
71
|
+
* that this extension is dependent upon.
|
72
|
+
*
|
73
|
+
* If there are no dependencies, return nil (or an empty set).
|
74
|
+
* The default implementation returns nil.
|
75
|
+
**/
|
76
|
+
- (NSSet *)dependencies;
|
77
|
+
|
78
|
+
/**
|
79
|
+
* Subclasses MUST implement this method.
|
80
|
+
* Returns a proper instance of the YapDatabaseExtensionConnection subclass.
|
81
|
+
**/
|
82
|
+
- (YapDatabaseExtensionConnection *)newConnection:(YapDatabaseConnection *)databaseConnection;
|
83
|
+
|
84
|
+
@end
|
85
|
+
|
86
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
87
|
+
#pragma mark -
|
88
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
89
|
+
|
90
|
+
@interface YapDatabaseExtensionConnection () {
|
91
|
+
|
92
|
+
// You MUST store a strong reference to the parent.
|
93
|
+
// You MUST store an unretained reference to the corresponding database connection.
|
94
|
+
//
|
95
|
+
// The architecture of the database, throughout the database classes and extensions,
|
96
|
+
// is such that connections retain their parents, which are the base classes.
|
97
|
+
// This is needed so the base classes cannot disappear until their connections have all finished.
|
98
|
+
// Otherwise a connection might get orphaned, and a crash would ensue.
|
99
|
+
//
|
100
|
+
// Your custom extension implementation should be similar to the example below, but typed according to your needs.
|
101
|
+
|
102
|
+
/* Example from YapDatabaseViewConnection
|
103
|
+
|
104
|
+
@public
|
105
|
+
__strong YapDatabaseView *view;
|
106
|
+
__unsafe_unretained YapDatabaseConnection *databaseConnection;
|
107
|
+
|
108
|
+
*/
|
109
|
+
}
|
110
|
+
|
111
|
+
/**
|
112
|
+
* Subclasses MUST implement this method.
|
113
|
+
* Returns a reference to the parent (base class).
|
114
|
+
*
|
115
|
+
* This method is used by various general utility classes in order to
|
116
|
+
* walk-the-chain: extension <-> extConnection <-> extTransaction.
|
117
|
+
*
|
118
|
+
* For example:
|
119
|
+
* Given an extTransaction, the utility method can walk up to the base extension class, and fetch the registeredName.
|
120
|
+
**/
|
121
|
+
- (YapDatabaseExtension *)extension;
|
122
|
+
|
123
|
+
/**
|
124
|
+
* Subclasses MUST implement these methods.
|
125
|
+
* They are to create and return a proper instance of the YapDatabaseExtensionTransaction subclass.
|
126
|
+
*
|
127
|
+
* They may optionally use different subclasses for read-only vs read-write transactions.
|
128
|
+
* Alternatively they can just store an ivar to determine the type of the transaction in order to protect as needed.
|
129
|
+
**/
|
130
|
+
- (id)newReadTransaction:(YapDatabaseReadTransaction *)databaseTransaction;
|
131
|
+
- (id)newReadWriteTransaction:(YapDatabaseReadWriteTransaction *)databaseTransaction;
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Subclasses MUST implement this method.
|
135
|
+
*
|
136
|
+
* This method will be invoked in order to flush memory.
|
137
|
+
* Subclasses are encouraged to do something similar to the following:
|
138
|
+
*
|
139
|
+
* if (level >= YapDatabaseConnectionFlushMemoryLevelMild)
|
140
|
+
* {
|
141
|
+
* // Dump all caches
|
142
|
+
* }
|
143
|
+
*
|
144
|
+
* if (level >= YapDatabaseConnectionFlushMemoryLevelModerate)
|
145
|
+
* {
|
146
|
+
* // Release any prepared statements that aren't constantly used.
|
147
|
+
* //
|
148
|
+
* // For example, any statements that make modifications to the database,
|
149
|
+
* // and any other statements that are likely to be used infrequently.
|
150
|
+
*
|
151
|
+
* sqlite_finalize_null(&myStatement);
|
152
|
+
* }
|
153
|
+
*
|
154
|
+
* if (level >= YapDatabaseConnectionFlushMemoryLevelFull)
|
155
|
+
* {
|
156
|
+
* // Release all other prepared statements
|
157
|
+
*
|
158
|
+
* sqlite_finalize_null(&myOtherStatement);
|
159
|
+
*
|
160
|
+
* // And flush any state that may have been prepared via
|
161
|
+
* // the extTransaction's prepareIfNeeded method.
|
162
|
+
*
|
163
|
+
* viewGroups = nil;
|
164
|
+
* }
|
165
|
+
**/
|
166
|
+
- (void)_flushMemoryWithLevel:(int)level;
|
167
|
+
|
168
|
+
/**
|
169
|
+
* Subclasses MUST implement this method.
|
170
|
+
* This method is only called if within a readwrite transaction.
|
171
|
+
*
|
172
|
+
* This method is invoked in order to get the internal and external changesets.
|
173
|
+
* The internal changeset will be passed to sibling connections via processChangeset:.
|
174
|
+
* The external changeset will be embedded within YapDatabaseModifiedNotification.
|
175
|
+
*
|
176
|
+
* This is one of the primary methods within the architecture to keep multiple connections up-to-date
|
177
|
+
* as they move from one snapshot to the next. It is the responsibility of this method to provide
|
178
|
+
* all the information necessary for other connections to properly update their state,
|
179
|
+
* as well as provide the ability to extract information from YapDatabaseModifiedNotification's.
|
180
|
+
*
|
181
|
+
* The internal changeset will be passed directly to other connections.
|
182
|
+
* It should contain any information necessary to ensure that other connections can update their state
|
183
|
+
* to reflect the changes that were made during this transaction.
|
184
|
+
*
|
185
|
+
* The external changeset will be embedded within the YapDatabaseModifiedNotification.
|
186
|
+
* Thus, it can be used to provide support for things such as querying to see if something changed,
|
187
|
+
* or generating information necessary for UI update animations.
|
188
|
+
*
|
189
|
+
* If needed, "return" a internal changeset to be passed to other connections.
|
190
|
+
* If not needed, you can "return" a nil internal changeset.
|
191
|
+
*
|
192
|
+
* If needed, "return" an external changeset to be embedded within YapDatabaseModifiedNotification.
|
193
|
+
*
|
194
|
+
* If any changes to the database file were made made during this transaction,
|
195
|
+
* the hasDiskChangesPtr should be set to YES.
|
196
|
+
*
|
197
|
+
* For the most part, extensions update themselves in relation to changes within the main database table.
|
198
|
+
* However, sometimes extensions may update the database file independently. For example, the FullTextSearch extension
|
199
|
+
* has a method that optimizes the search tables by merging a bunch of different internal b-trees.
|
200
|
+
* If an extension makes changes to the database file outside the context of the normal changes to the main database
|
201
|
+
* table (such as the optimize command), then it MUST be sure to set the hasDiskChangesPtr to YES.
|
202
|
+
* This is because the internal architecture has optimizations if no disk changes occurred.
|
203
|
+
**/
|
204
|
+
- (void)getInternalChangeset:(NSMutableDictionary **)internalPtr
|
205
|
+
externalChangeset:(NSMutableDictionary **)externalPtr
|
206
|
+
hasDiskChanges:(BOOL *)hasDiskChangesPtr;
|
207
|
+
|
208
|
+
/**
|
209
|
+
* Subclasses MUST implement this method.
|
210
|
+
*
|
211
|
+
* This method processes an internal changeset from another connection.
|
212
|
+
* The internal changeset was generated from getInternalChangeset:externalChangeset:: on a sibling connection.
|
213
|
+
*
|
214
|
+
* This is one of the primary methods within the architecture to keep multiple connections up-to-date
|
215
|
+
* as they move from one snapshot to the next. It is the responsibility of this method to process
|
216
|
+
* the changeset to ensure the connection's state is properly updated.
|
217
|
+
**/
|
218
|
+
- (void)processChangeset:(NSDictionary *)changeset;
|
219
|
+
|
220
|
+
@end
|
221
|
+
|
222
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
223
|
+
#pragma mark -
|
224
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
225
|
+
|
226
|
+
/**
|
227
|
+
* An extension transaction is where a majority of the action happens.
|
228
|
+
* Subclasses will list the majority of their public API within the transaction.
|
229
|
+
*
|
230
|
+
* [databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction){
|
231
|
+
*
|
232
|
+
* object = [[transaction ext:@"view"] objectAtIndex:index inGroup:@"sales"];
|
233
|
+
* // ^^^^^^^^^^^^^^^^^^^^^^^
|
234
|
+
* // ^ Returns a YapDatabaseExtensionTransaction subclass instance.
|
235
|
+
* }];
|
236
|
+
*
|
237
|
+
* An extension transaction has a reference to the database transction (and therefore to sqlite),
|
238
|
+
* as well as a reference to its parent extension connection. It is the same in architecture as
|
239
|
+
* database connections and transactions. That is, all access (read-only or read-write) goes
|
240
|
+
* through a transaction. Further, each connection only has a single transaction at a time.
|
241
|
+
* Thus transactions are optimized by storing a majority of their state within their respective connection.
|
242
|
+
*
|
243
|
+
* An extension transaction is created on-demand (or as needed) from within a database transaction.
|
244
|
+
*
|
245
|
+
* During a read-only transaction:
|
246
|
+
* - If the extension is not requested, then it is not created.
|
247
|
+
* - If the extension is requested, it is created once per transaction.
|
248
|
+
* - Additional requests for the same extension return the existing instance.
|
249
|
+
*
|
250
|
+
* During a read-write transaction:
|
251
|
+
* - If a modification to the database is initiated,
|
252
|
+
* every registered extension has an associated transaction created in order to handle the associated hook calls.
|
253
|
+
* - If the extension is requested, it is created once per transaction.
|
254
|
+
* - Additional requests for the same extension return the existing instance.
|
255
|
+
*
|
256
|
+
* The extension transaction is only valid from within the database transaction.
|
257
|
+
**/
|
258
|
+
@interface YapDatabaseExtensionTransaction () {
|
259
|
+
|
260
|
+
// You should store an unretained reference to the parent,
|
261
|
+
// and an unretained reference to the corresponding database transaction.
|
262
|
+
//
|
263
|
+
// Yours should be similar to the example below, but typed according to your needs.
|
264
|
+
|
265
|
+
/* Example from YapDatabaseViewTransaction
|
266
|
+
|
267
|
+
@private
|
268
|
+
__unsafe_unretained YapDatabaseViewConnection *viewConnection;
|
269
|
+
__unsafe_unretained YapDatabaseTransaction *databaseTransaction;
|
270
|
+
|
271
|
+
*/
|
272
|
+
}
|
273
|
+
|
274
|
+
/**
|
275
|
+
* Subclasses MUST implement this method.
|
276
|
+
*
|
277
|
+
* This method is called during the registration process.
|
278
|
+
* Subclasses should perform any tasks needed in order to setup the extension for use by other connections.
|
279
|
+
*
|
280
|
+
* This includes creating any necessary tables,
|
281
|
+
* as well as possibly populating the tables by enumerating over the existing rows in the database.
|
282
|
+
*
|
283
|
+
* The method should check to see if it has already been created.
|
284
|
+
* That is, is this a re-registration from a subsequent app launch,
|
285
|
+
* or is this the first time the extension has been registered under this name?
|
286
|
+
*
|
287
|
+
* The recommended way of accomplishing this is via the yap2 table (which was designed for this purpose).
|
288
|
+
* There are various convenience methods that allow you store various settings about your extension in this table.
|
289
|
+
* See 'intValueForExtensionKey:' and other related methods.
|
290
|
+
*
|
291
|
+
* Note: This method is invoked on a special readWriteTransaction that is created internally
|
292
|
+
* within YapDatabase for the sole purpose of registering and unregistering extensions.
|
293
|
+
* So this method need not setup itself for regular use.
|
294
|
+
* It is designed only to do the prep work of creating the extension dependencies (such as tables)
|
295
|
+
* so that regular instances (possibly read-only) can operate normally.
|
296
|
+
*
|
297
|
+
* See YapDatabaseViewTransaction for a reference implementation.
|
298
|
+
*
|
299
|
+
* Return YES if completed successfully, or if already created.
|
300
|
+
* Return NO if some kind of error occured.
|
301
|
+
**/
|
302
|
+
- (BOOL)createIfNeeded;
|
303
|
+
|
304
|
+
/**
|
305
|
+
* Subclasses MUST implement this method.
|
306
|
+
*
|
307
|
+
* This method is invoked in order to prepare an extension transaction for use.
|
308
|
+
* Remember, transactions are short lived instances.
|
309
|
+
* So an extension transaction should store the vast majority of its state information within the extension connection.
|
310
|
+
* Thus an extension transaction instance should generally only need to prepare itself once. (*)
|
311
|
+
* It should store preparation info in the connection.
|
312
|
+
* And future invocations of this method will see that the connection has all the prepared state it needs,
|
313
|
+
* and then this method will return immediately.
|
314
|
+
*
|
315
|
+
* (*) an exception to this rule may occur if the user aborts a read-write transaction (via rollback),
|
316
|
+
* and the extension connection must dump all its prepared state.
|
317
|
+
*
|
318
|
+
* Changes that occur on other connections should get incorporated via the changeset architecture
|
319
|
+
* from within the extension connection subclass.
|
320
|
+
*
|
321
|
+
* This method may be invoked on a read-only OR read-write transaction.
|
322
|
+
*
|
323
|
+
* Return YES if completed successfully, or if already prepared.
|
324
|
+
* Return NO if some kind of error occured.
|
325
|
+
**/
|
326
|
+
- (BOOL)prepareIfNeeded;
|
327
|
+
|
328
|
+
/**
|
329
|
+
* Subclasses may OPTIONALLY implement this method.
|
330
|
+
* This method is only called if within a readwrite transaction.
|
331
|
+
*
|
332
|
+
* Subclasses may implement it to perform any "cleanup" before the changeset is requested.
|
333
|
+
* Remember, the changeset is requested before the commitTransaction method is invoked.
|
334
|
+
**/
|
335
|
+
- (void)preCommitReadWriteTransaction;
|
336
|
+
|
337
|
+
/**
|
338
|
+
* Subclasses MUST implement this method.
|
339
|
+
* This method is only called if within a readwrite transaction.
|
340
|
+
**/
|
341
|
+
- (void)commitTransaction;
|
342
|
+
|
343
|
+
/**
|
344
|
+
* Subclasses MUST implement this method.
|
345
|
+
* This method is only called if within a readwrite transaction.
|
346
|
+
**/
|
347
|
+
- (void)rollbackTransaction;
|
348
|
+
|
349
|
+
/**
|
350
|
+
* Subclasses MUST implement these methods.
|
351
|
+
* They are needed by various utility methods.
|
352
|
+
**/
|
353
|
+
- (YapDatabaseReadTransaction *)databaseTransaction;
|
354
|
+
- (YapDatabaseExtensionConnection *)extensionConnection;
|
355
|
+
|
356
|
+
/**
|
357
|
+
* The following method are implemented by YapDatabaseExtensionTransaction.
|
358
|
+
*
|
359
|
+
* They are convenience methods for getting and setting persistent configuration values for the extension.
|
360
|
+
* The persistent values are stored in the yap2 table, which is specifically designed for this use.
|
361
|
+
*
|
362
|
+
* The yap2 table is structured like this:
|
363
|
+
*
|
364
|
+
* CREATE TABLE IF NOT EXISTS "yap2" (
|
365
|
+
* "extension" CHAR NOT NULL,
|
366
|
+
* "key" CHAR NOT NULL,
|
367
|
+
* "data" BLOB,
|
368
|
+
* PRIMARY KEY ("extension", "key")
|
369
|
+
* );
|
370
|
+
*
|
371
|
+
* You pass the "key" and the "data" (which can be typed however you want it to be such as int, string, etc).
|
372
|
+
* The "extension" value is automatically set to the registeredName.
|
373
|
+
*
|
374
|
+
* Usage example:
|
375
|
+
*
|
376
|
+
* The View extension stores a "version" which is given to it during the init method by the user.
|
377
|
+
* If the "version" changes, this signifies that the user has changed something about the view,
|
378
|
+
* such as the sortingBlock or groupingBlock. The view then knows to flush its tables and re-populate them.
|
379
|
+
* It stores the "version" in the yap2 table via the methods below.
|
380
|
+
*
|
381
|
+
* When an extension is unregistered, either manually or automatically (if orphaned),
|
382
|
+
* then the database system automatically deletes all values from the yap2 table where extension == registeredName.
|
383
|
+
**/
|
384
|
+
|
385
|
+
- (BOOL)getBoolValue:(BOOL *)valuePtr forExtensionKey:(NSString *)key;
|
386
|
+
- (BOOL)boolValueForExtensionKey:(NSString *)key;
|
387
|
+
- (void)setBoolValue:(BOOL)value forExtensionKey:(NSString *)key;
|
388
|
+
|
389
|
+
- (BOOL)getIntValue:(int *)valuePtr forExtensionKey:(NSString *)key;
|
390
|
+
- (int)intValueForExtensionKey:(NSString *)key;
|
391
|
+
- (void)setIntValue:(int)value forExtensionKey:(NSString *)key;
|
392
|
+
|
393
|
+
- (BOOL)getDoubleValue:(double *)valuePtr forExtensionKey:(NSString *)key;
|
394
|
+
- (double)doubleValueForExtensionKey:(NSString *)key;
|
395
|
+
- (void)setDoubleValue:(double)value forExtensionKey:(NSString *)key;
|
396
|
+
|
397
|
+
- (NSString *)stringValueForExtensionKey:(NSString *)key;
|
398
|
+
- (void)setStringValue:(NSString *)value forExtensionKey:(NSString *)key;
|
399
|
+
|
400
|
+
- (NSData *)dataValueForExtensionKey:(NSString *)key;
|
401
|
+
- (void)setDataValue:(NSData *)value forExtensionKey:(NSString *)key;
|
402
|
+
|
403
|
+
@end
|
404
|
+
|
405
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
406
|
+
#pragma mark -
|
407
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
408
|
+
|
409
|
+
/**
|
410
|
+
* The YapDatabaseExtensionTransaction subclass MUST implement the methods in this protocol.
|
411
|
+
**/
|
412
|
+
@protocol YapDatabaseExtensionTransaction_Hooks
|
413
|
+
@required
|
414
|
+
|
415
|
+
- (void)handleInsertObject:(id)object
|
416
|
+
forKey:(NSString *)key
|
417
|
+
inCollection:(NSString *)collection
|
418
|
+
withMetadata:(id)metadata
|
419
|
+
rowid:(int64_t)rowid;
|
420
|
+
|
421
|
+
- (void)handleUpdateObject:(id)object
|
422
|
+
forKey:(NSString *)key
|
423
|
+
inCollection:(NSString *)collection
|
424
|
+
withMetadata:(id)metadata
|
425
|
+
rowid:(int64_t)rowid;
|
426
|
+
|
427
|
+
- (void)handleUpdateMetadata:(id)metadata
|
428
|
+
forKey:(NSString *)key
|
429
|
+
inCollection:(NSString *)collection
|
430
|
+
withRowid:(int64_t)rowid;
|
431
|
+
|
432
|
+
- (void)handleTouchObjectForKey:(NSString *)key inCollection:(NSString *)collection withRowid:(int64_t)rowid;
|
433
|
+
- (void)handleTouchMetadataForKey:(NSString *)key inCollection:(NSString *)collection withRowid:(int64_t)rowid;
|
434
|
+
|
435
|
+
- (void)handleRemoveObjectForKey:(NSString *)key inCollection:(NSString *)collection withRowid:(int64_t)rowid;
|
436
|
+
- (void)handleRemoveObjectsForKeys:(NSArray *)keys inCollection:(NSString *)collection withRowids:(NSArray *)rowids;
|
437
|
+
|
438
|
+
- (void)handleRemoveAllObjectsInAllCollections;
|
439
|
+
|
440
|
+
@end
|