motion-yapper 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,447 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ @class YapDatabase;
4
+ @class YapDatabaseReadTransaction;
5
+ @class YapDatabaseReadWriteTransaction;
6
+
7
+ /**
8
+ * Welcome to YapDatabase!
9
+ *
10
+ * The project page has a wealth of documentation if you have any questions.
11
+ * https://github.com/yaptv/YapDatabase
12
+ *
13
+ * If you're new to the project you may want to visit the wiki.
14
+ * https://github.com/yaptv/YapDatabase/wiki
15
+ *
16
+ * From a single YapDatabase instance you can create multiple connections.
17
+ * Each connection is thread-safe and may be used concurrently with other connections.
18
+ *
19
+ * Multiple connections can simultaneously read from the database.
20
+ * Multiple connections can simultaneously read from the database while another connection is modifying the database.
21
+ * For example, the main thread could be reading from the database via connection A,
22
+ * while a background thread is writing to the database via connection B.
23
+ *
24
+ * However, only a single connection may be writing to the database at any one time.
25
+ * This is an inherent limitation of the underlying sqlite database.
26
+ *
27
+ * A connection instance is thread-safe, and operates by serializing access to itself.
28
+ * Thus you can share a single connection between multiple threads.
29
+ * But for conncurrent access between multiple threads you must use multiple connections.
30
+ **/
31
+
32
+ typedef enum {
33
+ YapDatabaseConnectionFlushMemoryLevelNone = 0,
34
+ YapDatabaseConnectionFlushMemoryLevelMild = 1,
35
+ YapDatabaseConnectionFlushMemoryLevelModerate = 2,
36
+ YapDatabaseConnectionFlushMemoryLevelFull = 3,
37
+ } YapDatabaseConnectionFlushMemoryLevel;
38
+
39
+ typedef enum {
40
+ YapDatabasePolicyContainment = 0,
41
+ YapDatabasePolicyShare = 1,
42
+ YapDatabasePolicyCopy = 2,
43
+ } YapDatabasePolicy;
44
+
45
+
46
+ @interface YapDatabaseConnection : NSObject
47
+
48
+ /**
49
+ * A database connection maintains a strong reference to its parent.
50
+ *
51
+ * This is to enforce the following core architecture rule:
52
+ * A database instance cannot be deallocated if a corresponding connection is stil alive.
53
+ **/
54
+ @property (nonatomic, strong, readonly) YapDatabase *database;
55
+
56
+ /**
57
+ * The optional name property assists in debugging.
58
+ * It is only used internally for log statements.
59
+ **/
60
+ @property (atomic, copy, readwrite) NSString *name;
61
+
62
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
63
+ #pragma mark Cache
64
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
65
+
66
+ /**
67
+ * Each database connection maintains an independent cache of deserialized objects.
68
+ * This reduces disk IO and the overhead of the deserialization process.
69
+ * You can optionally configure the cache size, or disable it completely.
70
+ *
71
+ * The cache is properly kept in sync with the atomic snapshot architecture of the database system.
72
+ *
73
+ * You can configure the objectCache at any time, including within readBlocks or readWriteBlocks.
74
+ * To disable the object cache entirely, set objectCacheEnabled to NO.
75
+ * To use an inifinite cache size, set the objectCacheLimit to zero.
76
+ *
77
+ * By default the objectCache is enabled and has a limit of 250.
78
+ *
79
+ * New connections will inherit the default values set by the parent database object.
80
+ * Thus the default values for new connection instances are configurable.
81
+ *
82
+ * @see YapDatabase defaultObjectCacheEnabled
83
+ * @see YapDatabase defaultObjectCacheLimit
84
+ *
85
+ * Also see the wiki for a bit more info:
86
+ * https://github.com/yaptv/YapDatabase/wiki/Cache
87
+ **/
88
+ @property (atomic, assign, readwrite) BOOL objectCacheEnabled;
89
+ @property (atomic, assign, readwrite) NSUInteger objectCacheLimit;
90
+
91
+ /**
92
+ * Each database connection maintains an independent cache of deserialized metadata.
93
+ * This reduces disk IO and the overhead of the deserialization process.
94
+ * You can optionally configure the cache size, or disable it completely.
95
+ *
96
+ * The cache is properly kept in sync with the atomic snapshot architecture of the database system.
97
+ *
98
+ * You can configure the metadataCache at any time, including within readBlocks or readWriteBlocks.
99
+ * To disable the metadata cache entirely, set metadataCacheEnabled to NO.
100
+ * To use an inifinite cache size, set the metadataCacheLimit to zero.
101
+ *
102
+ * By default the metadataCache is enabled and has a limit of 500.
103
+ *
104
+ * New connections will inherit the default values set by the parent database object.
105
+ * Thus the default values for new connection instances are configurable.
106
+ *
107
+ * @see YapDatabase defaultMetadataCacheEnabled
108
+ * @see YapDatabase defaultMetadataCacheLimit
109
+ *
110
+ * Also see the wiki for a bit more info:
111
+ * https://github.com/yaptv/YapDatabase/wiki/Cache
112
+ **/
113
+ @property (atomic, assign, readwrite) BOOL metadataCacheEnabled;
114
+ @property (atomic, assign, readwrite) NSUInteger metadataCacheLimit;
115
+
116
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
117
+ #pragma mark Policy
118
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
119
+
120
+ /**
121
+ * YapDatabase can use various optimizations to reduce overhead and memory footprint.
122
+ * The policy properties allow you to opt in to these optimizations when ready.
123
+ *
124
+ * The default value is YapDatabasePolicyContainment.
125
+ *
126
+ * It is the slowest, but also the safest policy.
127
+ * The other policies require a little more work, and little deeper understanding.
128
+ *
129
+ * These optimizations are discussed extensively in the wiki article "Performance Pro":
130
+ * https://github.com/yaptv/YapDatabase/wiki/Performance-Pro
131
+ **/
132
+ @property (atomic, assign, readwrite) YapDatabasePolicy objectPolicy;
133
+ @property (atomic, assign, readwrite) YapDatabasePolicy metadataPolicy;
134
+
135
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
136
+ #pragma mark State
137
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
138
+
139
+ /**
140
+ * The snapshot number is the internal synchronization state primitive for the connection.
141
+ * It's generally only useful for database internals,
142
+ * but it can sometimes come in handy for general debugging of your app.
143
+ *
144
+ * The snapshot is a simple 64-bit number that gets incremented upon every readwrite transaction
145
+ * that makes modifications to the database. Due to the concurrent architecture of YapDatabase,
146
+ * there may be multiple concurrent connections that are inspecting the database at similar times,
147
+ * yet they are looking at slightly different "snapshots" of the database.
148
+ *
149
+ * The snapshot number may thus be inspected to determine (in a general fashion) what state the connection
150
+ * is in compared with other connections.
151
+ *
152
+ * You may also query YapDatabase.snapshot to determine the most up-to-date snapshot among all connections.
153
+ *
154
+ * Example:
155
+ *
156
+ * YapDatabase *database = [[YapDatabase alloc] init...];
157
+ * database.snapshot; // returns zero
158
+ *
159
+ * YapDatabaseConnection *connection1 = [database newConnection];
160
+ * YapDatabaseConnection *connection2 = [database newConnection];
161
+ *
162
+ * connection1.snapshot; // returns zero
163
+ * connection2.snapshot; // returns zero
164
+ *
165
+ * [connection1 readWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction){
166
+ * [transaction setObject:objectA forKey:keyA];
167
+ * }];
168
+ *
169
+ * database.snapshot; // returns 1
170
+ * connection1.snapshot; // returns 1
171
+ * connection2.snapshot; // returns 1
172
+ *
173
+ * [connection1 asyncReadWriteWithBlock:^(YapDatabaseReadWriteTransaction *transaction){
174
+ * [transaction setObject:objectB forKey:keyB];
175
+ * [NSThread sleepForTimeInterval:1.0]; // sleep for 1 second
176
+ *
177
+ * connection1.snapshot; // returns 1 (we know it will turn into 2 once the transaction completes)
178
+ * } completion:^{
179
+ *
180
+ * connection1.snapshot; // returns 2
181
+ * }];
182
+ *
183
+ * [connection2 asyncReadWithBlock:^(YapDatabaseReadTransaction *transaction){
184
+ * [NSThread sleepForTimeInterval:5.0]; // sleep for 5 seconds
185
+ *
186
+ * connection2.snapshot; // returns 1. See why?
187
+ * }];
188
+ *
189
+ * It's because connection2 started its transaction when the database was in snapshot 1.
190
+ * Thus, for the duration of its transaction, the database remains in that state.
191
+ *
192
+ * However, once connection2 completes its transaction, it will automatically update itself to snapshot 2.
193
+ *
194
+ * In general, the snapshot is primarily for internal use.
195
+ * However, it may come in handy for some tricky edge-case bugs (why doesn't my connection see that other commit?)
196
+ **/
197
+ @property (atomic, assign, readonly) uint64_t snapshot;
198
+
199
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
200
+ #pragma mark Transactions
201
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
202
+
203
+ /**
204
+ * Read-only access to the database.
205
+ *
206
+ * The given block can run concurrently with sibling connections,
207
+ * regardless of whether the sibling connections are executing read-only or read-write transactions.
208
+ *
209
+ * The only time this method ever blocks is if another thread is currently using this connection instance
210
+ * to execute a readBlock or readWriteBlock. Recall that you may create multiple connections for concurrent access.
211
+ *
212
+ * This method is synchronous.
213
+ **/
214
+ - (void)readWithBlock:(void (^)(YapDatabaseReadTransaction *transaction))block;
215
+
216
+ /**
217
+ * Read-write access to the database.
218
+ *
219
+ * Only a single read-write block can execute among all sibling connections.
220
+ * Thus this method may block if another sibling connection is currently executing a read-write block.
221
+ **/
222
+ - (void)readWriteWithBlock:(void (^)(YapDatabaseReadWriteTransaction *transaction))block;
223
+
224
+ /**
225
+ * Read-only access to the database.
226
+ *
227
+ * The given block can run concurrently with sibling connections,
228
+ * regardless of whether the sibling connections are executing read-only or read-write transactions.
229
+ *
230
+ * This method is asynchronous.
231
+ **/
232
+ - (void)asyncReadWithBlock:(void (^)(YapDatabaseReadTransaction *transaction))block;
233
+
234
+ /**
235
+ * Read-only access to the database.
236
+ *
237
+ * The given block can run concurrently with sibling connections,
238
+ * regardless of whether the sibling connections are executing read-only or read-write transactions.
239
+ *
240
+ * This method is asynchronous.
241
+ *
242
+ * An optional completion block may be used.
243
+ * The completionBlock will be invoked on the main thread (dispatch_get_main_queue()).
244
+ **/
245
+ - (void)asyncReadWithBlock:(void (^)(YapDatabaseReadTransaction *transaction))block
246
+ completionBlock:(dispatch_block_t)completionBlock;
247
+
248
+ /**
249
+ * Read-only access to the database.
250
+ *
251
+ * The given block can run concurrently with sibling connections,
252
+ * regardless of whether the sibling connections are executing read-only or read-write transactions.
253
+ *
254
+ * This method is asynchronous.
255
+ *
256
+ * An optional completion block may be used.
257
+ * Additionally the dispatch_queue to invoke the completion block may also be specified.
258
+ * If NULL, dispatch_get_main_queue() is automatically used.
259
+ **/
260
+ - (void)asyncReadWithBlock:(void (^)(YapDatabaseReadTransaction *transaction))block
261
+ completionBlock:(dispatch_block_t)completionBlock
262
+ completionQueue:(dispatch_queue_t)completionQueue;
263
+
264
+ /**
265
+ * Read-write access to the database.
266
+ *
267
+ * Only a single read-write block can execute among all sibling connections.
268
+ * Thus this method may block if another sibling connection is currently executing a read-write block.
269
+ *
270
+ * This method is asynchronous.
271
+ **/
272
+ - (void)asyncReadWriteWithBlock:(void (^)(YapDatabaseReadWriteTransaction *transaction))block;
273
+
274
+ /**
275
+ * Read-write access to the database.
276
+ *
277
+ * Only a single read-write block can execute among all sibling connections.
278
+ * Thus the execution of the block may be delayed if another sibling connection
279
+ * is currently executing a read-write block.
280
+ *
281
+ * This method is asynchronous.
282
+ *
283
+ * An optional completion block may be used.
284
+ * The completionBlock will be invoked on the main thread (dispatch_get_main_queue()).
285
+ **/
286
+ - (void)asyncReadWriteWithBlock:(void (^)(YapDatabaseReadWriteTransaction *transaction))block
287
+ completionBlock:(dispatch_block_t)completionBlock;
288
+
289
+ /**
290
+ * Read-write access to the database.
291
+ *
292
+ * Only a single read-write block can execute among all sibling connections.
293
+ * Thus the execution of the block may be delayed if another sibling connection
294
+ * is currently executing a read-write block.
295
+ *
296
+ * This method is asynchronous.
297
+ *
298
+ * An optional completion block may be used.
299
+ * Additionally the dispatch_queue to invoke the completion block may also be specified.
300
+ * If NULL, dispatch_get_main_queue() is automatically used.
301
+ **/
302
+ - (void)asyncReadWriteWithBlock:(void (^)(YapDatabaseReadWriteTransaction *transaction))block
303
+ completionBlock:(dispatch_block_t)completionBlock
304
+ completionQueue:(dispatch_queue_t)completionQueue;
305
+
306
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
307
+ #pragma mark Long-Lived Transactions
308
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
309
+
310
+ /**
311
+ * Invoke this method to start a long-lived read-only transaction.
312
+ * This allows you to effectively create a stable state for the connection.
313
+ * This is most often used for connections that service the main thread for UI data.
314
+ *
315
+ * For a complete discussion, please see the wiki page:
316
+ * https://github.com/yaptv/YapDatabase/wiki/LongLivedReadTransactions
317
+ **/
318
+ - (NSArray *)beginLongLivedReadTransaction;
319
+ - (NSArray *)endLongLivedReadTransaction;
320
+
321
+ - (BOOL)isInLongLivedReadTransaction;
322
+
323
+ /**
324
+ * A long-lived read-only transaction is most often setup on a connection that is designed to be read-only.
325
+ * But sometimes we forget, and a read-write transaction gets added that uses the read-only connection.
326
+ * This will implicitly end the long-lived read-only transaction. Oops.
327
+ *
328
+ * This is a bug waiting to happen.
329
+ * And when it does happen, it will be one of those bugs that's nearly impossible to reproduce.
330
+ * So its better to have an early warning system to help you fix the bug before it occurs.
331
+ *
332
+ * For a complete discussion, please see the wiki page:
333
+ * https://github.com/yaptv/YapDatabase/wiki/LongLivedReadTransactions
334
+ *
335
+ * In debug mode (#if DEBUG), these exceptions are turned ON by default.
336
+ * In non-debug mode (#if !DEBUG), these exceptions are turned OFF by default.
337
+ **/
338
+ - (void)enableExceptionsForImplicitlyEndingLongLivedReadTransaction;
339
+ - (void)disableExceptionsForImplicitlyEndingLongLivedReadTransaction;
340
+
341
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
342
+ #pragma mark Changesets
343
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
344
+
345
+ /**
346
+ * A YapDatabaseModifiedNotification is posted for every readwrite transaction that makes changes to the database.
347
+ *
348
+ * Given one or more notifications, these methods allow you to easily
349
+ * query to see if a change affects a given collection, key, or combinary.
350
+ *
351
+ * This is most often used in conjunction with longLivedReadTransactions.
352
+ *
353
+ * For more information on longLivedReadTransaction, see the following wiki article:
354
+ * https://github.com/yaptv/YapDatabase/wiki/LongLivedReadTransactions
355
+ **/
356
+
357
+ // Query for any change to a collection
358
+
359
+ - (BOOL)hasChangeForCollection:(NSString *)collection inNotifications:(NSArray *)notifications;
360
+ - (BOOL)hasObjectChangeForCollection:(NSString *)collection inNotifications:(NSArray *)notifications;
361
+ - (BOOL)hasMetadataChangeForCollection:(NSString *)collection inNotifications:(NSArray *)notifications;
362
+
363
+ // Query for a change to a particular key/collection tuple
364
+
365
+ - (BOOL)hasChangeForKey:(NSString *)key
366
+ inCollection:(NSString *)collection
367
+ inNotifications:(NSArray *)notifications;
368
+
369
+ - (BOOL)hasObjectChangeForKey:(NSString *)key
370
+ inCollection:(NSString *)collection
371
+ inNotifications:(NSArray *)notifications;
372
+
373
+ - (BOOL)hasMetadataChangeForKey:(NSString *)key
374
+ inCollection:(NSString *)collection
375
+ inNotifications:(NSArray *)notifications;
376
+
377
+ // Query for a change to a particular set of keys in a collection
378
+
379
+ - (BOOL)hasChangeForAnyKeys:(NSSet *)keys
380
+ inCollection:(NSString *)collection
381
+ inNotifications:(NSArray *)notifications;
382
+
383
+ - (BOOL)hasObjectChangeForAnyKeys:(NSSet *)keys
384
+ inCollection:(NSString *)collection
385
+ inNotifications:(NSArray *)notifications;
386
+
387
+ - (BOOL)hasMetadataChangeForAnyKeys:(NSSet *)keys
388
+ inCollection:(NSString *)collection
389
+ inNotifications:(NSArray *)notifications;
390
+
391
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
392
+ #pragma mark Extensions
393
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
394
+
395
+ /**
396
+ * Creates or fetches the extension with the given name.
397
+ * If this connection has not yet initialized the proper extension connection, it is done automatically.
398
+ *
399
+ * @return
400
+ * A subclass of YapDatabaseExtensionConnection,
401
+ * according to the type of extension registered under the given name.
402
+ *
403
+ * One must register an extension with the database before it can be accessed from within connections or transactions.
404
+ * After registration everything works automatically using just the registered extension name.
405
+ *
406
+ * @see YapDatabase registerExtension:withName:
407
+ **/
408
+ - (id)extension:(NSString *)extensionName;
409
+ - (id)ext:(NSString *)extensionName; // <-- Shorthand (same as extension: method)
410
+
411
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
412
+ #pragma mark Memory
413
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
414
+
415
+ /**
416
+ * This method may be used to flush the internal caches used by the connection,
417
+ * as well as flushing pre-compiled sqlite statements.
418
+ * Depending upon how often you use the database connection,
419
+ * you may want to be more or less aggressive on how much stuff you flush.
420
+ *
421
+ * YapDatabaseConnectionFlushMemoryLevelNone (0):
422
+ * No-op. Doesn't flush any caches or anything from internal memory.
423
+ *
424
+ * YapDatabaseConnectionFlushMemoryLevelMild (1):
425
+ * Flushes the object cache and metadata cache.
426
+ *
427
+ * YapDatabaseConnectionFlushMemoryLevelModerate (2):
428
+ * Mild plus drops less common pre-compiled sqlite statements.
429
+ *
430
+ * YapDatabaseConnectionFlushMemoryLevelFull (3):
431
+ * Full flush of all caches and removes all pre-compiled sqlite statements.
432
+ **/
433
+ - (void)flushMemoryWithLevel:(int)level;
434
+
435
+ #if TARGET_OS_IPHONE
436
+ /**
437
+ * When a UIApplicationDidReceiveMemoryWarningNotification is received,
438
+ * the code automatically invokes flushMemoryWithLevel and passes this set level.
439
+ *
440
+ * The default value is YapDatabaseConnectionFlushMemoryLevelMild.
441
+ *
442
+ * @see flushMemoryWithLevel:
443
+ **/
444
+ @property (atomic, assign, readwrite) int autoFlushMemoryLevel;
445
+ #endif
446
+
447
+ @end
@@ -0,0 +1,29 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import "YapDatabaseConnection.h"
3
+
4
+
5
+ @interface YapDatabaseConnectionState : NSObject {
6
+ @private
7
+ dispatch_semaphore_t writeSemaphore;
8
+
9
+ @public
10
+ __weak YapDatabaseConnection *connection;
11
+
12
+ BOOL yapLevelSharedReadLock;
13
+ BOOL sqlLevelSharedReadLock;
14
+ BOOL longLivedReadTransaction;
15
+
16
+ BOOL yapLevelExclusiveWriteLock;
17
+ BOOL waitingForWriteLock;
18
+
19
+ uint64_t lastKnownSnapshot;
20
+ }
21
+
22
+ - (id)initWithConnection:(YapDatabaseConnection *)connection;
23
+
24
+ - (void)prepareWriteLock;
25
+
26
+ - (void)waitForWriteLock;
27
+ - (void)signalWriteLock;
28
+
29
+ @end