motion-yapper 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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,41 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The YapSet class can be treated more or less like a regular NSSet.
|
|
5
|
+
*
|
|
6
|
+
* It is designed to expose internal mutable objects to the external world.
|
|
7
|
+
* That is, we skip all the overhead associated with making immutable copies,
|
|
8
|
+
* and instead just use this simple wrapper class.
|
|
9
|
+
*
|
|
10
|
+
* In general, the external world won't interact with this class.
|
|
11
|
+
* They are encouraged to instead use the changeset methods exposed in the connection classes.
|
|
12
|
+
*
|
|
13
|
+
* @see YapDatabaseConnection hasChangeForKey:inNotifications:
|
|
14
|
+
* @see YapDatabaseConnection hasChangeForAnyKeys:inNotifications:
|
|
15
|
+
**/
|
|
16
|
+
@interface YapSet : NSObject <NSFastEnumeration>
|
|
17
|
+
|
|
18
|
+
- (id)initWithSet:(NSMutableSet *)set;
|
|
19
|
+
- (id)initWithDictionary:(NSMutableDictionary *)dictionary;
|
|
20
|
+
|
|
21
|
+
// NSSet methods
|
|
22
|
+
|
|
23
|
+
- (BOOL)containsObject:(id)anObject;
|
|
24
|
+
- (BOOL)intersectsSet:(NSSet *)otherSet;
|
|
25
|
+
|
|
26
|
+
- (void)enumerateObjectsUsingBlock:(void (^)(id obj, BOOL *stop))block;
|
|
27
|
+
|
|
28
|
+
// It's open source!
|
|
29
|
+
// You are encouraged to add any methods you may need that are available in the NSSet API.
|
|
30
|
+
//
|
|
31
|
+
// Not every method from NSSet is available here because the author is lazy,
|
|
32
|
+
// and only implemented what was needed at the time.
|
|
33
|
+
//
|
|
34
|
+
// If you add something, keep in mind the spirit of this class.
|
|
35
|
+
// It is designed to expose mutable internals in a safe (immutable) manner.
|
|
36
|
+
// It is designed to expose them in the form of a set.
|
|
37
|
+
//
|
|
38
|
+
// If you make improvements, feel free to submit a patch to the github project and get some good karma for it!
|
|
39
|
+
// https://github.com/yaptv/YapDatabase
|
|
40
|
+
|
|
41
|
+
@end
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
#import "YapSet.h"
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
@implementation YapSet
|
|
5
|
+
{
|
|
6
|
+
NSDictionary *dictionary;
|
|
7
|
+
NSSet *set;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
- (id)initWithSet:(NSMutableSet *)inSet
|
|
11
|
+
{
|
|
12
|
+
if ((self = [super init]))
|
|
13
|
+
{
|
|
14
|
+
set = inSet; // retain, do NOT copy (which would defeat the entire purpose of this class)
|
|
15
|
+
}
|
|
16
|
+
return self;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
- (id)initWithDictionary:(NSMutableDictionary *)inDictionary
|
|
20
|
+
{
|
|
21
|
+
if ((self = [super init]))
|
|
22
|
+
{
|
|
23
|
+
dictionary = inDictionary; // retain, do NOT copy (which would defeat the entire purpose of this class)
|
|
24
|
+
}
|
|
25
|
+
return self;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// NSSet methods
|
|
29
|
+
|
|
30
|
+
- (BOOL)containsObject:(id)object
|
|
31
|
+
{
|
|
32
|
+
if (set)
|
|
33
|
+
return [set containsObject:object];
|
|
34
|
+
else
|
|
35
|
+
return CFDictionaryContainsKey((__bridge CFDictionaryRef)dictionary, (const void *)object);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
- (BOOL)intersectsSet:(NSSet *)otherSet
|
|
39
|
+
{
|
|
40
|
+
if (set)
|
|
41
|
+
{
|
|
42
|
+
return [set intersectsSet:otherSet];
|
|
43
|
+
}
|
|
44
|
+
else
|
|
45
|
+
{
|
|
46
|
+
for (id object in otherSet)
|
|
47
|
+
{
|
|
48
|
+
if (CFDictionaryContainsKey((__bridge CFDictionaryRef)dictionary, (const void *)object))
|
|
49
|
+
return YES;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return NO;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
- (void)enumerateObjectsUsingBlock:(void (^)(id obj, BOOL *stop))block
|
|
57
|
+
{
|
|
58
|
+
if (set)
|
|
59
|
+
{
|
|
60
|
+
[set enumerateObjectsUsingBlock:block];
|
|
61
|
+
}
|
|
62
|
+
else
|
|
63
|
+
{
|
|
64
|
+
if (block == NULL) return;
|
|
65
|
+
[dictionary enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
|
66
|
+
|
|
67
|
+
block(key, stop);
|
|
68
|
+
}];
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
- (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state
|
|
73
|
+
objects:(__unsafe_unretained id *)stackbuf
|
|
74
|
+
count:(NSUInteger)len
|
|
75
|
+
{
|
|
76
|
+
if (set)
|
|
77
|
+
return [set countByEnumeratingWithState:state objects:stackbuf count:len];
|
|
78
|
+
else
|
|
79
|
+
return [dictionary countByEnumeratingWithState:state objects:stackbuf count:len];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
@end
|
|
@@ -0,0 +1,547 @@
|
|
|
1
|
+
#import <Foundation/Foundation.h>
|
|
2
|
+
|
|
3
|
+
#import "YapDatabaseConnection.h"
|
|
4
|
+
#import "YapDatabaseTransaction.h"
|
|
5
|
+
#import "YapDatabaseExtension.h"
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Welcome to YapDatabase!
|
|
9
|
+
*
|
|
10
|
+
* The project page has a wealth of documentation if you have any questions.
|
|
11
|
+
* https://github.com/yaptv/YapDatabase
|
|
12
|
+
*
|
|
13
|
+
* If you're new to the project you may want to visit the wiki.
|
|
14
|
+
* https://github.com/yaptv/YapDatabase/wiki
|
|
15
|
+
*
|
|
16
|
+
* The YapDatabase class is the top level class used to initialize the database.
|
|
17
|
+
* It largely represents the immutable aspects of the database such as:
|
|
18
|
+
*
|
|
19
|
+
* - the filepath of the sqlite file
|
|
20
|
+
* - the serializer and deserializer (for turning objects into data blobs, and back into objects again)
|
|
21
|
+
*
|
|
22
|
+
* To access or modify the database you create one or more connections to it.
|
|
23
|
+
* Connections are thread-safe, and you can spawn multiple connections in order to achieve
|
|
24
|
+
* concurrent access to the database from multiple threads.
|
|
25
|
+
* You can even read from the database while writing to it from another connection on another thread.
|
|
26
|
+
**/
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* How does YapDatabase store my objects to disk?
|
|
30
|
+
*
|
|
31
|
+
* That question is answered extensively in the wiki article "Storing Objects":
|
|
32
|
+
* https://github.com/yaptv/YapDatabase/wiki/Storing-Objects
|
|
33
|
+
*
|
|
34
|
+
* Here's the intro from the wiki article:
|
|
35
|
+
*
|
|
36
|
+
* > In order to store an object to disk (via YapDatabase or any other protocol) you need some way of
|
|
37
|
+
* > serializing the object. That is, convert the object into a big blob of bytes. And then, to get your
|
|
38
|
+
* > object back from the disk you deserialize it (convert big blob of bytes back into object form).
|
|
39
|
+
* >
|
|
40
|
+
* > With YapDatabase, you can choose the default serialization/deserialization process,
|
|
41
|
+
* > or you can customize it and use your own routines.
|
|
42
|
+
*
|
|
43
|
+
* In order to support adding objects to the database, serializers and deserializers are used.
|
|
44
|
+
* The serializer and deserializer are just simple blocks that you can optionally configure.
|
|
45
|
+
* The default serializer/deserializer uses NSCoding, so they are as simple and fast:
|
|
46
|
+
*
|
|
47
|
+
* defaultSerializer = ^(NSString *collection, NSString *key, id object){
|
|
48
|
+
* return [NSKeyedArchiver archivedDataWithRootObject:object];
|
|
49
|
+
* };
|
|
50
|
+
* defaultDeserializer = ^(NSString *collection, NSString *key, NSData *data) {
|
|
51
|
+
* return [NSKeyedUnarchiver unarchiveObjectWithData:data];
|
|
52
|
+
* };
|
|
53
|
+
*
|
|
54
|
+
* If you use the initWithPath initializer, the default serializer/deserializer are used.
|
|
55
|
+
* Thus to store objects in the database, the objects need only support the NSCoding protocol.
|
|
56
|
+
* You may optionally use a custom serializer/deserializer for the objects and/or metadata.
|
|
57
|
+
**/
|
|
58
|
+
typedef NSData* (^YapDatabaseSerializer)(NSString *collection, NSString *key, id object);
|
|
59
|
+
typedef id (^YapDatabaseDeserializer)(NSString *collection, NSString *key, NSData *data);
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Is it safe to store mutable objects in the database?
|
|
63
|
+
*
|
|
64
|
+
* That question is answered extensively in the wiki article "Thread Safety":
|
|
65
|
+
* https://github.com/yaptv/YapDatabase/wiki/Thread-Safety
|
|
66
|
+
*
|
|
67
|
+
* The sanitizer block can be run on all objects as they are being input into the database.
|
|
68
|
+
* That is, it will be run on all objects passed to setObject:forKey:inCollection: before
|
|
69
|
+
* being handed to the database internals.
|
|
70
|
+
**/
|
|
71
|
+
typedef id (^YapDatabaseSanitizer)(NSString *collection, NSString *key, id object);
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* This notification is posted following a readwrite transaction where the database was modified.
|
|
76
|
+
*
|
|
77
|
+
* It is documented in more detail in the wiki article "YapDatabaseModifiedNotification":
|
|
78
|
+
* https://github.com/yaptv/YapDatabase/wiki/YapDatabaseModifiedNotification
|
|
79
|
+
*
|
|
80
|
+
* The notification object will be the database instance itself.
|
|
81
|
+
* That is, it will be an instance of YapDatabase.
|
|
82
|
+
*
|
|
83
|
+
* The userInfo dictionary will look something like this:
|
|
84
|
+
* @{
|
|
85
|
+
* YapDatabaseSnapshotKey = <NSNumber of snapshot, incremented per read-write transaction w/modification>,
|
|
86
|
+
* YapDatabaseConnectionKey = <YapDatabaseConnection instance that made the modification(s)>,
|
|
87
|
+
* YapDatabaseExtensionsKey = <NSDictionary with individual changeset info per extension>,
|
|
88
|
+
* YapDatabaseCustomKey = <Optional object associated with this change, set by you>,
|
|
89
|
+
* }
|
|
90
|
+
*
|
|
91
|
+
* This notification is always posted to the main thread.
|
|
92
|
+
**/
|
|
93
|
+
extern NSString *const YapDatabaseModifiedNotification;
|
|
94
|
+
|
|
95
|
+
extern NSString *const YapDatabaseSnapshotKey;
|
|
96
|
+
extern NSString *const YapDatabaseConnectionKey;
|
|
97
|
+
extern NSString *const YapDatabaseExtensionsKey;
|
|
98
|
+
extern NSString *const YapDatabaseCustomKey;
|
|
99
|
+
|
|
100
|
+
extern NSString *const YapDatabaseObjectChangesKey;
|
|
101
|
+
extern NSString *const YapDatabaseMetadataChangesKey;
|
|
102
|
+
extern NSString *const YapDatabaseRemovedKeysKey;
|
|
103
|
+
extern NSString *const YapDatabaseRemovedCollectionsKey;
|
|
104
|
+
extern NSString *const YapDatabaseAllKeysRemovedKey;
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
@interface YapDatabase : NSObject
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The default serializer & deserializer use NSCoding (NSKeyedArchiver & NSKeyedUnarchiver).
|
|
111
|
+
* Thus any objects that support the NSCoding protocol may be used.
|
|
112
|
+
*
|
|
113
|
+
* Many of Apple's primary data types support NSCoding out of the box.
|
|
114
|
+
* It's easy to add NSCoding support to your own custom objects.
|
|
115
|
+
**/
|
|
116
|
+
+ (YapDatabaseSerializer)defaultSerializer;
|
|
117
|
+
+ (YapDatabaseDeserializer)defaultDeserializer;
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Property lists ONLY support the following: NSData, NSString, NSArray, NSDictionary, NSDate, and NSNumber.
|
|
121
|
+
* Property lists are highly optimized and are used extensively by Apple.
|
|
122
|
+
*
|
|
123
|
+
* Property lists make a good fit when your existing code already uses them,
|
|
124
|
+
* such as replacing NSUserDefaults with a database.
|
|
125
|
+
**/
|
|
126
|
+
+ (YapDatabaseSerializer)propertyListSerializer;
|
|
127
|
+
+ (YapDatabaseDeserializer)propertyListDeserializer;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* A FASTER serializer & deserializer than the default, if serializing ONLY a NSDate object.
|
|
131
|
+
* You may want to use timestampSerializer & timestampDeserializer if your metadata is simply an NSDate.
|
|
132
|
+
**/
|
|
133
|
+
+ (YapDatabaseSerializer)timestampSerializer;
|
|
134
|
+
+ (YapDatabaseDeserializer)timestampDeserializer;
|
|
135
|
+
|
|
136
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
137
|
+
#pragma mark Init
|
|
138
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* Opens or creates a sqlite database with the given path.
|
|
142
|
+
* The default serializer and deserializer are used.
|
|
143
|
+
* No sanitizer is used.
|
|
144
|
+
*
|
|
145
|
+
* @see defaultSerializer
|
|
146
|
+
* @see defaultDeserializer
|
|
147
|
+
**/
|
|
148
|
+
- (id)initWithPath:(NSString *)path;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Opens or creates a sqlite database with the given path.
|
|
152
|
+
* The given serializer and deserializer are used for both objects and metadata.
|
|
153
|
+
* No sanitizer is used.
|
|
154
|
+
**/
|
|
155
|
+
- (id)initWithPath:(NSString *)path
|
|
156
|
+
serializer:(YapDatabaseSerializer)serializer
|
|
157
|
+
deserializer:(YapDatabaseDeserializer)deserializer;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Opens or creates a sqlite database with the given path.
|
|
161
|
+
* The given serializer and deserializer are used for both objects and metadata.
|
|
162
|
+
* The given sanitizer is used for both objects and metadata.
|
|
163
|
+
**/
|
|
164
|
+
- (id)initWithPath:(NSString *)path
|
|
165
|
+
serializer:(YapDatabaseSerializer)serializer
|
|
166
|
+
deserializer:(YapDatabaseDeserializer)deserializer
|
|
167
|
+
sanitizer:(YapDatabaseSanitizer)sanitizer;
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Opens or creates a sqlite database with the given path.
|
|
171
|
+
* The given serializers and deserializers are used.
|
|
172
|
+
* No sanitizer is used.
|
|
173
|
+
**/
|
|
174
|
+
- (id)initWithPath:(NSString *)path objectSerializer:(YapDatabaseSerializer)objectSerializer
|
|
175
|
+
objectDeserializer:(YapDatabaseDeserializer)objectDeserializer
|
|
176
|
+
metadataSerializer:(YapDatabaseSerializer)metadataSerializer
|
|
177
|
+
metadataDeserializer:(YapDatabaseDeserializer)metadataDeserializer;
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Opens or creates a sqlite database with the given path.
|
|
181
|
+
* The given serializers and deserializers are used.
|
|
182
|
+
* The given sanitizers are used.
|
|
183
|
+
**/
|
|
184
|
+
- (id)initWithPath:(NSString *)path objectSerializer:(YapDatabaseSerializer)objectSerializer
|
|
185
|
+
objectDeserializer:(YapDatabaseDeserializer)objectDeserializer
|
|
186
|
+
metadataSerializer:(YapDatabaseSerializer)metadataSerializer
|
|
187
|
+
metadataDeserializer:(YapDatabaseDeserializer)metadataDeserializer
|
|
188
|
+
objectSanitizer:(YapDatabaseSanitizer)objectSanitizer
|
|
189
|
+
metadataSanitizer:(YapDatabaseSanitizer)metadataSanitizer;
|
|
190
|
+
|
|
191
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
192
|
+
#pragma mark Properties
|
|
193
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
194
|
+
|
|
195
|
+
@property (nonatomic, strong, readonly) NSString *databasePath;
|
|
196
|
+
|
|
197
|
+
@property (nonatomic, strong, readonly) YapDatabaseSerializer objectSerializer;
|
|
198
|
+
@property (nonatomic, strong, readonly) YapDatabaseDeserializer objectDeserializer;
|
|
199
|
+
|
|
200
|
+
@property (nonatomic, strong, readonly) YapDatabaseSerializer metadataSerializer;
|
|
201
|
+
@property (nonatomic, strong, readonly) YapDatabaseDeserializer metadataDeserializer;
|
|
202
|
+
|
|
203
|
+
@property (nonatomic, strong, readonly) YapDatabaseSanitizer objectSanitizer;
|
|
204
|
+
@property (nonatomic, strong, readonly) YapDatabaseSanitizer metadataSanitizer;
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* The snapshot number is the internal synchronization state primitive for the database.
|
|
208
|
+
* It's generally only useful for database internals,
|
|
209
|
+
* but it can sometimes come in handy for general debugging of your app.
|
|
210
|
+
*
|
|
211
|
+
* The snapshot is a simple 64-bit number that gets incremented upon every readwrite transaction
|
|
212
|
+
* that makes modifications to the database. Due to the concurrent architecture of YapDatabase,
|
|
213
|
+
* there may be multiple concurrent connections that are inspecting the database at similar times,
|
|
214
|
+
* yet they are looking at slightly different "snapshots" of the database.
|
|
215
|
+
*
|
|
216
|
+
* The snapshot number may thus be inspected to determine (in a general fashion) what state the connection
|
|
217
|
+
* is in compared with other connections.
|
|
218
|
+
*
|
|
219
|
+
* YapDatabase.snapshot = most up-to-date snapshot among all connections
|
|
220
|
+
* YapDatabaseConnection.snapshot = snapshot of individual connection
|
|
221
|
+
*
|
|
222
|
+
* Example:
|
|
223
|
+
*
|
|
224
|
+
* YapDatabase *database = [[YapDatabase alloc] init...];
|
|
225
|
+
* database.snapshot; // returns zero
|
|
226
|
+
*
|
|
227
|
+
* YapDatabaseConnection *connection1 = [database newConnection];
|
|
228
|
+
* YapDatabaseConnection *connection2 = [database newConnection];
|
|
229
|
+
*
|
|
230
|
+
* connection1.snapshot; // returns zero
|
|
231
|
+
* connection2.snapshot; // returns zero
|
|
232
|
+
*
|
|
233
|
+
* [connection1 readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction){
|
|
234
|
+
* [transaction setObject:objectA forKey:keyA];
|
|
235
|
+
* }];
|
|
236
|
+
*
|
|
237
|
+
* database.snapshot; // returns 1
|
|
238
|
+
* connection1.snapshot; // returns 1
|
|
239
|
+
* connection2.snapshot; // returns 1
|
|
240
|
+
*
|
|
241
|
+
* [connection1 asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction){
|
|
242
|
+
* [transaction setObject:objectB forKey:keyB];
|
|
243
|
+
* [NSThread sleepForTimeInterval:1.0]; // sleep for 1 second
|
|
244
|
+
*
|
|
245
|
+
* connection1.snapshot; // returns 1 (we know it will turn into 2 once the transaction completes)
|
|
246
|
+
* } completion:^{
|
|
247
|
+
*
|
|
248
|
+
* connection1.snapshot; // returns 2
|
|
249
|
+
* }];
|
|
250
|
+
*
|
|
251
|
+
* [connection2 asyncReadWithBlock:^(YapDatabaseReadTransaction *transaction){
|
|
252
|
+
* [NSThread sleepForTimeInterval:5.0]; // sleep for 5 seconds
|
|
253
|
+
*
|
|
254
|
+
* connection2.snapshot; // returns 1. See why?
|
|
255
|
+
* }];
|
|
256
|
+
*
|
|
257
|
+
* It's because connection2 started its transaction when the database was in snapshot 1.
|
|
258
|
+
* Thus, for the duration of its transaction, the database remains in that state.
|
|
259
|
+
*
|
|
260
|
+
* However, once connection2 completes its transaction, it will automatically update itself to snapshot 2.
|
|
261
|
+
*
|
|
262
|
+
* In general, the snapshot is primarily for internal use.
|
|
263
|
+
* However, it may come in handy for some tricky edge-case bugs (why doesn't my connection see that other commit?)
|
|
264
|
+
**/
|
|
265
|
+
@property (atomic, assign, readonly) uint64_t snapshot;
|
|
266
|
+
|
|
267
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
268
|
+
#pragma mark Defaults
|
|
269
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Allows you to set the default objectCacheEnabled and objectCacheLimit for all new connections.
|
|
273
|
+
*
|
|
274
|
+
* When you create a connection via [database newConnection], that new connection will inherit
|
|
275
|
+
* its initial configuration via the default values configured for the parent database.
|
|
276
|
+
* Of course, the connection may then override these default configuration values, and configure itself as needed.
|
|
277
|
+
*
|
|
278
|
+
* Changing the default values only affects future connections that will be created.
|
|
279
|
+
* It does not affect connections that have already been created.
|
|
280
|
+
*
|
|
281
|
+
* The default defaultObjectCacheEnabled is YES.
|
|
282
|
+
* The default defaultObjectCacheLimit is 250.
|
|
283
|
+
*
|
|
284
|
+
* For more detailed documentation on these properties, see the YapDatabaseConnection header file.
|
|
285
|
+
* @see YapDatabaseConnection objectCacheEnabled
|
|
286
|
+
* @see YapDatabaseConnection objectCacheLimit
|
|
287
|
+
**/
|
|
288
|
+
@property (atomic, assign, readwrite) BOOL defaultObjectCacheEnabled;
|
|
289
|
+
@property (atomic, assign, readwrite) NSUInteger defaultObjectCacheLimit;
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Allows you to set the default metadataCacheEnabled and metadataCacheLimit for all new connections.
|
|
293
|
+
*
|
|
294
|
+
* When you create a connection via [database newConnection], that new connection will inherit
|
|
295
|
+
* its initial configuration via the default values configured for the parent database.
|
|
296
|
+
* Of course, the connection may then override these default configuration values, and configure itself as needed.
|
|
297
|
+
*
|
|
298
|
+
* Changing the default values only affects future connections that will be created.
|
|
299
|
+
* It does not affect connections that have already been created.
|
|
300
|
+
*
|
|
301
|
+
* The default defaultMetadataCacheEnabled is YES.
|
|
302
|
+
* The default defaultMetadataCacheLimit is 500.
|
|
303
|
+
*
|
|
304
|
+
* For more detailed documentation on these properties, see the YapDatabaseConnection header file.
|
|
305
|
+
* @see YapDatabaseConnection metadataCacheEnabled
|
|
306
|
+
* @see YapDatabaseConnection metadataCacheLimit
|
|
307
|
+
**/
|
|
308
|
+
@property (atomic, assign, readwrite) BOOL defaultMetadataCacheEnabled;
|
|
309
|
+
@property (atomic, assign, readwrite) NSUInteger defaultMetadataCacheLimit;
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* Allows you to set the default objectPolicy and metadataPolicy for all new connections.
|
|
313
|
+
*
|
|
314
|
+
* When you create a connection via [database newConnection], that new connection will inherit
|
|
315
|
+
* its initial configuration via the default values configured for the parent database.
|
|
316
|
+
* Of course, the connection may then override these default configuration values, and configure itself as needed.
|
|
317
|
+
*
|
|
318
|
+
* Changing the default values only affects future connections that will be created.
|
|
319
|
+
* It does not affect connections that have already been created.
|
|
320
|
+
*
|
|
321
|
+
* The default defaultObjectPolicy is YapDatabasePolicyContainment.
|
|
322
|
+
* The default defaultMetadataPolicy is YapDatabasePolicyContainment.
|
|
323
|
+
*
|
|
324
|
+
* For more detailed documentation on these properties, see the YapDatabaseConnection header file.
|
|
325
|
+
* @see YapDatabaseConnection objectPolicy
|
|
326
|
+
* @see YapDatabaseConnection metadataPolicy
|
|
327
|
+
**/
|
|
328
|
+
@property (atomic, assign, readwrite) YapDatabasePolicy defaultObjectPolicy;
|
|
329
|
+
@property (atomic, assign, readwrite) YapDatabasePolicy defaultMetadataPolicy;
|
|
330
|
+
|
|
331
|
+
#if TARGET_OS_IPHONE
|
|
332
|
+
/**
|
|
333
|
+
* Allows you to set the default autoFlushMemoryLevel for all new connections.
|
|
334
|
+
*
|
|
335
|
+
* When you create a connection via [database newConnection], that new connection will inherit
|
|
336
|
+
* its initial configuration via the default values configured for the parent database.
|
|
337
|
+
* Of course, the connection may then override these default configuration values, and configure itself as needed.
|
|
338
|
+
*
|
|
339
|
+
* Changing the default values only affects future connections that will be created.
|
|
340
|
+
* It does not affect connections that have already been created.
|
|
341
|
+
*
|
|
342
|
+
* The default defaultAutoFlushMemoryLevel is YapDatabaseConnectionFlushMemoryLevelMild.
|
|
343
|
+
*
|
|
344
|
+
* For more detailed documentation on these properties, see the YapDatabaseConnection header file.
|
|
345
|
+
* @see YapDatabaseConnection autoFlushMemoryLevel
|
|
346
|
+
**/
|
|
347
|
+
@property (atomic, assign, readwrite) int defaultAutoFlushMemoryLevel;
|
|
348
|
+
#endif
|
|
349
|
+
|
|
350
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
351
|
+
#pragma mark Connections
|
|
352
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Creates and returns a new connection to the database.
|
|
356
|
+
* It is through this connection that you will access the database.
|
|
357
|
+
*
|
|
358
|
+
* You can create multiple connections to the database.
|
|
359
|
+
* Each invocation of this method creates and returns a new connection.
|
|
360
|
+
*
|
|
361
|
+
* Multiple connections can simultaneously read from the database.
|
|
362
|
+
* Multiple connections can simultaneously read from the database while another connection is modifying the database.
|
|
363
|
+
* For example, the main thread could be reading from the database via connection A,
|
|
364
|
+
* while a background thread is writing to the database via connection B.
|
|
365
|
+
*
|
|
366
|
+
* However, only a single connection may be writing to the database at any one time.
|
|
367
|
+
*
|
|
368
|
+
* A connection is thread-safe, and operates by serializing access to itself.
|
|
369
|
+
* Thus you can share a single connection between multiple threads.
|
|
370
|
+
* But for conncurrent access between multiple threads you must use multiple connections.
|
|
371
|
+
*
|
|
372
|
+
* You should avoid creating more connections than you need.
|
|
373
|
+
* Creating a new connection everytime you need to access the database is a recipe for foolishness.
|
|
374
|
+
**/
|
|
375
|
+
- (YapDatabaseConnection *)newConnection;
|
|
376
|
+
|
|
377
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
378
|
+
#pragma mark Extensions
|
|
379
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Registers the extension with the database using the given name.
|
|
383
|
+
* After registration everything works automatically using just the extension name.
|
|
384
|
+
*
|
|
385
|
+
* The registration process is equivalent to a readwrite transaction.
|
|
386
|
+
* It involves persisting various information about the extension to the database,
|
|
387
|
+
* as well as possibly populating the extension by enumerating existing rows in the database.
|
|
388
|
+
*
|
|
389
|
+
* @return
|
|
390
|
+
* YES if the extension was properly registered.
|
|
391
|
+
* NO if an error occurred, such as the extensionName is already registered.
|
|
392
|
+
*
|
|
393
|
+
* @see asyncRegisterExtension:withName:completionBlock:
|
|
394
|
+
* @see asyncRegisterExtension:withName:completionBlock:completionQueue:
|
|
395
|
+
**/
|
|
396
|
+
- (BOOL)registerExtension:(YapDatabaseExtension *)extension withName:(NSString *)extensionName;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* Asynchronoulsy starts the extension registration process.
|
|
400
|
+
* After registration everything works automatically using just the extension name.
|
|
401
|
+
*
|
|
402
|
+
* The registration process is equivalent to a readwrite transaction.
|
|
403
|
+
* It involves persisting various information about the extension to the database,
|
|
404
|
+
* as well as possibly populating the extension by enumerating existing rows in the database.
|
|
405
|
+
*
|
|
406
|
+
* An optional completion block may be used.
|
|
407
|
+
* If the extension registration was successful then the ready parameter will be YES.
|
|
408
|
+
*
|
|
409
|
+
* The completionBlock will be invoked on the main thread (dispatch_get_main_queue()).
|
|
410
|
+
**/
|
|
411
|
+
- (void)asyncRegisterExtension:(YapDatabaseExtension *)extension
|
|
412
|
+
withName:(NSString *)extensionName
|
|
413
|
+
completionBlock:(void(^)(BOOL ready))completionBlock;
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Asynchronoulsy starts the extension registration process.
|
|
417
|
+
* After registration everything works automatically using just the extension name.
|
|
418
|
+
*
|
|
419
|
+
* The registration process is equivalent to a readwrite transaction.
|
|
420
|
+
* It involves persisting various information about the extension to the database,
|
|
421
|
+
* as well as possibly populating the extension by enumerating existing rows in the database.
|
|
422
|
+
*
|
|
423
|
+
* An optional completion block may be used.
|
|
424
|
+
* If the extension registration was successful then the ready parameter will be YES.
|
|
425
|
+
*
|
|
426
|
+
* Additionally the dispatch_queue to invoke the completion block may also be specified.
|
|
427
|
+
* If NULL, dispatch_get_main_queue() is automatically used.
|
|
428
|
+
**/
|
|
429
|
+
- (void)asyncRegisterExtension:(YapDatabaseExtension *)extension
|
|
430
|
+
withName:(NSString *)extensionName
|
|
431
|
+
completionBlock:(void(^)(BOOL ready))completionBlock
|
|
432
|
+
completionQueue:(dispatch_queue_t)completionQueue;
|
|
433
|
+
|
|
434
|
+
/**
|
|
435
|
+
* This method unregisters an extension with the given name.
|
|
436
|
+
* The associated underlying tables will be dropped from the database.
|
|
437
|
+
*
|
|
438
|
+
* Note 1:
|
|
439
|
+
* You can unregister an extension that was hasn't been registered. For example,
|
|
440
|
+
* you've previously registered an extension (in previous app launches), but you no longer need the extension.
|
|
441
|
+
* You don't have to bother creating and registering the unneeded extension,
|
|
442
|
+
* just so you can unregister it and have the associated tables dropped.
|
|
443
|
+
* The database persists information about registered extensions, including the associated class of an extension.
|
|
444
|
+
* So you can simply pass the name of the extension, and the database system will use the associated class to
|
|
445
|
+
* drop the appropriate tables.
|
|
446
|
+
*
|
|
447
|
+
* Note:
|
|
448
|
+
* You don't have to worry about unregistering extensions that you no longer need.
|
|
449
|
+
*
|
|
450
|
+
* @see asyncUnregisterExtension:completionBlock:
|
|
451
|
+
* @see asyncUnregisterExtension:completionBlock:completionQueue:
|
|
452
|
+
**/
|
|
453
|
+
- (void)unregisterExtension:(NSString *)extensionName;
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Asynchronoulsy starts the extension unregistration process.
|
|
457
|
+
*
|
|
458
|
+
* The unregistration process is equivalent to a readwrite transaction.
|
|
459
|
+
* It involves deleting various information about the extension from the database,
|
|
460
|
+
* as well as possibly dropping related tables the extension may have been using.
|
|
461
|
+
*
|
|
462
|
+
* An optional completion block may be used.
|
|
463
|
+
*
|
|
464
|
+
* The completionBlock will be invoked on the main thread (dispatch_get_main_queue()).
|
|
465
|
+
**/
|
|
466
|
+
- (void)asyncUnregisterExtension:(NSString *)extensionName
|
|
467
|
+
completionBlock:(dispatch_block_t)completionBlock;
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Asynchronoulsy starts the extension unregistration process.
|
|
471
|
+
*
|
|
472
|
+
* The unregistration process is equivalent to a readwrite transaction.
|
|
473
|
+
* It involves deleting various information about the extension from the database,
|
|
474
|
+
* as well as possibly dropping related tables the extension may have been using.
|
|
475
|
+
*
|
|
476
|
+
* An optional completion block may be used.
|
|
477
|
+
*
|
|
478
|
+
* Additionally the dispatch_queue to invoke the completion block may also be specified.
|
|
479
|
+
* If NULL, dispatch_get_main_queue() is automatically used.
|
|
480
|
+
**/
|
|
481
|
+
- (void)asyncUnregisterExtension:(NSString *)extensionName
|
|
482
|
+
completionBlock:(dispatch_block_t)completionBlock
|
|
483
|
+
completionQueue:(dispatch_queue_t)completionQueue;
|
|
484
|
+
|
|
485
|
+
/**
|
|
486
|
+
* Returns the registered extension with the given name.
|
|
487
|
+
* The returned object will be a subclass of YapDatabaseExtension.
|
|
488
|
+
**/
|
|
489
|
+
- (id)registeredExtension:(NSString *)extensionName;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Returns all currently registered extensions as a dictionary.
|
|
493
|
+
* The key is the registed name (NSString), and the value is the extension (YapDatabaseExtension subclass).
|
|
494
|
+
**/
|
|
495
|
+
- (NSDictionary *)registeredExtensions;
|
|
496
|
+
|
|
497
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
498
|
+
#pragma mark Connection Pooling
|
|
499
|
+
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
500
|
+
|
|
501
|
+
/**
|
|
502
|
+
* As recommended in the "Performance Primer" ( https://github.com/yaptv/YapDatabase/wiki/Performance-Primer )
|
|
503
|
+
*
|
|
504
|
+
* > You should consider connections to be relatively heavy weight objects.
|
|
505
|
+
* >
|
|
506
|
+
* > OK, truth be told they're not really that heavy weight. I'm just trying to scare you.
|
|
507
|
+
* > Because in terms of performance, you get a lot of bang for your buck if you recycle your connections.
|
|
508
|
+
*
|
|
509
|
+
* However, experience has shown how easy it is to neglect this information.
|
|
510
|
+
* Perhaps because it's just so darn easy to create a connection that it becomes easy to forgot
|
|
511
|
+
* that connections aren't free.
|
|
512
|
+
*
|
|
513
|
+
* Whatever the reason, the connection pool was designed to alleviate some of the overhead.
|
|
514
|
+
* The most expensive component of a connection is the internal sqlite database connection.
|
|
515
|
+
* The connection pool keeps these internal sqlite database connections around in a pool to help recycle them.
|
|
516
|
+
*
|
|
517
|
+
* So when a connection gets deallocated, it returns the sqlite database connection to the pool.
|
|
518
|
+
* And when a new connection gets created, it can recycle a sqlite database connection from the pool.
|
|
519
|
+
*
|
|
520
|
+
* This property sets a maximum limit on the number of items that will get stored in the pool at any one time.
|
|
521
|
+
*
|
|
522
|
+
* The default value is 5.
|
|
523
|
+
*
|
|
524
|
+
* See also connectionPoolLifetime,
|
|
525
|
+
* which allows you to set a maximum lifetime of connections sitting around in the pool.
|
|
526
|
+
**/
|
|
527
|
+
@property (atomic, assign, readwrite) NSUInteger maxConnectionPoolCount;
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* The connection pool can automatically drop "stale" connections.
|
|
531
|
+
* That is, if an item stays in the pool for too long (without another connection coming along and
|
|
532
|
+
* removing it from the pool to be recycled) then the connection can optionally be removed and dropped.
|
|
533
|
+
*
|
|
534
|
+
* This is called the connection "lifetime".
|
|
535
|
+
*
|
|
536
|
+
* That is, after an item is added to the connection pool to be recycled, a timer will be started.
|
|
537
|
+
* If the connection is still in the pool when the timer goes off,
|
|
538
|
+
* then the connection will automatically be removed and dropped.
|
|
539
|
+
*
|
|
540
|
+
* The default value is 90 seconds.
|
|
541
|
+
*
|
|
542
|
+
* To disable the timer, set the lifetime to zero (or any non-positive value).
|
|
543
|
+
* When disabled, open connections will remain in the pool indefinitely.
|
|
544
|
+
**/
|
|
545
|
+
@property (atomic, assign, readwrite) NSTimeInterval connectionPoolLifetime;
|
|
546
|
+
|
|
547
|
+
@end
|