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