motion-yapper 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (348) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +20 -0
  3. data/.travis.yml +6 -0
  4. data/Gemfile +5 -0
  5. data/Gemfile.lock +63 -0
  6. data/README.md +16 -0
  7. data/Rakefile +20 -0
  8. data/app/app_delegate.rb +5 -0
  9. data/lib/yapper.rb +30 -0
  10. data/lib/yapper/attachment.rb +48 -0
  11. data/lib/yapper/bson.rb +20 -0
  12. data/lib/yapper/config.rb +18 -0
  13. data/lib/yapper/db.rb +151 -0
  14. data/lib/yapper/document.rb +54 -0
  15. data/lib/yapper/document/attachment.rb +26 -0
  16. data/lib/yapper/document/callbacks.rb +86 -0
  17. data/lib/yapper/document/persistance.rb +171 -0
  18. data/lib/yapper/document/relation.rb +84 -0
  19. data/lib/yapper/document/selection.rb +100 -0
  20. data/lib/yapper/extensions.rb +80 -0
  21. data/lib/yapper/log.rb +5 -0
  22. data/lib/yapper/sync.rb +134 -0
  23. data/lib/yapper/sync/data.rb +12 -0
  24. data/lib/yapper/sync/event.rb +194 -0
  25. data/lib/yapper/sync/queue.rb +164 -0
  26. data/lib/yapper/timestamps.rb +16 -0
  27. data/lib/yapper/version.rb +3 -0
  28. data/lib/yapper/yapper.rb +2 -0
  29. data/spec/helpers/time_helper.rb +3 -0
  30. data/spec/integration/all_spec.rb +40 -0
  31. data/spec/integration/callback_spec.rb +87 -0
  32. data/spec/integration/db_spec.rb +40 -0
  33. data/spec/integration/find_spec.rb +51 -0
  34. data/spec/integration/persistance_spec.rb +118 -0
  35. data/spec/integration/relation_spec.rb +174 -0
  36. data/spec/integration/sync_spec.rb +42 -0
  37. data/spec/integration/timestamps_spec.rb +34 -0
  38. data/spec/integration/types_spec.rb +23 -0
  39. data/spec/integration/when_spec.rb +29 -0
  40. data/spec/integration/where_spec.rb +132 -0
  41. data/vendor/Podfile.lock +24 -0
  42. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.h +641 -0
  43. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPClient.m +1396 -0
  44. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.h +133 -0
  45. data/vendor/Pods/AFNetworking/AFNetworking/AFHTTPRequestOperation.m +327 -0
  46. data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.h +113 -0
  47. data/vendor/Pods/AFNetworking/AFNetworking/AFImageRequestOperation.m +321 -0
  48. data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.h +71 -0
  49. data/vendor/Pods/AFNetworking/AFNetworking/AFJSONRequestOperation.m +150 -0
  50. data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.h +75 -0
  51. data/vendor/Pods/AFNetworking/AFNetworking/AFNetworkActivityIndicatorManager.m +157 -0
  52. data/vendor/Pods/AFNetworking/AFNetworking/AFNetworking.h +43 -0
  53. data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.h +68 -0
  54. data/vendor/Pods/AFNetworking/AFNetworking/AFPropertyListRequestOperation.m +143 -0
  55. data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.h +370 -0
  56. data/vendor/Pods/AFNetworking/AFNetworking/AFURLConnectionOperation.m +848 -0
  57. data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.h +89 -0
  58. data/vendor/Pods/AFNetworking/AFNetworking/AFXMLRequestOperation.m +167 -0
  59. data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.h +78 -0
  60. data/vendor/Pods/AFNetworking/AFNetworking/UIImageView+AFNetworking.m +191 -0
  61. data/vendor/Pods/AFNetworking/LICENSE +19 -0
  62. data/vendor/Pods/AFNetworking/README.md +208 -0
  63. data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPClient.h +641 -0
  64. data/vendor/Pods/BuildHeaders/AFNetworking/AFHTTPRequestOperation.h +133 -0
  65. data/vendor/Pods/BuildHeaders/AFNetworking/AFImageRequestOperation.h +113 -0
  66. data/vendor/Pods/BuildHeaders/AFNetworking/AFJSONRequestOperation.h +71 -0
  67. data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworkActivityIndicatorManager.h +75 -0
  68. data/vendor/Pods/BuildHeaders/AFNetworking/AFNetworking.h +43 -0
  69. data/vendor/Pods/BuildHeaders/AFNetworking/AFPropertyListRequestOperation.h +68 -0
  70. data/vendor/Pods/BuildHeaders/AFNetworking/AFURLConnectionOperation.h +370 -0
  71. data/vendor/Pods/BuildHeaders/AFNetworking/AFXMLRequestOperation.h +89 -0
  72. data/vendor/Pods/BuildHeaders/AFNetworking/UIImageView+AFNetworking.h +78 -0
  73. data/vendor/Pods/BuildHeaders/CocoaLumberjack/ContextFilterLogFormatter.h +65 -0
  74. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDASLLogger.h +41 -0
  75. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDAbstractDatabaseLogger.h +102 -0
  76. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDFileLogger.h +334 -0
  77. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDLog.h +601 -0
  78. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DDTTYLogger.h +167 -0
  79. data/vendor/Pods/BuildHeaders/CocoaLumberjack/DispatchQueueLogFormatter.h +116 -0
  80. data/vendor/Pods/BuildHeaders/NSData+MD5Digest/NSData+MD5Digest.h +18 -0
  81. data/vendor/Pods/BuildHeaders/Reachability/Reachability.h +109 -0
  82. data/vendor/Pods/BuildHeaders/YapDatabase/YapCache.h +90 -0
  83. data/vendor/Pods/BuildHeaders/YapDatabase/YapCollectionKey.h +20 -0
  84. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabase.h +547 -0
  85. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnection.h +447 -0
  86. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseConnectionState.h +29 -0
  87. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseDefaults.h +37 -0
  88. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtension.h +15 -0
  89. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionConnection.h +11 -0
  90. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionPrivate.h +440 -0
  91. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseExtensionTransaction.h +11 -0
  92. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredView.h +108 -0
  93. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewConnection.h +12 -0
  94. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewPrivate.h +19 -0
  95. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFilteredViewTransaction.h +39 -0
  96. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearch.h +89 -0
  97. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchConnection.h +32 -0
  98. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchPrivate.h +69 -0
  99. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +79 -0
  100. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseFullTextSearchTransaction.h +68 -0
  101. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseLogging.h +158 -0
  102. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseManager.h +17 -0
  103. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabasePrivate.h +424 -0
  104. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseQuery.h +42 -0
  105. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndex.h +100 -0
  106. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexConnection.h +33 -0
  107. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +73 -0
  108. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexSetup.h +33 -0
  109. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +58 -0
  110. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseStatement.h +13 -0
  111. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseString.h +121 -0
  112. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseTransaction.h +541 -0
  113. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseView.h +186 -0
  114. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChange.h +272 -0
  115. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewChangePrivate.h +94 -0
  116. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewConnection.h +115 -0
  117. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappings.h +825 -0
  118. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewMappingsPrivate.h +72 -0
  119. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewOptions.h +56 -0
  120. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPage.h +36 -0
  121. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPageMetadata.h +27 -0
  122. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewPrivate.h +153 -0
  123. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptions.h +330 -0
  124. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +17 -0
  125. data/vendor/Pods/BuildHeaders/YapDatabase/YapDatabaseViewTransaction.h +447 -0
  126. data/vendor/Pods/BuildHeaders/YapDatabase/YapMemoryTable.h +74 -0
  127. data/vendor/Pods/BuildHeaders/YapDatabase/YapNull.h +17 -0
  128. data/vendor/Pods/BuildHeaders/YapDatabase/YapSet.h +41 -0
  129. data/vendor/Pods/BuildHeaders/YapDatabase/YapTouch.h +15 -0
  130. data/vendor/Pods/CocoaLumberjack/LICENSE.txt +18 -0
  131. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.h +41 -0
  132. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDASLLogger.m +99 -0
  133. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.h +102 -0
  134. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDAbstractDatabaseLogger.m +727 -0
  135. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.h +334 -0
  136. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDFileLogger.m +1353 -0
  137. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.h +601 -0
  138. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDLog.m +1083 -0
  139. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.h +167 -0
  140. data/vendor/Pods/CocoaLumberjack/Lumberjack/DDTTYLogger.m +1479 -0
  141. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.h +65 -0
  142. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/ContextFilterLogFormatter.m +191 -0
  143. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.h +116 -0
  144. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/DispatchQueueLogFormatter.m +251 -0
  145. data/vendor/Pods/CocoaLumberjack/Lumberjack/Extensions/README.txt +7 -0
  146. data/vendor/Pods/CocoaLumberjack/README.markdown +37 -0
  147. data/vendor/Pods/Headers/AFNetworking/AFHTTPClient.h +641 -0
  148. data/vendor/Pods/Headers/AFNetworking/AFHTTPRequestOperation.h +133 -0
  149. data/vendor/Pods/Headers/AFNetworking/AFImageRequestOperation.h +113 -0
  150. data/vendor/Pods/Headers/AFNetworking/AFJSONRequestOperation.h +71 -0
  151. data/vendor/Pods/Headers/AFNetworking/AFNetworkActivityIndicatorManager.h +75 -0
  152. data/vendor/Pods/Headers/AFNetworking/AFNetworking.h +43 -0
  153. data/vendor/Pods/Headers/AFNetworking/AFPropertyListRequestOperation.h +68 -0
  154. data/vendor/Pods/Headers/AFNetworking/AFURLConnectionOperation.h +370 -0
  155. data/vendor/Pods/Headers/AFNetworking/AFXMLRequestOperation.h +89 -0
  156. data/vendor/Pods/Headers/AFNetworking/UIImageView+AFNetworking.h +78 -0
  157. data/vendor/Pods/Headers/CocoaLumberjack/ContextFilterLogFormatter.h +65 -0
  158. data/vendor/Pods/Headers/CocoaLumberjack/DDASLLogger.h +41 -0
  159. data/vendor/Pods/Headers/CocoaLumberjack/DDAbstractDatabaseLogger.h +102 -0
  160. data/vendor/Pods/Headers/CocoaLumberjack/DDFileLogger.h +334 -0
  161. data/vendor/Pods/Headers/CocoaLumberjack/DDLog.h +601 -0
  162. data/vendor/Pods/Headers/CocoaLumberjack/DDTTYLogger.h +167 -0
  163. data/vendor/Pods/Headers/CocoaLumberjack/DispatchQueueLogFormatter.h +116 -0
  164. data/vendor/Pods/Headers/NSData+MD5Digest/NSData+MD5Digest.h +18 -0
  165. data/vendor/Pods/Headers/Reachability/Reachability.h +109 -0
  166. data/vendor/Pods/Headers/YapDatabase/YapCache.h +90 -0
  167. data/vendor/Pods/Headers/YapDatabase/YapCollectionKey.h +20 -0
  168. data/vendor/Pods/Headers/YapDatabase/YapDatabase.h +547 -0
  169. data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnection.h +447 -0
  170. data/vendor/Pods/Headers/YapDatabase/YapDatabaseConnectionState.h +29 -0
  171. data/vendor/Pods/Headers/YapDatabase/YapDatabaseDefaults.h +37 -0
  172. data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtension.h +15 -0
  173. data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionConnection.h +11 -0
  174. data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionPrivate.h +440 -0
  175. data/vendor/Pods/Headers/YapDatabase/YapDatabaseExtensionTransaction.h +11 -0
  176. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredView.h +108 -0
  177. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewConnection.h +12 -0
  178. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewPrivate.h +19 -0
  179. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFilteredViewTransaction.h +39 -0
  180. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearch.h +89 -0
  181. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchConnection.h +32 -0
  182. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchPrivate.h +69 -0
  183. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchSnippetOptions.h +79 -0
  184. data/vendor/Pods/Headers/YapDatabase/YapDatabaseFullTextSearchTransaction.h +68 -0
  185. data/vendor/Pods/Headers/YapDatabase/YapDatabaseLogging.h +158 -0
  186. data/vendor/Pods/Headers/YapDatabase/YapDatabaseManager.h +17 -0
  187. data/vendor/Pods/Headers/YapDatabase/YapDatabasePrivate.h +424 -0
  188. data/vendor/Pods/Headers/YapDatabase/YapDatabaseQuery.h +42 -0
  189. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndex.h +100 -0
  190. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexConnection.h +33 -0
  191. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexPrivate.h +73 -0
  192. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexSetup.h +33 -0
  193. data/vendor/Pods/Headers/YapDatabase/YapDatabaseSecondaryIndexTransaction.h +58 -0
  194. data/vendor/Pods/Headers/YapDatabase/YapDatabaseStatement.h +13 -0
  195. data/vendor/Pods/Headers/YapDatabase/YapDatabaseString.h +121 -0
  196. data/vendor/Pods/Headers/YapDatabase/YapDatabaseTransaction.h +541 -0
  197. data/vendor/Pods/Headers/YapDatabase/YapDatabaseView.h +186 -0
  198. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChange.h +272 -0
  199. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewChangePrivate.h +94 -0
  200. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewConnection.h +115 -0
  201. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappings.h +825 -0
  202. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewMappingsPrivate.h +72 -0
  203. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewOptions.h +56 -0
  204. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPage.h +36 -0
  205. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPageMetadata.h +27 -0
  206. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewPrivate.h +153 -0
  207. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptions.h +330 -0
  208. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewRangeOptionsPrivate.h +17 -0
  209. data/vendor/Pods/Headers/YapDatabase/YapDatabaseViewTransaction.h +447 -0
  210. data/vendor/Pods/Headers/YapDatabase/YapMemoryTable.h +74 -0
  211. data/vendor/Pods/Headers/YapDatabase/YapNull.h +17 -0
  212. data/vendor/Pods/Headers/YapDatabase/YapSet.h +41 -0
  213. data/vendor/Pods/Headers/YapDatabase/YapTouch.h +15 -0
  214. data/vendor/Pods/Headers/____Pods-AFNetworking-prefix.h +17 -0
  215. data/vendor/Pods/Headers/____Pods-CocoaLumberjack-prefix.h +5 -0
  216. data/vendor/Pods/Headers/____Pods-NSData+MD5Digest-prefix.h +5 -0
  217. data/vendor/Pods/Headers/____Pods-Reachability-prefix.h +5 -0
  218. data/vendor/Pods/Headers/____Pods-YapDatabase-prefix.h +5 -0
  219. data/vendor/Pods/Headers/____Pods-environment.h +38 -0
  220. data/vendor/Pods/Manifest.lock +24 -0
  221. data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.h +18 -0
  222. data/vendor/Pods/NSData+MD5Digest/NSData+MD5Digest/NSData+MD5Digest.m +39 -0
  223. data/vendor/Pods/NSData+MD5Digest/README.md +11 -0
  224. data/vendor/Pods/Pods-AFNetworking-Private.xcconfig +5 -0
  225. data/vendor/Pods/Pods-AFNetworking-dummy.m +5 -0
  226. data/vendor/Pods/Pods-AFNetworking-prefix.pch +17 -0
  227. data/vendor/Pods/Pods-AFNetworking.xcconfig +1 -0
  228. data/vendor/Pods/Pods-Acknowledgements.markdown +96 -0
  229. data/vendor/Pods/Pods-Acknowledgements.plist +142 -0
  230. data/vendor/Pods/Pods-CocoaLumberjack-Private.xcconfig +5 -0
  231. data/vendor/Pods/Pods-CocoaLumberjack-dummy.m +5 -0
  232. data/vendor/Pods/Pods-CocoaLumberjack-prefix.pch +5 -0
  233. data/vendor/Pods/Pods-CocoaLumberjack.xcconfig +0 -0
  234. data/vendor/Pods/Pods-NSData+MD5Digest-Private.xcconfig +5 -0
  235. data/vendor/Pods/Pods-NSData+MD5Digest-dummy.m +5 -0
  236. data/vendor/Pods/Pods-NSData+MD5Digest-prefix.pch +5 -0
  237. data/vendor/Pods/Pods-NSData+MD5Digest.xcconfig +0 -0
  238. data/vendor/Pods/Pods-Reachability-Private.xcconfig +5 -0
  239. data/vendor/Pods/Pods-Reachability-dummy.m +5 -0
  240. data/vendor/Pods/Pods-Reachability-prefix.pch +5 -0
  241. data/vendor/Pods/Pods-Reachability.xcconfig +1 -0
  242. data/vendor/Pods/Pods-YapDatabase-Private.xcconfig +5 -0
  243. data/vendor/Pods/Pods-YapDatabase-dummy.m +5 -0
  244. data/vendor/Pods/Pods-YapDatabase-prefix.pch +5 -0
  245. data/vendor/Pods/Pods-YapDatabase.xcconfig +1 -0
  246. data/vendor/Pods/Pods-dummy.m +5 -0
  247. data/vendor/Pods/Pods-environment.h +38 -0
  248. data/vendor/Pods/Pods-resources.sh +68 -0
  249. data/vendor/Pods/Pods.bridgesupport +5096 -0
  250. data/vendor/Pods/Pods.xcconfig +5 -0
  251. data/vendor/Pods/Pods.xcodeproj/project.pbxproj +5536 -0
  252. data/vendor/Pods/Reachability/LICENCE.txt +24 -0
  253. data/vendor/Pods/Reachability/README.md +65 -0
  254. data/vendor/Pods/Reachability/Reachability.h +109 -0
  255. data/vendor/Pods/Reachability/Reachability.m +527 -0
  256. data/vendor/Pods/YapDatabase/LICENSE.txt +18 -0
  257. data/vendor/Pods/YapDatabase/README.md +30 -0
  258. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/Internal/YapDatabaseFilteredViewPrivate.h +19 -0
  259. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.h +108 -0
  260. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredView.m +175 -0
  261. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.h +12 -0
  262. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewConnection.m +41 -0
  263. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.h +39 -0
  264. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FilteredViews/YapDatabaseFilteredViewTransaction.m +966 -0
  265. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/Internal/YapDatabaseFullTextSearchPrivate.h +69 -0
  266. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.h +89 -0
  267. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearch.m +146 -0
  268. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.h +32 -0
  269. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchConnection.m +298 -0
  270. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.h +79 -0
  271. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchSnippetOptions.m +95 -0
  272. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.h +68 -0
  273. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/FullTextSearch/YapDatabaseFullTextSearchTransaction.m +1352 -0
  274. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/Internal/YapDatabaseExtensionPrivate.h +440 -0
  275. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.h +15 -0
  276. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtension.m +58 -0
  277. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.h +11 -0
  278. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionConnection.m +46 -0
  279. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.h +11 -0
  280. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Protocol/YapDatabaseExtensionTransaction.m +180 -0
  281. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/Internal/YapDatabaseSecondaryIndexPrivate.h +73 -0
  282. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.h +100 -0
  283. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndex.m +149 -0
  284. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.h +33 -0
  285. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexConnection.m +330 -0
  286. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.h +33 -0
  287. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexSetup.m +184 -0
  288. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.h +58 -0
  289. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/SecondaryIndex/YapDatabaseSecondaryIndexTransaction.m +1166 -0
  290. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewChangePrivate.h +94 -0
  291. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewMappingsPrivate.h +72 -0
  292. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.h +36 -0
  293. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPage.mm +296 -0
  294. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.h +27 -0
  295. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPageMetadata.m +28 -0
  296. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewPrivate.h +153 -0
  297. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Internal/YapDatabaseViewRangeOptionsPrivate.h +17 -0
  298. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.h +272 -0
  299. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewChange.m +2494 -0
  300. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.h +825 -0
  301. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewMappings.m +1567 -0
  302. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.h +330 -0
  303. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/Utilities/YapDatabaseViewRangeOptions.m +141 -0
  304. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.h +186 -0
  305. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseView.m +191 -0
  306. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.h +115 -0
  307. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewConnection.m +897 -0
  308. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.h +56 -0
  309. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewOptions.m +27 -0
  310. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.h +447 -0
  311. data/vendor/Pods/YapDatabase/YapDatabase/Extensions/Views/YapDatabaseViewTransaction.m +4505 -0
  312. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.h +90 -0
  313. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapCache.m +453 -0
  314. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.h +29 -0
  315. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseConnectionState.m +48 -0
  316. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.h +37 -0
  317. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseDefaults.m +83 -0
  318. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.h +158 -0
  319. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseLogging.m +73 -0
  320. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.h +17 -0
  321. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseManager.m +56 -0
  322. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabasePrivate.h +424 -0
  323. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.h +13 -0
  324. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseStatement.m +26 -0
  325. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapDatabaseString.h +121 -0
  326. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.h +74 -0
  327. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapMemoryTable.m +603 -0
  328. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.h +17 -0
  329. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapNull.m +31 -0
  330. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.h +15 -0
  331. data/vendor/Pods/YapDatabase/YapDatabase/Internal/YapTouch.m +31 -0
  332. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.h +20 -0
  333. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapCollectionKey.m +194 -0
  334. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.h +42 -0
  335. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapDatabaseQuery.m +96 -0
  336. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.h +41 -0
  337. data/vendor/Pods/YapDatabase/YapDatabase/Utilities/YapSet.m +82 -0
  338. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.h +547 -0
  339. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabase.m +2022 -0
  340. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.h +447 -0
  341. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseConnection.m +3874 -0
  342. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.h +541 -0
  343. data/vendor/Pods/YapDatabase/YapDatabase/YapDatabaseTransaction.m +5282 -0
  344. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.bridgesupport +16 -0
  345. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.h +13 -0
  346. data/vendor/YapDatabaseRubyMotion/YapDatabaseRubyMotion.m +20 -0
  347. data/yapper.gemspec +24 -0
  348. metadata +458 -0
@@ -0,0 +1,72 @@
1
+ #import "YapDatabaseViewMappings.h"
2
+
3
+ /**
4
+ * This header file is PRIVATE, and is only to be used by the YapDatabaseView classes.
5
+ **/
6
+
7
+ @interface YapDatabaseViewMappings ()
8
+
9
+ /**
10
+ * For UNIT TESTING only.
11
+ **/
12
+ - (void)updateWithCounts:(NSDictionary *)counts;
13
+
14
+ /**
15
+ * Returns a mutable copy of the count dictionary, where:
16
+ * key = group
17
+ * value = NSNumber of count of items
18
+ **/
19
+ - (NSMutableDictionary *)counts;
20
+
21
+ /**
22
+ * fullCountForGroup => Count from view.group (excluding rangeOptions)
23
+ * visibleCountForGroup => Subset count (including rangeOptions)
24
+ **/
25
+ - (NSUInteger)fullCountForGroup:(NSString *)group;
26
+ - (NSUInteger)visibleCountForGroup:(NSString *)group;
27
+
28
+ /**
29
+ * Returns a copy of the rangeOptions dictionary, where:
30
+ * key = group
31
+ * value = YapDatabaseViewMappingsRangeOptions
32
+ **/
33
+ - (NSDictionary *)rangeOptions;
34
+
35
+ /**
36
+ * This method is used by YapDatabaseViewChange.
37
+ *
38
+ * After processing changeset(s), the length and/or offset may change.
39
+ * The new length and/or offsets are properly calculated,
40
+ * and then this method is used to avoid duplicating the calculations.
41
+ *
42
+ * Note: After invoking this method, be sure to invoke updateVisibility (after all groups have been updated).
43
+ **/
44
+ - (void)updateRangeOptionsForGroup:(NSString *)group
45
+ withNewLength:(NSUInteger)newLength
46
+ newOffset:(NSUInteger)newOffset;
47
+
48
+ /**
49
+ * Normally this method is called automatically.
50
+ * But needs to be called manually if you use updateRangeOptionsForGroup:withNewLength:newOffset:
51
+ **/
52
+ - (void)updateVisibility;
53
+
54
+ /**
55
+ * Returns a copy of the dependencies dictionary, where:
56
+ * key = group
57
+ * value = NSSet of cellDrawingDependency offsets
58
+ **/
59
+ - (NSDictionary *)dependencies;
60
+
61
+ /**
62
+ * Returns a copy of the reverse set, which contains groups that are to be reversed.
63
+ **/
64
+ - (NSSet *)reverse;
65
+
66
+ /**
67
+ * During processing we need to disable the the isUsingConsolidatedGroup flag
68
+ * in order to access the raw mappings.
69
+ **/
70
+ - (void)setAutoConsolidatingDisabled:(BOOL)disabled;
71
+
72
+ @end
@@ -0,0 +1,56 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ /**
4
+ * Welcome to YapDatabase!
5
+ *
6
+ * https://github.com/yaptv/YapDatabase
7
+ *
8
+ * The project wiki has a wealth of documentation if you have any questions.
9
+ * https://github.com/yaptv/YapDatabase/wiki
10
+ *
11
+ * YapDatabaseView is an extension designed to work with YapDatabase.
12
+ * It gives you a persistent sorted "view" of a configurable subset of your data.
13
+ *
14
+ * For the full documentation on Views, please see the related wiki article:
15
+ * https://github.com/yaptv/YapDatabase/wiki/Views
16
+ **/
17
+
18
+ @interface YapDatabaseViewOptions : NSObject <NSCopying>
19
+
20
+ /**
21
+ * A view can either be persistent (saved to sqlite), or non-persistent (kept in memory only).
22
+ *
23
+ * A persistent view saves its content to sqlite database tables.
24
+ * Thus a persistent view can be restored on subsequent app launches with re-population.
25
+ *
26
+ * A non-persistent view is stored in memory.
27
+ * From the outside, it works exactly like a persistent view in every way.
28
+ * You won't be able to tell the difference unless you look at the sqlite database.
29
+ *
30
+ * It's recommended that you use a persistent view for any views that your app needs on a regular basis.
31
+ * For example, if your app's main screen has a tableView powered by a view, that should likely be persistent.
32
+ *
33
+ * Non-persistent views are recommended for those situations where you need a view only temporarily.
34
+ * Or where the configuration of the view is highly dependent upon parameters that change regularly.
35
+ * In general, situations where it doesn't really make sense to persist the view.
36
+ *
37
+ * The default value is YES.
38
+ **/
39
+ @property (nonatomic, assign, readwrite) BOOL isPersistent;
40
+
41
+ /**
42
+ * You can configure the view to pre-filter all but a subset of collections.
43
+ *
44
+ * The primary motivation for this is to reduce the overhead when first populating the view.
45
+ * For example, if you're creating a view which only includes objects from a single collection,
46
+ * then you could specify that collection here. And when the view first populates itself,
47
+ * it will enumerate over just the allowedCollections, as opposed to enumerating over all collections.
48
+ *
49
+ * The groupingBlock will still be invoked, but only if the collection is contained in allowedCollections.
50
+ * If not, the view will not invoke the groupingBlock, and act as if the groupingBlock had returned nil.
51
+ *
52
+ * The default value is nil.
53
+ **/
54
+ @property (nonatomic, copy, readwrite) NSSet *allowedCollections;
55
+
56
+ @end
@@ -0,0 +1,36 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ @interface YapDatabaseViewPage : NSObject <NSCopying>
4
+
5
+ - (id)init;
6
+ - (id)initWithCapacity:(NSUInteger)capacity;
7
+
8
+ - (NSData *)serialize;
9
+ - (void)deserialize:(NSData *)data;
10
+
11
+ - (NSUInteger)count;
12
+
13
+ - (int64_t)rowidAtIndex:(NSUInteger)index;
14
+
15
+ - (void)addRowid:(int64_t)rowid;
16
+ - (void)insertRowid:(int64_t)rowid atIndex:(NSUInteger)index;
17
+
18
+ - (void)removeRowidAtIndex:(NSUInteger)index;
19
+
20
+ - (void)removeRange:(NSRange)range;
21
+
22
+ - (void)appendRange:(NSRange)range ofPage:(YapDatabaseViewPage *)page;
23
+ - (void)prependRange:(NSRange)range ofPage:(YapDatabaseViewPage *)page;
24
+
25
+ - (BOOL)getIndex:(NSUInteger *)indexPtr ofRowid:(int64_t)rowid;
26
+
27
+ - (void)enumerateRowidsUsingBlock:(void (^)(int64_t rowid, NSUInteger idx, BOOL *stop))block;
28
+
29
+ - (void)enumerateRowidsWithOptions:(NSEnumerationOptions)options
30
+ usingBlock:(void (^)(int64_t rowid, NSUInteger index, BOOL *stop))block;
31
+
32
+ - (void)enumerateRowidsWithOptions:(NSEnumerationOptions)options
33
+ range:(NSRange)range
34
+ usingBlock:(void (^)(int64_t rowid, NSUInteger index, BOOL *stop))block;
35
+
36
+ @end
@@ -0,0 +1,27 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ /**
4
+ * This class stores the metadata about each "page" in the view.
5
+ *
6
+ * That is, a "page" is a subset of the array of rowids in a group.
7
+ * The metadata does the following:
8
+ *
9
+ * - stores the associated group
10
+ * - keeps the pages ordered (via prevPageKey).
11
+ * - keeps the count on hand to make it easier to find a particular index
12
+ *
13
+ * This class is designed only to store the metadata in RAM.
14
+ * When the metadata is stored to disk, the individual ivars have an associated column.
15
+ **/
16
+ @interface YapDatabaseViewPageMetadata : NSObject <NSCopying> {
17
+ @public
18
+
19
+ NSString * pageKey;
20
+ NSString * prevPageKey;
21
+ NSString * group;
22
+ NSUInteger count;
23
+
24
+ BOOL isNew; // Is NOT copied. Relevant only to connection.
25
+ }
26
+
27
+ @end
@@ -0,0 +1,153 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ #import "YapDatabase.h"
4
+ #import "YapDatabaseConnection.h"
5
+ #import "YapDatabaseTransaction.h"
6
+
7
+ #import "YapDatabaseView.h"
8
+ #import "YapDatabaseViewOptions.h"
9
+ #import "YapDatabaseViewConnection.h"
10
+ #import "YapDatabaseViewTransaction.h"
11
+
12
+ #import "YapMemoryTable.h"
13
+
14
+ #import "sqlite3.h"
15
+
16
+ @class YapCache;
17
+ @class YapCollectionKey;
18
+
19
+ /**
20
+ * This version number is stored in the yap2 table.
21
+ * If there is a major re-write to this class, then the version number will be incremented,
22
+ * and the class can automatically rebuild the tables as needed.
23
+ **/
24
+ #define YAP_DATABASE_VIEW_CLASS_VERSION 3
25
+
26
+
27
+ @interface YapDatabaseView () {
28
+ @public
29
+ YapDatabaseViewGroupingBlock groupingBlock;
30
+ YapDatabaseViewSortingBlock sortingBlock;
31
+
32
+ YapDatabaseViewBlockType groupingBlockType;
33
+ YapDatabaseViewBlockType sortingBlockType;
34
+
35
+ int version;
36
+
37
+ YapDatabaseViewOptions *options;
38
+ }
39
+
40
+ - (NSString *)mapTableName;
41
+ - (NSString *)pageTableName;
42
+ - (NSString *)pageMetadataTableName;
43
+
44
+ @end
45
+
46
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
47
+ #pragma mark -
48
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
49
+
50
+ @interface YapDatabaseViewConnection () {
51
+ @public
52
+
53
+ __strong YapDatabaseView *view;
54
+ __unsafe_unretained YapDatabaseConnection *databaseConnection;
55
+
56
+ NSMutableDictionary *group_pagesMetadata_dict; // group -> @[ YapDatabaseViewPageMetadata, ... ]
57
+ NSMutableDictionary *pageKey_group_dict; // pageKey -> group
58
+
59
+ YapCache *mapCache;
60
+ YapCache *pageCache;
61
+
62
+ NSMutableDictionary *dirtyMaps;
63
+ NSMutableDictionary *dirtyPages;
64
+ NSMutableDictionary *dirtyLinks;
65
+ BOOL reset;
66
+
67
+ BOOL lastInsertWasAtFirstIndex;
68
+ BOOL lastInsertWasAtLastIndex;
69
+
70
+ NSMutableArray *changes;
71
+ NSMutableSet *mutatedGroups;
72
+ }
73
+
74
+ - (id)initWithView:(YapDatabaseView *)view databaseConnection:(YapDatabaseConnection *)dbc;
75
+
76
+ - (void)prepareForReadWriteTransaction;
77
+ - (void)postRollbackCleanup;
78
+ - (void)postCommitCleanup;
79
+
80
+ - (sqlite3_stmt *)mapTable_getPageKeyForRowidStatement;
81
+ - (sqlite3_stmt *)mapTable_setPageKeyForRowidStatement;
82
+ - (sqlite3_stmt *)mapTable_removeForRowidStatement;
83
+ - (sqlite3_stmt *)mapTable_removeAllStatement;
84
+
85
+ - (sqlite3_stmt *)pageTable_getDataForPageKeyStatement;
86
+ - (sqlite3_stmt *)pageTable_insertForPageKeyStatement;
87
+ - (sqlite3_stmt *)pageTable_updateAllForPageKeyStatement;
88
+ - (sqlite3_stmt *)pageTable_updatePageForPageKeyStatement;
89
+ - (sqlite3_stmt *)pageTable_updateLinkForPageKeyStatement;
90
+ - (sqlite3_stmt *)pageTable_removeForPageKeyStatement;
91
+ - (sqlite3_stmt *)pageTable_removeAllStatement;
92
+
93
+ @end
94
+
95
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
96
+ #pragma mark -
97
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
98
+
99
+ @interface YapDatabaseViewTransaction () {
100
+ @private
101
+
102
+ YapMemoryTableTransaction *mapTableTransaction;
103
+ YapMemoryTableTransaction *pageTableTransaction;
104
+ YapMemoryTableTransaction *pageMetadataTableTransaction;
105
+
106
+ @protected
107
+
108
+ __unsafe_unretained YapDatabaseViewConnection *viewConnection;
109
+ __unsafe_unretained YapDatabaseReadTransaction *databaseTransaction;
110
+
111
+ NSString *lastHandledGroup;
112
+ }
113
+
114
+ - (id)initWithViewConnection:(YapDatabaseViewConnection *)viewConnection
115
+ databaseTransaction:(YapDatabaseReadTransaction *)databaseTransaction;
116
+
117
+ // The following are declared for view subclasses (such as YapDatabaseFilteredView)
118
+
119
+ - (BOOL)createTables;
120
+
121
+ - (NSString *)registeredName;
122
+ - (BOOL)isPersistentView;
123
+
124
+ - (NSString *)pageKeyForRowid:(int64_t)rowid;
125
+ - (NSUInteger)indexForRowid:(int64_t)rowid inGroup:(NSString *)group withPageKey:(NSString *)pageKey;
126
+ - (BOOL)getRowid:(int64_t *)rowidPtr atIndex:(NSUInteger)index inGroup:(NSString *)group;
127
+
128
+ - (void)insertRowid:(int64_t)rowid collectionKey:(YapCollectionKey *)collectionKey inNewGroup:(NSString *)group;
129
+ - (void)insertRowid:(int64_t)rowid collectionKey:(YapCollectionKey *)collectionKey
130
+ inGroup:(NSString *)group
131
+ atIndex:(NSUInteger)index
132
+ withExistingPageKey:(NSString *)existingPageKey;
133
+
134
+ - (void)insertRowid:(int64_t)rowid
135
+ collectionKey:(YapCollectionKey *)collectionKey
136
+ object:(id)object
137
+ metadata:(id)metadata
138
+ inGroup:(NSString *)group
139
+ withChanges:(int)flags
140
+ isNew:(BOOL)isGuaranteedNew;
141
+
142
+ - (void)removeRowid:(int64_t)rowid
143
+ collectionKey:(YapCollectionKey *)collectionKey
144
+ atIndex:(NSUInteger)index
145
+ inGroup:(NSString *)group;
146
+
147
+ - (void)removeRowid:(int64_t)rowid collectionKey:(YapCollectionKey *)collectionKey;
148
+ - (void)removeAllRowids;
149
+
150
+ - (void)enumerateRowidsInGroup:(NSString *)group
151
+ usingBlock:(void (^)(int64_t rowid, NSUInteger index, BOOL *stop))block;
152
+
153
+ @end
@@ -0,0 +1,330 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+
4
+ /**
5
+ * Range offsets are specified from either the beginning or end.
6
+ *
7
+ * @see fixedRangeWithLength:offset:from:
8
+ * @see flexibleRangeWithStartingLength:startingOffset:from:
9
+ **/
10
+ typedef enum {
11
+ YapDatabaseViewBeginning = 0, // index == 0
12
+ YapDatabaseViewEnd = 1, // index == last
13
+
14
+ } YapDatabaseViewPin;
15
+
16
+ /**
17
+ * Grow options allow you to specify in which direction flexible ranges can grow.
18
+ *
19
+ * @see growOptions
20
+ **/
21
+ typedef enum {
22
+ YapDatabaseViewGrowPinSide = 1 << 0,
23
+ YapDatabaseViewGrowNonPinSide = 1 << 1,
24
+
25
+ YapDatabaseViewGrowInRangeOnly = 0,
26
+ YapDatabaseViewGrowOnBothSides = (YapDatabaseViewGrowPinSide | YapDatabaseViewGrowNonPinSide)
27
+
28
+ } YapDatabaseViewGrowOptions;
29
+
30
+ /**
31
+ * Range options allow you to specify a particular range of a group.
32
+ *
33
+ * For example, if a group contains thousands of items,
34
+ * but you only want to display the most recent 50 items in your tableView,
35
+ * then you can easily use range options to accomplish this.
36
+ *
37
+ * YapDatabaseViewRangeOptions are plugged into YapDatabaseViewMappings.
38
+ *
39
+ * @see YapDatabaseViewMappings setRangeOptions:forGroup:
40
+ **/
41
+ @interface YapDatabaseViewRangeOptions : NSObject <NSCopying>
42
+
43
+ /**
44
+ * There are 2 types of supported ranges: Fixed & Flexible
45
+ *
46
+ * A fixed range is similar to using a LIMIT & OFFSET in a SQL query.
47
+ * That is, it represents a designated range that doesn't change.
48
+ *
49
+ * You create a fixed range by specifying a desired length
50
+ * and an offset from either the beginning or end.
51
+ *
52
+ * @param length
53
+ * The desired length of the range.
54
+ * The length doesn't need to be valid at this point in time.
55
+ * For example, if the group only has 4 items, you can still specify a length of 20 if that is the desired length.
56
+ * The mappings will automatically use a length of 4 to start, and automatically expand up to 20.
57
+ *
58
+ * @param offset
59
+ * The offset from one either the beginning or end of the group.
60
+ *
61
+ * @param beginningOrEnd
62
+ * Either YapDatabaseViewBeginning or YapDatabaseViewEnd.
63
+ *
64
+ * Using YapDatabaseViewMappings along with a fixed range provides some unique features:
65
+ *
66
+ * - If you specify an offset from the end of the group (YapDatabaseViewEnd),
67
+ * you are essentially "pinning" the range to the end, and it will stay pinned that way regardless of
68
+ * inserted or deleted items elsewhere in the group.
69
+ *
70
+ * For example: If you pin the range to the end, with an offset of zero, and a length of 20,
71
+ * then the range will always specify the last 20 items in the group,
72
+ * even as the group length (as a whole) increases or decreases.
73
+ *
74
+ * - The changeset processing will automatically create the proper row changes to match what you want.
75
+ *
76
+ * For example: You have a fixed range with length 20, pinned to the beginning with an offset of 0,
77
+ * and a new item is inserted at index 0. The changeset processing will automatically give you a row
78
+ * insert at index 0, and a row delete at the end of your range to properly account for the row
79
+ * that got pushed outside your range.
80
+ *
81
+ * Thus you get row animations for free, even when only displaying a subset.
82
+ * And all the math is already done for you.
83
+ **/
84
+ + (YapDatabaseViewRangeOptions *)fixedRangeWithLength:(NSUInteger)length
85
+ offset:(NSUInteger)offset
86
+ from:(YapDatabaseViewPin)beginningOrEnd;
87
+
88
+ /**
89
+ * There are 2 types of supported ranges: Fixed & Flexible
90
+ *
91
+ * A flexible range is designed to grow and shrink.
92
+ * To explain this concept, consider Apple's SMS Messages app:
93
+ *
94
+ * When you go into a conversation (tap on a persons name),
95
+ * the messages app starts by displaying the most recent 50 messages (with the most recent at bottom).
96
+ * Although there might be thousands of old messages between you and the other person,
97
+ * only 50 are in the view to begin with.
98
+ * As you send and/or receive messages within the view, the length will grow.
99
+ * And similarly, if you manually delete messages, the length will shrink.
100
+ *
101
+ * Flexible ranges are designed to handle these types of user interfaces.
102
+ * They're also quite customizeable to handle a number of different situations.
103
+ *
104
+ * You create a flexible range by specifying an starting length
105
+ * and an offset from either the beginning or end.
106
+ *
107
+ * @param length
108
+ * The desired starting length of the range.
109
+ * The length doesn't need to be valid at this point in time.
110
+ * For example, if the group only has 4 items, you can still specify a length of 20.
111
+ * The mappings will automatically correct the length as appropriate.
112
+ *
113
+ * @param offset
114
+ * The offset from one either the beginning or end of the group.
115
+ *
116
+ * @param beginningOrEnd
117
+ * Either YapDatabaseViewBeginning or YapDatabaseViewEnd.
118
+ *
119
+ * Using YapDatabaseViewMappings along with a flexible range provides some unique features:
120
+ *
121
+ * - If you specify an offset from the end of the group (YapDatabaseViewEnd),
122
+ * you are essentially "pinning" the range to the end, and it will stay pinned that way regardless of
123
+ * inserted or deleted items elsewhere in the group.
124
+ *
125
+ * For example: If you pin the range to the end, with an offset of zero,
126
+ * then the range length will grow as items are added to the end.
127
+ *
128
+ * - The changeset processing will automatically create the proper row changes to match what you want.
129
+ *
130
+ * Thus you get row animations for free, even when only displaying a subset.
131
+ * And all the math is already done for you.
132
+ **/
133
+ + (YapDatabaseViewRangeOptions *)flexibleRangeWithLength:(NSUInteger)length
134
+ offset:(NSUInteger)offset
135
+ from:(YapDatabaseViewPin)beginningOrEnd;
136
+
137
+ /**
138
+ * The current length of the range.
139
+ *
140
+ * When rangeOptions get plugged into mappings, the length is automatically updated to reflect the available length.
141
+ *
142
+ * For a fixed range, the length will always be less than or equal to the original length.
143
+ * For a flexible range, the length will grow and shrink as items get inserted and removed from the original range.
144
+ **/
145
+ @property (nonatomic, assign, readonly) NSUInteger length;
146
+
147
+ /**
148
+ * The current offset of the range, relative to the pin (beginning or end of the group).
149
+ *
150
+ * For a fixed range, the offset never changes.
151
+ * For a flexible range, the offset will grow and shrink as items get inserted and removed between the range and pin.
152
+ **/
153
+ @property (nonatomic, assign, readonly) NSUInteger offset;
154
+
155
+ /**
156
+ * The pin value represents the end from which the offset is calculated.
157
+ * For example, assume a group contains 50 items and:
158
+ *
159
+ * - length=10, offset=10, pin=YapDatabaseViewBeginning => the range is [10-19](inclusive) (10 back from 0)
160
+ *
161
+ * - length=10, offset=10, pin=YapDatabaseViewEnd => the range is [30-39](inclusive) (10 back from 49)
162
+ **/
163
+ @property (nonatomic, assign, readonly) YapDatabaseViewPin pin;
164
+
165
+ /**
166
+ * There are 2 types of supported ranges: Fixed & Flexible
167
+ **/
168
+ @property (nonatomic, readonly) BOOL isFixedRange;
169
+ @property (nonatomic, readonly) BOOL isFlexibleRange;
170
+
171
+ /**
172
+ * For FIXED ranges:
173
+ * - the maxLength is readonly.
174
+ * - it will always equal the length originally specified.
175
+ *
176
+ * For FLEXIBLE ranges:
177
+ * - the maxLength allows you to specify a maximum length in which the range can grow.
178
+ *
179
+ * In particular, if the range overflows the maxLength, then the changeset processing will automatically
180
+ * trim items from the range (on the non-pin-side) to keep the range length within this maxLength.
181
+ *
182
+ * For example, imagine you're displaying log entries in a tableView.
183
+ * The range is pinned to the end, so as new log entries get appended to the database, they automatically get
184
+ * inserted into the tableView. This allows the tableView to grow as the log grows. However, you don't want the
185
+ * tableView growing too big, so you can set the maxLength in order to prevent this. That way, your tableView
186
+ * grows as the logs come in (as expected). But if your tableView starts to get too big,
187
+ * then the oldest log entries in the tableView start to fall off as new entries arrive.
188
+ * This is eqivalent to switching from a flexible range to a fixed range,
189
+ * but happens automatically without you having to write extra code to handle the edge case.
190
+ *
191
+ * By default there is no maxLength, and thus the default maxLength is NSUIntegerMax.
192
+ **/
193
+ @property (nonatomic, readwrite) NSUInteger maxLength;
194
+
195
+ /**
196
+ * For FIXED ranges:
197
+ * - the minLength is readonly.
198
+ * - it will always equal zero.
199
+ *
200
+ * For FLEXIBLE ranges:
201
+ * - the minLength allows you to specify a minimum length that the range should keep (if possible).
202
+ *
203
+ * In particular, if the range underflows the minLength, then the changeset processing will automatically
204
+ * adjust the offset or expand the range in order to keep entries in the view.
205
+ *
206
+ * This is sometimes useful if items can get deleted from your range.
207
+ *
208
+ * By default there is no minLength, and thus the default minLength is zero.
209
+ **/
210
+ @property (nonatomic, readwrite) NSUInteger minLength;
211
+
212
+ /**
213
+ * GrowOptions ONLY apply to FLEXIBLE ranges.
214
+ *
215
+ * The growOptions allow you to specify in which direction(s) the range may grow.
216
+ * Let's look at a few concrete examples.
217
+ *
218
+ * Example #1
219
+ *
220
+ * We're using a flexible range, with an offset of zero, pinned to the beginning.
221
+ * We're displaying news items, and the most recent items get inserted at index 0.
222
+ * The group currently contains thousands of items, and our range has a starting length of 50.
223
+ * If a new item gets inserted (at the beginning), we want it to get added to our range.
224
+ * So we would set our growOptions to be YapDatabaseViewGrowPinSide (this is the default value).
225
+ *
226
+ * Example #2
227
+ *
228
+ * We're using a flexible range, with an offset of zero, pinned to the end.
229
+ * We're displaying log entries, with the most recent items getting appended to the end.
230
+ * The group currently contains thousands of items, and our range has a starting length of 50.
231
+ * If a new log item gets inserted (at the end), we want it to get added to our range.
232
+ * So we would set our growOptions to be YapDatabaseViewGrowPinSide (this is the default value).
233
+ *
234
+ * Example #3
235
+ *
236
+ * We're making a UI that is somewhat akin to Facebook's news feed.
237
+ * That is, the most recent items come in at the top,
238
+ * but if you scroll to the bottom we automatically download older posts.
239
+ * However, we don't want to limit how far the user can scroll down.
240
+ * That is, if the user is bored, we're going to allow them to scroll down for
241
+ * however long we can fetch old items from the server.
242
+ * But obviously we can't allow the length of our tableView to grow infinitely long.
243
+ * So to accomplish this, we're going to use flexible ranges,
244
+ * and we're going to shift the length as the user scrolls down.
245
+ * To start with, we only have the 30 most recent posts in the database.
246
+ * And we set our flexible range as: length=30, offset=0, pin=YapDatabaseViewBeginning.
247
+ * Additionally we set our growOptions to: YapDatabaseViewGrowOnBothSides.
248
+ * Thus if we download new items, they'll get included in the range.
249
+ * And if we fetch older items, they'll also get included in the range.
250
+ * Now as the the user scrolls down, and we fetch more and more old items,
251
+ * we eventually get to the point were we shift the range.
252
+ * So when the range length gets to some max length that we want to support, we shift to a new flexible range:
253
+ * length=max, offset=0, pin=YapDatabaseViewEnd, growOptions=YapDatabaseViewGrowPinSide, maxLength=max
254
+ * This new range will keep the tableView length capped at max, and continually load older content as it gets fetched.
255
+ * To allow the user to scroll back up, we just increment the offset as the go.
256
+ * When they eventually get back up to the top, we reset the flexible range to its original value.
257
+ *
258
+ *
259
+ * To explain the different options, consider the following picture:
260
+ *
261
+ * - - - - -
262
+ * | |x|x|x| | <-- x marks the range
263
+ * - - - - -
264
+ * 0 1 2 3 4
265
+ *
266
+ * groupCount = 5
267
+ * flexibleRange: length=3, offset=1, pin=YapDatabaseViewBeginning, growOptions=YapDatabaseViewGrowPinSide
268
+ *
269
+ * Now an item gets inserted at index 1 as follows:
270
+ *
271
+ * - - - - - -
272
+ * | |?|x|x|x| | <-- is ? added to the flexible range?
273
+ * - - - - - -
274
+ * 0 1 2 3 4 5
275
+ *
276
+ * Does the item get added to the flexible range (with the given config options)?
277
+ * The answer is YES.
278
+ *
279
+ * - - - - - -
280
+ * | |x|x|x|x| | <-- YES (based on pin & growOptions)
281
+ * - - - - - -
282
+ * 0 1 2 3 4 5
283
+ *
284
+ * Because the flexible range is pinned to the beginning, and grows pin side.
285
+ * So if anything gets inserted between what was originally at index 0, and what was originally at index 1,
286
+ * then those items get added to the flexible range.
287
+ *
288
+ * Notice that after the insert, the offset remains set at 1.
289
+ * Notice that the answer would be NO if the flexible range was pinned to the end (with the same growOptions).
290
+ *
291
+ * Now let's see what happens if something gets inserted at the end:
292
+ *
293
+ * - - - - - - -
294
+ * | |x|x|x|x|?| | <-- is ? added to the flexible range?
295
+ * - - - - - - -
296
+ * 0 1 2 3 4 5 6
297
+ *
298
+ * Does the item get added to the flexible range (with the given config options)?
299
+ * The answer is NO.
300
+ *
301
+ * - - - - - - -
302
+ * | |x|x|x|x| | | <-- NO (based on pin & growOptions)
303
+ * - - - - - - -
304
+ * 0 1 2 3 4 5 6
305
+ *
306
+ * Because the flexible range is pinned to the beginning, and grows pin side.
307
+ *
308
+ * Notice that after the insert, the offset remains set at 1.
309
+ * Notice that the answer would be YES if the flexible range was pinned to the end (with the same growOptions).
310
+ *
311
+ * - - - - - - - - - - - - - - - -
312
+ * |?| |x|x|x|x| | | => NEVER => | | |x|x|x|x| | |
313
+ * - - - - - - - - - - - - - - - -
314
+ * 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
315
+ *
316
+ * - - - - - - - - - - - - - - - - - -
317
+ * | | |x|?|x|x|x| | | => ALWAYS => | | |x|x|x|x|x| | |
318
+ * - - - - - - - - - - - - - - - - - -
319
+ * 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8
320
+ **/
321
+ @property (nonatomic, readwrite) YapDatabaseViewGrowOptions growOptions;
322
+
323
+ /**
324
+ * Various copy options.
325
+ **/
326
+ - (id)copyWithNewLength:(NSUInteger)newLength;
327
+ - (id)copyWithNewOffset:(NSUInteger)newOffset;
328
+ - (id)copyWithNewLength:(NSUInteger)newLength newOffset:(NSUInteger)newOffset;
329
+
330
+ @end