motion-yapper 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +3 -1
- data/lib/yapper.rb +3 -3
- data/lib/yapper/db.rb +61 -4
- data/lib/yapper/document/persistence.rb +4 -0
- data/lib/yapper/document/selection.rb +13 -0
- data/lib/yapper/version.rb +1 -1
- data/motion-yapper.gemspec +1 -1
- data/spec/integration/search_spec.rb +111 -0
- data/vendor/Podfile.lock +11 -7
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +16 -2
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +10 -7
- data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +20 -2
- metadata +19 -297
- data/vendor/Pods/.build/libPods-CocoaLumberjack.a +0 -0
- data/vendor/Pods/.build/libPods-NSData+MD5Digest.a +0 -0
- data/vendor/Pods/.build/libPods-YapDatabase.a +0 -0
- data/vendor/Pods/.build/libPods.a +0 -0
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +0 -41
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +0 -102
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDContextFilterLogFormatter.h +0 -63
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDDispatchQueueLogFormatter.h +0 -128
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +0 -369
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog+LOGV.h +0 -99
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +0 -634
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDMultiFormatter.h +0 -30
- data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +0 -181
- data/vendor/Pods/BuildHeaders/NSData+MD5Digest/NSData+MD5Digest.h +0 -18
- data/vendor/Pods/BuildHeaders/YapDatabase/NSDictionary+YapDatabase.h +0 -8
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +0 -91
- data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +0 -23
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +0 -547
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +0 -449
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnectionState.h +0 -29
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +0 -37
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtension.h +0 -15
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionConnection.h +0 -11
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +0 -444
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionTransaction.h +0 -11
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +0 -81
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewConnection.h +0 -12
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +0 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +0 -39
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTypes.h +0 -32
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearch.h +0 -89
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchConnection.h +0 -32
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +0 -77
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +0 -79
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchTransaction.h +0 -68
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseLogging.h +0 -158
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseManager.h +0 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +0 -446
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseQuery.h +0 -42
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationship.h +0 -35
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipConnection.h +0 -29
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdge.h +0 -163
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipEdgePrivate.h +0 -79
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipNode.h +0 -99
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipOptions.h +0 -59
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipPrivate.h +0 -125
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseRelationshipTransaction.h +0 -384
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +0 -149
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexConnection.h +0 -33
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +0 -83
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetup.h +0 -33
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetupPrivate.h +0 -18
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +0 -58
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseStatement.h +0 -13
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseString.h +0 -121
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +0 -651
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +0 -127
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +0 -272
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChangePrivate.h +0 -94
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +0 -116
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +0 -842
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappingsPrivate.h +0 -72
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +0 -63
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPage.h +0 -36
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPageMetadata.h +0 -27
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +0 -170
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptions.h +0 -330
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +0 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +0 -498
- data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTypes.h +0 -99
- data/vendor/Pods/BuildHeaders/YapDatabase/YapMemoryTable.h +0 -74
- data/vendor/Pods/BuildHeaders/YapDatabase/YapNull.h +0 -17
- data/vendor/Pods/BuildHeaders/YapDatabase/YapSet.h +0 -41
- data/vendor/Pods/BuildHeaders/YapDatabase/YapTouch.h +0 -15
- data/vendor/Pods/CocoaLumberjack/LICENSE.txt +0 -18
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +0 -41
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +0 -100
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +0 -102
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +0 -727
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +0 -369
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +0 -1539
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog+LOGV.h +0 -99
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +0 -634
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +0 -1208
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +0 -181
- data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +0 -1520
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.h +0 -63
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDContextFilterLogFormatter.m +0 -191
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.h +0 -128
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDDispatchQueueLogFormatter.m +0 -253
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.h +0 -30
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DDMultiFormatter.m +0 -127
- data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +0 -7
- data/vendor/Pods/CocoaLumberjack/README.markdown +0 -74
- data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +0 -41
- data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +0 -102
- data/vendor/Pods/Headers/CocoaLumberjack/DDContextFilterLogFormatter.h +0 -63
- data/vendor/Pods/Headers/CocoaLumberjack/DDDispatchQueueLogFormatter.h +0 -128
- data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +0 -369
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog+LOGV.h +0 -99
- data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +0 -634
- data/vendor/Pods/Headers/CocoaLumberjack/DDMultiFormatter.h +0 -30
- data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +0 -181
- data/vendor/Pods/Headers/NSData+MD5Digest/NSData+MD5Digest.h +0 -18
- data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +0 -23
- data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +0 -547
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +0 -449
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtension.h +0 -15
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionConnection.h +0 -11
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionTransaction.h +0 -11
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +0 -81
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewConnection.h +0 -12
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +0 -39
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTypes.h +0 -32
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearch.h +0 -89
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchConnection.h +0 -32
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +0 -79
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchTransaction.h +0 -68
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseQuery.h +0 -42
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationship.h +0 -35
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipConnection.h +0 -29
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipEdge.h +0 -163
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipNode.h +0 -99
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipOptions.h +0 -59
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseRelationshipTransaction.h +0 -384
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +0 -149
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexConnection.h +0 -33
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexSetup.h +0 -33
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +0 -58
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +0 -651
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +0 -127
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +0 -272
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +0 -116
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +0 -842
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +0 -63
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptions.h +0 -330
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +0 -498
- data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTypes.h +0 -99
- data/vendor/Pods/Headers/YapDatabase/YapSet.h +0 -41
- data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +0 -7
- data/vendor/Pods/Headers/____Pods-NSData+MD5Digest-prefix.h +0 -5
- data/vendor/Pods/Headers/____Pods-YapDatabase-prefix.h +0 -5
- data/vendor/Pods/Headers/____Pods-environment.h +0 -38
- data/vendor/Pods/Manifest.lock +0 -22
- data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.h +0 -18
- data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.m +0 -39
- data/vendor/Pods/NSData+MD5Digest/README.md +0 -11
- data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-CocoaLumberjack-dummy.m +0 -5
- data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +0 -7
- data/vendor/Pods/Pods-CocoaLumberjack.xcconfig +0 -0
- data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-NSData+MD5Digest-dummy.m +0 -5
- data/vendor/Pods/Pods-NSData+MD5Digest-prefix.pch +0 -5
- data/vendor/Pods/Pods-NSData+MD5Digest.xcconfig +0 -0
- data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +0 -5
- data/vendor/Pods/Pods-YapDatabase-dummy.m +0 -5
- data/vendor/Pods/Pods-YapDatabase-prefix.pch +0 -5
- data/vendor/Pods/Pods-YapDatabase.xcconfig +0 -1
- data/vendor/Pods/Pods-acknowledgements.markdown +0 -59
- data/vendor/Pods/Pods-acknowledgements.plist +0 -97
- data/vendor/Pods/Pods-dummy.m +0 -5
- data/vendor/Pods/Pods-environment.h +0 -38
- data/vendor/Pods/Pods-resources.sh +0 -68
- data/vendor/Pods/Pods.xcconfig +0 -5
- data/vendor/Pods/Pods.xcodeproj/project.pbxproj +0 -4807
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-CocoaLumberjack.xcscheme +0 -59
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-NSData+MD5Digest.xcscheme +0 -59
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods-YapDatabase.xcscheme +0 -59
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/Pods.xcscheme +0 -59
- data/vendor/Pods/Pods.xcodeproj/xcuserdata/kareemk.xcuserdatad/xcschemes/xcschememanagement.plist +0 -31
- data/vendor/Pods/YapDatabase/LICENSE.txt +0 -18
- data/vendor/Pods/YapDatabase/README.md +0 -32
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +0 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +0 -81
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +0 -159
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.h +0 -12
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.m +0 -41
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +0 -39
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +0 -1235
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTypes.h +0 -32
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +0 -77
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.h +0 -89
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.m +0 -146
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.h +0 -32
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +0 -298
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.h +0 -79
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.m +0 -95
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.h +0 -68
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +0 -1403
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +0 -444
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.h +0 -15
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +0 -83
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.h +0 -11
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +0 -46
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.h +0 -11
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +0 -204
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipEdgePrivate.h +0 -79
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/Internal/YapDatabaseRelationshipPrivate.h +0 -125
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.h +0 -35
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationship.m +0 -129
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.h +0 -29
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipConnection.m +0 -802
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.h +0 -163
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipEdge.m +0 -408
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipNode.h +0 -99
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.h +0 -59
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipOptions.m +0 -29
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.h +0 -384
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Relationships/YapDatabaseRelationshipTransaction.m +0 -5254
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +0 -83
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexSetupPrivate.h +0 -18
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +0 -149
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +0 -161
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.h +0 -33
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +0 -331
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.h +0 -33
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +0 -245
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.h +0 -58
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +0 -1269
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewChangePrivate.h +0 -94
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewMappingsPrivate.h +0 -72
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.h +0 -36
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.mm +0 -296
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.h +0 -27
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.m +0 -28
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +0 -170
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewRangeOptionsPrivate.h +0 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +0 -272
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +0 -2500
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +0 -842
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +0 -1714
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.h +0 -330
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.m +0 -141
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +0 -127
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +0 -194
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +0 -116
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +0 -888
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +0 -63
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.m +0 -27
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +0 -498
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +0 -4986
- data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTypes.h +0 -99
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.h +0 -8
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/NSDictionary+YapDatabase.m +0 -19
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +0 -91
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +0 -465
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.h +0 -29
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.m +0 -48
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +0 -37
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +0 -83
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.h +0 -158
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.m +0 -73
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.h +0 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.m +0 -56
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +0 -446
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.h +0 -13
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.m +0 -26
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseString.h +0 -121
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.h +0 -74
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.m +0 -603
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.h +0 -17
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +0 -35
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.h +0 -15
- data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.m +0 -31
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +0 -23
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +0 -199
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.h +0 -42
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.m +0 -96
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.h +0 -41
- data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.m +0 -82
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +0 -547
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +0 -2013
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +0 -449
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +0 -4046
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +0 -651
- data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +0 -5602
- data/vendor/Pods/build-iPhoneSimulator/Pods.bridgesupport +0 -3172
- data/vendor/Pods/build-iPhoneSimulator/libPods.a +0 -0
@@ -1,13 +0,0 @@
|
|
1
|
-
#import <Foundation/Foundation.h>
|
2
|
-
#import "sqlite3.h"
|
3
|
-
|
4
|
-
/**
|
5
|
-
* Simple wrapper class to facilitate storing sqlite3_stmt items as objects (primarily in YapCache).
|
6
|
-
**/
|
7
|
-
@interface YapDatabaseStatement : NSObject
|
8
|
-
|
9
|
-
- (id)initWithStatement:(sqlite3_stmt *)stmt;
|
10
|
-
|
11
|
-
@property (nonatomic, assign, readonly) sqlite3_stmt *stmt;
|
12
|
-
|
13
|
-
@end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
#import "YapDatabaseStatement.h"
|
2
|
-
#import "YapDatabasePrivate.h"
|
3
|
-
|
4
|
-
|
5
|
-
@implementation YapDatabaseStatement
|
6
|
-
{
|
7
|
-
sqlite3_stmt *stmt;
|
8
|
-
}
|
9
|
-
|
10
|
-
@synthesize stmt = stmt;
|
11
|
-
|
12
|
-
- (id)initWithStatement:(sqlite3_stmt *)inStmt
|
13
|
-
{
|
14
|
-
if ((self = [super init]))
|
15
|
-
{
|
16
|
-
stmt = inStmt;
|
17
|
-
}
|
18
|
-
return self;
|
19
|
-
}
|
20
|
-
|
21
|
-
- (void)dealloc
|
22
|
-
{
|
23
|
-
sqlite_finalize_null(&stmt);
|
24
|
-
}
|
25
|
-
|
26
|
-
@end
|
@@ -1,121 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* There are a LOT of conversions from NSString to char array.
|
3
|
-
* This happens in almost every method, where we bind text to prepared sqlite3 statements.
|
4
|
-
*
|
5
|
-
* It is inefficient to use [key UTF8String] for these situations.
|
6
|
-
* The Apple documentation is very explicit concerning the UTF8String method:
|
7
|
-
*
|
8
|
-
* > The returned C string is automatically freed just as a returned object would be released;
|
9
|
-
* > you should copy the C string if [you need] to store it outside of the
|
10
|
-
* > autorelease context in which the C string is created.
|
11
|
-
*
|
12
|
-
* In other words, the UTF8String method does a malloc for character buffer, copies the characters,
|
13
|
-
* and autoreleases the buffer (just like an autoreleased NSData instance).
|
14
|
-
*
|
15
|
-
* Thus we suffer a bunch of malloc's if we use UTF8String.
|
16
|
-
*
|
17
|
-
* Considering that almost all keys are likely to be relatively small,
|
18
|
-
* a much faster technique is to use the stack instead of the heap (with obvious precautions, see below).
|
19
|
-
*
|
20
|
-
* Note: This technique ONLY applies to key names and collection names.
|
21
|
-
* It does NOT apply to object/primitiveData or metadata. Those are binded to sqlite3 statements using binary blobs.
|
22
|
-
**/
|
23
|
-
|
24
|
-
|
25
|
-
/**
|
26
|
-
* We must be cautious and conservative so as to avoid stack overflow.
|
27
|
-
* This is possibe if really huge key names or collection names are used.
|
28
|
-
*
|
29
|
-
* The number below represents the largest amount of memory (in bytes) that will be allocated on the stack per string.
|
30
|
-
**/
|
31
|
-
#define YapDatabaseStringMaxStackLength (1024 * 4)
|
32
|
-
|
33
|
-
/**
|
34
|
-
* Struct designed to be allocated on the stack.
|
35
|
-
* You then use the inline functions below to "setup" and "teardown" the struct.
|
36
|
-
* For example:
|
37
|
-
*
|
38
|
-
* > YapDatabaseString myKeyChar;
|
39
|
-
* > MakeYapDatabaseString(&myKeyChar, myNSStringKey);
|
40
|
-
* > ...
|
41
|
-
* > sqlite3_bind_text(statement, position, myKeyChar.str, myKeyChar.length, SQLITE_STATIC);
|
42
|
-
* > ...
|
43
|
-
* > sqlite3_clear_bindings(statement);
|
44
|
-
* > sqlite3_reset(statement);
|
45
|
-
* > FreeYapDatabaseString(&myKeyChar);
|
46
|
-
*
|
47
|
-
* There are 2 "public" fields:
|
48
|
-
* str - Pointer to the char[] string.
|
49
|
-
* length - Represents the length (in bytes) of the char[] str (excluding the NULL termination byte, as usual).
|
50
|
-
*
|
51
|
-
* The other 2 "private" fields are for internal use:
|
52
|
-
* strStack - If the string doesn't exceed YapDatabaseStringMaxStackLength,
|
53
|
-
* then the bytes are copied here (onto stack storage), and str actually points to strStack.
|
54
|
-
* strHeap - If the string exceeds YapDatabaseStringMaxStackLength,
|
55
|
-
* the space is allocated on the heap, strHeap holds the pointer, and str has the same pointer.
|
56
|
-
*
|
57
|
-
* Thus the "setup" and "teardown" methods below will automatically switch to heap storage (just like UTF8String),
|
58
|
-
* if the key/collection name is too long, and performance will be equivalent.
|
59
|
-
* But in the common case of short key/collection names, we can skip the more expensive heap allocation/deallocation.
|
60
|
-
**/
|
61
|
-
struct YapDatabaseString {
|
62
|
-
int length;
|
63
|
-
char strStack[YapDatabaseStringMaxStackLength];
|
64
|
-
char *strHeap;
|
65
|
-
char *str; // Pointer to either strStack or strHeap
|
66
|
-
};
|
67
|
-
typedef struct YapDatabaseString YapDatabaseString;
|
68
|
-
|
69
|
-
/**
|
70
|
-
* Initializes the YapDatabaseString structure.
|
71
|
-
* It will automatically use heap storage if the given NSString is too long.
|
72
|
-
*
|
73
|
-
* This method should always be balanced with a call to FreeYapDatabaseString.
|
74
|
-
**/
|
75
|
-
NS_INLINE void MakeYapDatabaseString(YapDatabaseString *dbStr, NSString *nsStr)
|
76
|
-
{
|
77
|
-
if (nsStr)
|
78
|
-
{
|
79
|
-
// We convert to int because the sqlite3_bind_text() function expects an int parameter.
|
80
|
-
// So we can change it to int here, or we can cast everywhere throughout the project.
|
81
|
-
|
82
|
-
dbStr->length = (int)[nsStr lengthOfBytesUsingEncoding:NSUTF8StringEncoding];
|
83
|
-
|
84
|
-
if ((dbStr->length + 1) <= YapDatabaseStringMaxStackLength)
|
85
|
-
{
|
86
|
-
dbStr->strHeap = NULL;
|
87
|
-
dbStr->str = dbStr->strStack;
|
88
|
-
}
|
89
|
-
else
|
90
|
-
{
|
91
|
-
dbStr->strHeap = (char *)malloc((dbStr->length + 1));
|
92
|
-
dbStr->str = dbStr->strHeap;
|
93
|
-
}
|
94
|
-
|
95
|
-
[nsStr getCString:dbStr->str maxLength:(dbStr->length + 1) encoding:NSUTF8StringEncoding];
|
96
|
-
}
|
97
|
-
else
|
98
|
-
{
|
99
|
-
dbStr->length = 0;
|
100
|
-
dbStr->strHeap = NULL;
|
101
|
-
dbStr->str = NULL;
|
102
|
-
}
|
103
|
-
}
|
104
|
-
|
105
|
-
/**
|
106
|
-
* If heap storage was needed (because the string length exceeded YapDatabaseStringMaxStackLength),
|
107
|
-
* this method frees the heap allocated memory.
|
108
|
-
*
|
109
|
-
* In the common case of stack storage, strHeap will be NULL, and this method is essentially a no-op.
|
110
|
-
*
|
111
|
-
* This method should be invoked AFTER sqlite3_clear_bindings (assuming SQLITE_STATIC is used).
|
112
|
-
**/
|
113
|
-
NS_INLINE void FreeYapDatabaseString(YapDatabaseString *dbStr)
|
114
|
-
{
|
115
|
-
if (dbStr->strHeap)
|
116
|
-
{
|
117
|
-
free(dbStr->strHeap);
|
118
|
-
dbStr->strHeap = NULL;
|
119
|
-
dbStr->str = NULL;
|
120
|
-
}
|
121
|
-
}
|
@@ -1,74 +0,0 @@
|
|
1
|
-
#import <Foundation/Foundation.h>
|
2
|
-
|
3
|
-
@class YapMemoryTableTransaction;
|
4
|
-
|
5
|
-
|
6
|
-
/**
|
7
|
-
* A "memory table" is a dictionary that supports versioning.
|
8
|
-
* There may be multiple values for a single key, with each value associated with a different snapshot.
|
9
|
-
*
|
10
|
-
* The memory table is accessed via a YapMemoryTableTransaction instance,
|
11
|
-
* which is itself associated with a particular timestamp. Thus the transaction is able to properly identify
|
12
|
-
* which version is appropriate for itself.
|
13
|
-
**/
|
14
|
-
@interface YapMemoryTable : NSObject
|
15
|
-
|
16
|
-
/**
|
17
|
-
* Initializes a memory table.
|
18
|
-
*
|
19
|
-
* The keyClass is used for debugging, to ensure the proper key type is always used when accessing the table.
|
20
|
-
* The keyClass is used within NSAssert statements that typically get compiled out for release builds.
|
21
|
-
**/
|
22
|
-
- (id)initWithKeyClass:(Class)keyClass;
|
23
|
-
|
24
|
-
/**
|
25
|
-
* Creates and returns a new connection associated with the shared cache.
|
26
|
-
**/
|
27
|
-
- (YapMemoryTableTransaction *)newReadTransactionWithSnapshot:(uint64_t)snapshot;
|
28
|
-
- (YapMemoryTableTransaction *)newReadWriteTransactionWithSnapshot:(uint64_t)snapshot;
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Invoked automatically by YapDatabase architecture.
|
32
|
-
**/
|
33
|
-
- (void)asyncCheckpoint:(int64_t)minSnapshot;
|
34
|
-
|
35
|
-
@end
|
36
|
-
|
37
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
38
|
-
#pragma mark -
|
39
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
40
|
-
|
41
|
-
@interface YapMemoryTableTransaction : NSObject
|
42
|
-
|
43
|
-
@property (nonatomic, readonly) uint64_t snapshot;
|
44
|
-
@property (nonatomic, readonly) BOOL isReadWriteTransaction;
|
45
|
-
|
46
|
-
- (id)objectForKey:(id)key;
|
47
|
-
|
48
|
-
- (void)enumerateKeysWithBlock:(void (^)(id key, BOOL *stop))block;
|
49
|
-
|
50
|
-
- (void)enumerateKeysAndObjectsWithBlock:(void (^)(id key, id obj, BOOL *stop))block;
|
51
|
-
|
52
|
-
//
|
53
|
-
// For ReadWrite transactions:
|
54
|
-
|
55
|
-
- (void)setObject:(id)object forKey:(id)key;
|
56
|
-
|
57
|
-
- (void)removeObjectForKey:(id)key;
|
58
|
-
- (void)removeObjectsForKeys:(NSArray *)keys;
|
59
|
-
|
60
|
-
- (void)removeAllObjects;
|
61
|
-
|
62
|
-
//
|
63
|
-
// Batch access / modifications
|
64
|
-
|
65
|
-
- (void)accessWithBlock:(dispatch_block_t)block;
|
66
|
-
- (void)modifyWithBlock:(dispatch_block_t)block;
|
67
|
-
|
68
|
-
//
|
69
|
-
// Transaction state
|
70
|
-
|
71
|
-
- (void)commit;
|
72
|
-
- (void)rollback;
|
73
|
-
|
74
|
-
@end
|
@@ -1,603 +0,0 @@
|
|
1
|
-
#import "YapMemoryTable.h"
|
2
|
-
|
3
|
-
|
4
|
-
/**
|
5
|
-
* There may be multiple simulatneous database transactions, each using different atomic snapshots.
|
6
|
-
* In other words, the value in the database at snapshot A may be different than at snapshot B.
|
7
|
-
* Each value is correct, and depends entirely on the snapshot being used by the transaction.
|
8
|
-
*
|
9
|
-
* This presents a unique property of the table:
|
10
|
-
* - the table may store multiple values for a single key.
|
11
|
-
* - the stored values are associated with a snapshot
|
12
|
-
*
|
13
|
-
* This class represents a single stored value and its associated snapshot.
|
14
|
-
* It is one value contained within a linked-list of possibly multiple values for the same key.
|
15
|
-
* The linked-list remains sorted, with the most recent value at the front of the linked-list.
|
16
|
-
**/
|
17
|
-
@interface YapMemoryTableValue : NSObject {
|
18
|
-
@public
|
19
|
-
YapMemoryTableValue *olderValue;
|
20
|
-
|
21
|
-
uint64_t snapshot;
|
22
|
-
id object;
|
23
|
-
}
|
24
|
-
|
25
|
-
@end
|
26
|
-
|
27
|
-
@implementation YapMemoryTableValue
|
28
|
-
|
29
|
-
- (NSString *)description
|
30
|
-
{
|
31
|
-
return [NSString stringWithFormat:@"<YapMemoryTableValue[%p]: snapshot(%llu), olderValue(%p), object(%@)>",
|
32
|
-
self, snapshot, olderValue, object];
|
33
|
-
}
|
34
|
-
|
35
|
-
@end
|
36
|
-
|
37
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
38
|
-
#pragma mark -
|
39
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
40
|
-
|
41
|
-
@interface YapMemoryTable () {
|
42
|
-
@public
|
43
|
-
|
44
|
-
Class keyClass;
|
45
|
-
|
46
|
-
NSMutableDictionary *dict;
|
47
|
-
|
48
|
-
dispatch_queue_t queue;
|
49
|
-
void *IsOnQueueKey;
|
50
|
-
|
51
|
-
NSMutableArray *snapshots;
|
52
|
-
NSMutableArray *changes;
|
53
|
-
NSLock *lock;
|
54
|
-
}
|
55
|
-
@end
|
56
|
-
|
57
|
-
@interface YapMemoryTableTransaction () {
|
58
|
-
@public
|
59
|
-
|
60
|
-
__unsafe_unretained YapMemoryTable *table;
|
61
|
-
|
62
|
-
uint64_t snapshot;
|
63
|
-
BOOL isReadWriteTransaction;
|
64
|
-
|
65
|
-
NSMutableSet *changedKeys;
|
66
|
-
}
|
67
|
-
@end
|
68
|
-
|
69
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
70
|
-
#pragma mark -
|
71
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
72
|
-
|
73
|
-
@implementation YapMemoryTable
|
74
|
-
|
75
|
-
- (id)initWithKeyClass:(Class)inKeyClass
|
76
|
-
{
|
77
|
-
if ((self = [super init]))
|
78
|
-
{
|
79
|
-
keyClass = inKeyClass;
|
80
|
-
|
81
|
-
dict = [[NSMutableDictionary alloc] init];
|
82
|
-
queue = dispatch_queue_create("YapMemoryTable", DISPATCH_QUEUE_CONCURRENT);
|
83
|
-
|
84
|
-
IsOnQueueKey = &IsOnQueueKey;
|
85
|
-
dispatch_queue_set_specific(queue, IsOnQueueKey, IsOnQueueKey, NULL);
|
86
|
-
|
87
|
-
snapshots = [[NSMutableArray alloc] init];
|
88
|
-
changes = [[NSMutableArray alloc] init];
|
89
|
-
lock = [[NSLock alloc] init];
|
90
|
-
}
|
91
|
-
return self;
|
92
|
-
}
|
93
|
-
- (YapMemoryTableTransaction *)newReadTransactionWithSnapshot:(uint64_t)snapshot
|
94
|
-
{
|
95
|
-
YapMemoryTableTransaction *transaction = [[YapMemoryTableTransaction alloc] init];
|
96
|
-
transaction->table = self;
|
97
|
-
transaction->snapshot = snapshot;
|
98
|
-
transaction->isReadWriteTransaction = NO;
|
99
|
-
|
100
|
-
return transaction;
|
101
|
-
}
|
102
|
-
|
103
|
-
- (YapMemoryTableTransaction *)newReadWriteTransactionWithSnapshot:(uint64_t)snapshot
|
104
|
-
{
|
105
|
-
YapMemoryTableTransaction *transaction = [[YapMemoryTableTransaction alloc] init];
|
106
|
-
transaction->table = self;
|
107
|
-
transaction->snapshot = snapshot;
|
108
|
-
transaction->isReadWriteTransaction = YES;
|
109
|
-
|
110
|
-
return transaction;
|
111
|
-
}
|
112
|
-
|
113
|
-
- (void)asyncCheckpoint:(int64_t)minSnapshot
|
114
|
-
{
|
115
|
-
dispatch_barrier_async(queue, ^{ @autoreleasepool {
|
116
|
-
|
117
|
-
while (YES) // using manual return
|
118
|
-
{
|
119
|
-
int64_t snapshot = 0;
|
120
|
-
NSSet *changedKeys = nil;
|
121
|
-
|
122
|
-
[lock lock];
|
123
|
-
|
124
|
-
if ([snapshots count] > 0)
|
125
|
-
{
|
126
|
-
snapshot = [[snapshots objectAtIndex:0] unsignedLongLongValue];
|
127
|
-
|
128
|
-
if (snapshot < minSnapshot)
|
129
|
-
{
|
130
|
-
changedKeys = [changes objectAtIndex:0];
|
131
|
-
|
132
|
-
[snapshots removeObjectAtIndex:0];
|
133
|
-
[changes removeObjectAtIndex:0];
|
134
|
-
}
|
135
|
-
}
|
136
|
-
|
137
|
-
[lock unlock];
|
138
|
-
|
139
|
-
if (changedKeys == nil)
|
140
|
-
{
|
141
|
-
return; // Done
|
142
|
-
}
|
143
|
-
|
144
|
-
for (id key in changedKeys)
|
145
|
-
{
|
146
|
-
BOOL hasObject = NO;
|
147
|
-
|
148
|
-
__unsafe_unretained YapMemoryTableValue *prvValue = nil;
|
149
|
-
__unsafe_unretained YapMemoryTableValue *value = [dict objectForKey:key];
|
150
|
-
|
151
|
-
while (value && value->snapshot >= minSnapshot)
|
152
|
-
{
|
153
|
-
if (hasObject == NO)
|
154
|
-
hasObject = (value->object != nil);
|
155
|
-
|
156
|
-
prvValue = value;
|
157
|
-
value = value->olderValue;
|
158
|
-
}
|
159
|
-
|
160
|
-
if (value)
|
161
|
-
{
|
162
|
-
if (prvValue)
|
163
|
-
{
|
164
|
-
// The 'value' is not the latest value
|
165
|
-
|
166
|
-
if (!hasObject)
|
167
|
-
{
|
168
|
-
// All values >= minSnapshot represent a deletion.
|
169
|
-
// So we can just dump all values.
|
170
|
-
|
171
|
-
[dict removeObjectForKey:key];
|
172
|
-
}
|
173
|
-
else
|
174
|
-
{
|
175
|
-
// There are values >= minSnapshot in the table.
|
176
|
-
// So the stay in the dict.
|
177
|
-
// But everything older than minSnapshot can go.
|
178
|
-
|
179
|
-
prvValue->olderValue = nil;
|
180
|
-
}
|
181
|
-
}
|
182
|
-
else
|
183
|
-
{
|
184
|
-
// The 'value' is the latest value
|
185
|
-
|
186
|
-
if (value->object == nil)
|
187
|
-
{
|
188
|
-
// The 'value' is the latest value.
|
189
|
-
// And 'value' represents a deletion.
|
190
|
-
// So we can just dump all values.
|
191
|
-
|
192
|
-
[dict removeObjectForKey:key];
|
193
|
-
}
|
194
|
-
else
|
195
|
-
{
|
196
|
-
// The 'value' is the latest value.
|
197
|
-
// So it stays in the dict.
|
198
|
-
// But everything after it can go (if there is anything).
|
199
|
-
|
200
|
-
value->olderValue = nil;
|
201
|
-
}
|
202
|
-
}
|
203
|
-
|
204
|
-
} // end: if (value)
|
205
|
-
|
206
|
-
} // end: for (id key in changedKeys)
|
207
|
-
|
208
|
-
} // end: while (YES)
|
209
|
-
}});
|
210
|
-
}
|
211
|
-
|
212
|
-
- (void)asyncRollback:(int64_t)snapshot withChanges:(NSSet *)changedKeys
|
213
|
-
{
|
214
|
-
dispatch_barrier_async(queue, ^{ @autoreleasepool {
|
215
|
-
|
216
|
-
for (id key in changedKeys)
|
217
|
-
{
|
218
|
-
__unsafe_unretained YapMemoryTableValue *value = [dict objectForKey:key];
|
219
|
-
|
220
|
-
if (value && value->snapshot == snapshot)
|
221
|
-
{
|
222
|
-
if (value->olderValue == nil)
|
223
|
-
{
|
224
|
-
[dict removeObjectForKey:key];
|
225
|
-
}
|
226
|
-
else
|
227
|
-
{
|
228
|
-
[dict setObject:value->olderValue forKey:key];
|
229
|
-
}
|
230
|
-
}
|
231
|
-
}
|
232
|
-
}});
|
233
|
-
}
|
234
|
-
|
235
|
-
@end
|
236
|
-
|
237
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
238
|
-
#pragma mark -
|
239
|
-
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
240
|
-
|
241
|
-
@implementation YapMemoryTableTransaction
|
242
|
-
|
243
|
-
@synthesize snapshot = snapshot;
|
244
|
-
@synthesize isReadWriteTransaction = isReadWriteTransaction;
|
245
|
-
|
246
|
-
- (id)objectForKey:(id)key
|
247
|
-
{
|
248
|
-
NSAssert([key isKindOfClass:table->keyClass],
|
249
|
-
@"Unexpected key class. Expected %@, passed %@", table->keyClass, [key class]);
|
250
|
-
|
251
|
-
__block id result = nil;
|
252
|
-
|
253
|
-
dispatch_block_t block = ^{
|
254
|
-
|
255
|
-
__unsafe_unretained YapMemoryTableValue *value = [table->dict objectForKey:key];
|
256
|
-
|
257
|
-
while (value)
|
258
|
-
{
|
259
|
-
if (value->snapshot <= snapshot)
|
260
|
-
{
|
261
|
-
result = value->object;
|
262
|
-
break;
|
263
|
-
}
|
264
|
-
else
|
265
|
-
{
|
266
|
-
value = value->olderValue;
|
267
|
-
}
|
268
|
-
}
|
269
|
-
};
|
270
|
-
|
271
|
-
if (dispatch_get_specific(table->IsOnQueueKey))
|
272
|
-
block();
|
273
|
-
else
|
274
|
-
dispatch_sync(table->queue, block);
|
275
|
-
|
276
|
-
return result;
|
277
|
-
}
|
278
|
-
|
279
|
-
- (void)enumerateKeysWithBlock:(void (^)(id key, BOOL *stop))userBlock
|
280
|
-
{
|
281
|
-
dispatch_block_t block = ^{ @autoreleasepool {
|
282
|
-
|
283
|
-
[table->dict enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
284
|
-
|
285
|
-
__unsafe_unretained YapMemoryTableValue *value = [table->dict objectForKey:key];
|
286
|
-
while (value)
|
287
|
-
{
|
288
|
-
if (value->snapshot <= snapshot)
|
289
|
-
{
|
290
|
-
if (value->object)
|
291
|
-
{
|
292
|
-
userBlock(key, stop);
|
293
|
-
}
|
294
|
-
break;
|
295
|
-
}
|
296
|
-
else
|
297
|
-
{
|
298
|
-
value = value->olderValue;
|
299
|
-
}
|
300
|
-
}
|
301
|
-
}];
|
302
|
-
}};
|
303
|
-
|
304
|
-
if (dispatch_get_specific(table->IsOnQueueKey))
|
305
|
-
block();
|
306
|
-
else
|
307
|
-
dispatch_sync(table->queue, block);
|
308
|
-
}
|
309
|
-
|
310
|
-
- (void)enumerateKeysAndObjectsWithBlock:(void (^)(id key, id obj, BOOL *stop))userBlock
|
311
|
-
{
|
312
|
-
dispatch_block_t block = ^{ @autoreleasepool {
|
313
|
-
|
314
|
-
[table->dict enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
|
315
|
-
|
316
|
-
__unsafe_unretained YapMemoryTableValue *value = [table->dict objectForKey:key];
|
317
|
-
while (value)
|
318
|
-
{
|
319
|
-
if (value->snapshot <= snapshot)
|
320
|
-
{
|
321
|
-
if (value->object)
|
322
|
-
{
|
323
|
-
userBlock(key, value->object, stop);
|
324
|
-
}
|
325
|
-
break;
|
326
|
-
}
|
327
|
-
else
|
328
|
-
{
|
329
|
-
value = value->olderValue;
|
330
|
-
}
|
331
|
-
}
|
332
|
-
}];
|
333
|
-
}};
|
334
|
-
|
335
|
-
if (dispatch_get_specific(table->IsOnQueueKey))
|
336
|
-
block();
|
337
|
-
else
|
338
|
-
dispatch_sync(table->queue, block);
|
339
|
-
}
|
340
|
-
|
341
|
-
- (void)setObject:(id)object forKey:(id)key
|
342
|
-
{
|
343
|
-
NSAssert([key isKindOfClass:table->keyClass],
|
344
|
-
@"Unexpected key class. Expected %@, passed %@", table->keyClass, [key class]);
|
345
|
-
|
346
|
-
if (!isReadWriteTransaction) {
|
347
|
-
NSAssert(NO, @"Cannot modify table in read-only transaction.");
|
348
|
-
return;
|
349
|
-
}
|
350
|
-
|
351
|
-
if (changedKeys == nil)
|
352
|
-
changedKeys = [[NSMutableSet alloc] init];
|
353
|
-
|
354
|
-
dispatch_block_t block = ^{
|
355
|
-
|
356
|
-
__unsafe_unretained YapMemoryTableValue *value = [table->dict objectForKey:key];
|
357
|
-
|
358
|
-
if (value && value->snapshot == snapshot)
|
359
|
-
{
|
360
|
-
// We've already updated this key during this transaction.
|
361
|
-
|
362
|
-
value->object = object;
|
363
|
-
}
|
364
|
-
else
|
365
|
-
{
|
366
|
-
// First update for this key during this transaction.
|
367
|
-
|
368
|
-
YapMemoryTableValue *newValue = [[YapMemoryTableValue alloc] init];
|
369
|
-
newValue->olderValue = value;
|
370
|
-
newValue->object = object;
|
371
|
-
newValue->snapshot = snapshot;
|
372
|
-
|
373
|
-
[table->dict setObject:newValue forKey:key];
|
374
|
-
|
375
|
-
[changedKeys addObject:key];
|
376
|
-
}
|
377
|
-
};
|
378
|
-
|
379
|
-
if (dispatch_get_specific(table->IsOnQueueKey))
|
380
|
-
block();
|
381
|
-
else
|
382
|
-
dispatch_barrier_sync(table->queue, block);
|
383
|
-
}
|
384
|
-
|
385
|
-
- (void)removeObjectForKey:(id)key
|
386
|
-
{
|
387
|
-
NSAssert([key isKindOfClass:table->keyClass],
|
388
|
-
@"Unexpected key class. Expected %@, passed %@", table->keyClass, [key class]);
|
389
|
-
|
390
|
-
if (!isReadWriteTransaction) {
|
391
|
-
NSAssert(NO, @"Cannot modify table in read-only transaction.");
|
392
|
-
return;
|
393
|
-
}
|
394
|
-
|
395
|
-
if (changedKeys == nil)
|
396
|
-
changedKeys = [[NSMutableSet alloc] init];
|
397
|
-
|
398
|
-
dispatch_block_t block = ^{
|
399
|
-
|
400
|
-
__unsafe_unretained YapMemoryTableValue *value = [table->dict objectForKey:key];
|
401
|
-
|
402
|
-
if (value)
|
403
|
-
{
|
404
|
-
if (value->snapshot == snapshot)
|
405
|
-
{
|
406
|
-
// We've already updated this key during this transaction.
|
407
|
-
|
408
|
-
if (value->olderValue == nil)
|
409
|
-
{
|
410
|
-
// Removing a previously set value within this transaction.
|
411
|
-
// And there are no other values outside this transaction.
|
412
|
-
|
413
|
-
[table->dict removeObjectForKey:key];
|
414
|
-
|
415
|
-
[changedKeys removeObject:key];
|
416
|
-
}
|
417
|
-
else
|
418
|
-
{
|
419
|
-
// Updating a previously set value within this transaction.
|
420
|
-
// But there are other values for older snapshots.
|
421
|
-
|
422
|
-
value->object = nil;
|
423
|
-
}
|
424
|
-
}
|
425
|
-
else
|
426
|
-
{
|
427
|
-
// First update for this key during this transaction.
|
428
|
-
|
429
|
-
YapMemoryTableValue *newValue = [[YapMemoryTableValue alloc] init];
|
430
|
-
newValue->olderValue = value;
|
431
|
-
newValue->object = nil;
|
432
|
-
newValue->snapshot = snapshot;
|
433
|
-
|
434
|
-
[table->dict setObject:newValue forKey:key];
|
435
|
-
|
436
|
-
[changedKeys addObject:key];
|
437
|
-
}
|
438
|
-
}
|
439
|
-
};
|
440
|
-
|
441
|
-
if (dispatch_get_specific(table->IsOnQueueKey))
|
442
|
-
block();
|
443
|
-
else
|
444
|
-
dispatch_barrier_sync(table->queue, block);
|
445
|
-
}
|
446
|
-
|
447
|
-
- (void)removeObjectsForKeys:(NSArray *)keys
|
448
|
-
{
|
449
|
-
if (!isReadWriteTransaction) {
|
450
|
-
NSAssert(NO, @"Cannot modify table in read-only transaction.");
|
451
|
-
return;
|
452
|
-
}
|
453
|
-
|
454
|
-
if (changedKeys == nil)
|
455
|
-
changedKeys = [[NSMutableSet alloc] init];
|
456
|
-
|
457
|
-
dispatch_block_t block = ^{ @autoreleasepool {
|
458
|
-
|
459
|
-
for (id key in keys)
|
460
|
-
{
|
461
|
-
NSAssert([key isKindOfClass:table->keyClass],
|
462
|
-
@"Unexpected key class. Expected %@, passed %@", table->keyClass, [key class]);
|
463
|
-
|
464
|
-
__unsafe_unretained YapMemoryTableValue *value = [table->dict objectForKey:key];
|
465
|
-
|
466
|
-
if (value)
|
467
|
-
{
|
468
|
-
if (value->snapshot == snapshot)
|
469
|
-
{
|
470
|
-
// We've already updated this key during this transaction.
|
471
|
-
|
472
|
-
if (value->olderValue == nil)
|
473
|
-
{
|
474
|
-
// Removing a previously set value within this transaction.
|
475
|
-
// And there are no other values outside this transaction.
|
476
|
-
|
477
|
-
[table->dict removeObjectForKey:key];
|
478
|
-
|
479
|
-
[changedKeys removeObject:key];
|
480
|
-
}
|
481
|
-
else
|
482
|
-
{
|
483
|
-
// Updating a previously set value within this transaction.
|
484
|
-
// But there are other values for older snapshots.
|
485
|
-
|
486
|
-
value->object = nil;
|
487
|
-
}
|
488
|
-
}
|
489
|
-
else
|
490
|
-
{
|
491
|
-
// First update for this key during this transaction.
|
492
|
-
|
493
|
-
YapMemoryTableValue *newValue = [[YapMemoryTableValue alloc] init];
|
494
|
-
newValue->olderValue = value;
|
495
|
-
newValue->object = nil;
|
496
|
-
newValue->snapshot = snapshot;
|
497
|
-
|
498
|
-
[table->dict setObject:newValue forKey:key];
|
499
|
-
|
500
|
-
[changedKeys addObject:key];
|
501
|
-
}
|
502
|
-
}
|
503
|
-
}
|
504
|
-
}};
|
505
|
-
|
506
|
-
if (dispatch_get_specific(table->IsOnQueueKey))
|
507
|
-
block();
|
508
|
-
else
|
509
|
-
dispatch_barrier_sync(table->queue, block);
|
510
|
-
}
|
511
|
-
|
512
|
-
- (void)removeAllObjects
|
513
|
-
{
|
514
|
-
NSAssert(isReadWriteTransaction, @"Cannot modify table in read-only transaction.");
|
515
|
-
|
516
|
-
if (changedKeys == nil)
|
517
|
-
changedKeys = [[NSMutableSet alloc] init];
|
518
|
-
|
519
|
-
dispatch_block_t block = ^{ @autoreleasepool {
|
520
|
-
|
521
|
-
// Grab all keys
|
522
|
-
NSArray *keys = [table->dict allKeys];
|
523
|
-
|
524
|
-
// Mark all keys as changed
|
525
|
-
[changedKeys addObjectsFromArray:keys];
|
526
|
-
|
527
|
-
// Now enumerate all the keys, and update accordingly
|
528
|
-
for (id key in keys)
|
529
|
-
{
|
530
|
-
__unsafe_unretained YapMemoryTableValue *value = [table->dict objectForKey:key];
|
531
|
-
|
532
|
-
if (value->snapshot == snapshot)
|
533
|
-
{
|
534
|
-
// We've already updated this key during this transaction.
|
535
|
-
|
536
|
-
if (value->olderValue == nil)
|
537
|
-
{
|
538
|
-
// Removing a previously set value within this transaction.
|
539
|
-
// And there are no other values outside this transaction.
|
540
|
-
|
541
|
-
[table->dict removeObjectForKey:key];
|
542
|
-
[changedKeys removeObject:key];
|
543
|
-
}
|
544
|
-
else
|
545
|
-
{
|
546
|
-
// Updating a previously set value within this transaction.
|
547
|
-
// But there are other values for older snapshots.
|
548
|
-
|
549
|
-
value->object = nil;
|
550
|
-
}
|
551
|
-
}
|
552
|
-
else
|
553
|
-
{
|
554
|
-
// First update for this key during this transaction.
|
555
|
-
|
556
|
-
YapMemoryTableValue *newValue = [[YapMemoryTableValue alloc] init];
|
557
|
-
newValue->olderValue = value;
|
558
|
-
newValue->object = nil;
|
559
|
-
newValue->snapshot = snapshot;
|
560
|
-
|
561
|
-
[table->dict setObject:newValue forKey:key];
|
562
|
-
}
|
563
|
-
}
|
564
|
-
}};
|
565
|
-
|
566
|
-
if (dispatch_get_specific(table->IsOnQueueKey))
|
567
|
-
block();
|
568
|
-
else
|
569
|
-
dispatch_barrier_sync(table->queue, block);
|
570
|
-
}
|
571
|
-
|
572
|
-
- (void)accessWithBlock:(dispatch_block_t)block
|
573
|
-
{
|
574
|
-
dispatch_sync(table->queue, block);
|
575
|
-
}
|
576
|
-
|
577
|
-
- (void)modifyWithBlock:(dispatch_block_t)block
|
578
|
-
{
|
579
|
-
dispatch_barrier_sync(table->queue, block);
|
580
|
-
}
|
581
|
-
|
582
|
-
- (void)commit
|
583
|
-
{
|
584
|
-
if (isReadWriteTransaction && [changedKeys count] > 0)
|
585
|
-
{
|
586
|
-
[table->lock lock];
|
587
|
-
{
|
588
|
-
[table->snapshots addObject:@(snapshot)];
|
589
|
-
[table->changes addObject:changedKeys];
|
590
|
-
}
|
591
|
-
[table->lock unlock];
|
592
|
-
}
|
593
|
-
}
|
594
|
-
|
595
|
-
- (void)rollback
|
596
|
-
{
|
597
|
-
if (isReadWriteTransaction && [changedKeys count] > 0)
|
598
|
-
{
|
599
|
-
[table asyncRollback:snapshot withChanges:changedKeys];
|
600
|
-
}
|
601
|
-
}
|
602
|
-
|
603
|
-
@end
|