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,440 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ #import "YapDatabaseExtension.h"
4
+ #import "YapDatabaseExtensionConnection.h"
5
+ #import "YapDatabaseExtensionTransaction.h"
6
+
7
+ #import "YapDatabase.h"
8
+ #import "YapDatabaseConnection.h"
9
+ #import "YapDatabaseTransaction.h"
10
+
11
+ #import "sqlite3.h"
12
+
13
+
14
+ @interface YapDatabaseExtension ()
15
+
16
+ /**
17
+ * Subclasses MUST implement this method.
18
+ *
19
+ * This method is used when unregistering an extension in order to drop the related tables.
20
+ **/
21
+ + (void)dropTablesForRegisteredName:(NSString *)registeredName
22
+ withTransaction:(YapDatabaseReadWriteTransaction *)transaction;
23
+
24
+ /**
25
+ * Subclasses may OPTIONALLY implement this method.
26
+ *
27
+ * If an extension class is renamed this method should be used to properly transition.
28
+ * The extension architecture will verify that a re-registered extension is using the same
29
+ * extension class that it was previously using. If the class names differ, then the extension architecture
30
+ * will automatically try to unregister the previous extension using the previous extension class.
31
+ *
32
+ * That is, it will attempt to invoke [PreviousExtensionClass dropTablesForRegisteredName: withTransaction:].
33
+ * Of course this won't work because the PreviousExtensionClass no longer exists.
34
+ * So the end result is that you will likely see the database spit out a warning like this:
35
+ *
36
+ * - Dropping tables for previously registered extension with name(order),
37
+ * class(YapDatabaseQuack) for new class(YapDatabaseDuck)
38
+ * - Unable to drop tables for previously registered extension with name(order),
39
+ * unknown class(YapDatabaseQuack)
40
+ *
41
+ * This method helps the extension architecture to understand what's happening, and it won't spit out any warnings.
42
+ *
43
+ * The default implementation returns nil.
44
+ **/
45
+ + (NSArray *)previousClassNames;
46
+
47
+ /**
48
+ * After an extension has been successfully registered with a database,
49
+ * the registeredName property will be set by the database.
50
+ *
51
+ * This property is set by YapDatabase after a successful registration.
52
+ * It should be considered read-only once set.
53
+ **/
54
+ @property (atomic, copy, readwrite) NSString *registeredName;
55
+
56
+ /**
57
+ * Subclasses MUST implement this method.
58
+ * This method is called during the view registration process to enusre the extension supports the database type.
59
+ * The registered extensions are passed too, in case dependencies need to be checked.
60
+ *
61
+ * Return YES if the class/instance supports the database configuration.
62
+ **/
63
+ - (BOOL)supportsDatabase:(YapDatabase *)database withRegisteredExtensions:(NSDictionary *)registeredExtensions;
64
+
65
+ /**
66
+ * Subclasses MUST implement this method IF they have dependencies.
67
+ * This method is called during the view registration simply to record the needed dependencies.
68
+ * If any of the dependencies are unregistered, this extension will automatically be unregistered.
69
+ *
70
+ * Return a set of NSString objects, representing the name(s) of registered extensions
71
+ * that this extension is dependent upon.
72
+ *
73
+ * If there are no dependencies, return nil (or an empty set).
74
+ * The default implementation returns nil.
75
+ **/
76
+ - (NSSet *)dependencies;
77
+
78
+ /**
79
+ * Subclasses MUST implement this method.
80
+ * Returns a proper instance of the YapDatabaseExtensionConnection subclass.
81
+ **/
82
+ - (YapDatabaseExtensionConnection *)newConnection:(YapDatabaseConnection *)databaseConnection;
83
+
84
+ @end
85
+
86
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
87
+ #pragma mark -
88
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
89
+
90
+ @interface YapDatabaseExtensionConnection () {
91
+
92
+ // You MUST store a strong reference to the parent.
93
+ // You MUST store an unretained reference to the corresponding database connection.
94
+ //
95
+ // The architecture of the database, throughout the database classes and extensions,
96
+ // is such that connections retain their parents, which are the base classes.
97
+ // This is needed so the base classes cannot disappear until their connections have all finished.
98
+ // Otherwise a connection might get orphaned, and a crash would ensue.
99
+ //
100
+ // Your custom extension implementation should be similar to the example below, but typed according to your needs.
101
+
102
+ /* Example from YapDatabaseViewConnection
103
+
104
+ @public
105
+ __strong YapDatabaseView *view;
106
+ __unsafe_unretained YapDatabaseConnection *databaseConnection;
107
+
108
+ */
109
+ }
110
+
111
+ /**
112
+ * Subclasses MUST implement this method.
113
+ * Returns a reference to the parent (base class).
114
+ *
115
+ * This method is used by various general utility classes in order to
116
+ * walk-the-chain: extension <-> extConnection <-> extTransaction.
117
+ *
118
+ * For example:
119
+ * Given an extTransaction, the utility method can walk up to the base extension class, and fetch the registeredName.
120
+ **/
121
+ - (YapDatabaseExtension *)extension;
122
+
123
+ /**
124
+ * Subclasses MUST implement these methods.
125
+ * They are to create and return a proper instance of the YapDatabaseExtensionTransaction subclass.
126
+ *
127
+ * They may optionally use different subclasses for read-only vs read-write transactions.
128
+ * Alternatively they can just store an ivar to determine the type of the transaction in order to protect as needed.
129
+ **/
130
+ - (id)newReadTransaction:(YapDatabaseReadTransaction *)databaseTransaction;
131
+ - (id)newReadWriteTransaction:(YapDatabaseReadWriteTransaction *)databaseTransaction;
132
+
133
+ /**
134
+ * Subclasses MUST implement this method.
135
+ *
136
+ * This method will be invoked in order to flush memory.
137
+ * Subclasses are encouraged to do something similar to the following:
138
+ *
139
+ * if (level >= YapDatabaseConnectionFlushMemoryLevelMild)
140
+ * {
141
+ * // Dump all caches
142
+ * }
143
+ *
144
+ * if (level >= YapDatabaseConnectionFlushMemoryLevelModerate)
145
+ * {
146
+ * // Release any prepared statements that aren't constantly used.
147
+ * //
148
+ * // For example, any statements that make modifications to the database,
149
+ * // and any other statements that are likely to be used infrequently.
150
+ *
151
+ * sqlite_finalize_null(&myStatement);
152
+ * }
153
+ *
154
+ * if (level >= YapDatabaseConnectionFlushMemoryLevelFull)
155
+ * {
156
+ * // Release all other prepared statements
157
+ *
158
+ * sqlite_finalize_null(&myOtherStatement);
159
+ *
160
+ * // And flush any state that may have been prepared via
161
+ * // the extTransaction's prepareIfNeeded method.
162
+ *
163
+ * viewGroups = nil;
164
+ * }
165
+ **/
166
+ - (void)_flushMemoryWithLevel:(int)level;
167
+
168
+ /**
169
+ * Subclasses MUST implement this method.
170
+ * This method is only called if within a readwrite transaction.
171
+ *
172
+ * This method is invoked in order to get the internal and external changesets.
173
+ * The internal changeset will be passed to sibling connections via processChangeset:.
174
+ * The external changeset will be embedded within YapDatabaseModifiedNotification.
175
+ *
176
+ * This is one of the primary methods within the architecture to keep multiple connections up-to-date
177
+ * as they move from one snapshot to the next. It is the responsibility of this method to provide
178
+ * all the information necessary for other connections to properly update their state,
179
+ * as well as provide the ability to extract information from YapDatabaseModifiedNotification's.
180
+ *
181
+ * The internal changeset will be passed directly to other connections.
182
+ * It should contain any information necessary to ensure that other connections can update their state
183
+ * to reflect the changes that were made during this transaction.
184
+ *
185
+ * The external changeset will be embedded within the YapDatabaseModifiedNotification.
186
+ * Thus, it can be used to provide support for things such as querying to see if something changed,
187
+ * or generating information necessary for UI update animations.
188
+ *
189
+ * If needed, "return" a internal changeset to be passed to other connections.
190
+ * If not needed, you can "return" a nil internal changeset.
191
+ *
192
+ * If needed, "return" an external changeset to be embedded within YapDatabaseModifiedNotification.
193
+ *
194
+ * If any changes to the database file were made made during this transaction,
195
+ * the hasDiskChangesPtr should be set to YES.
196
+ *
197
+ * For the most part, extensions update themselves in relation to changes within the main database table.
198
+ * However, sometimes extensions may update the database file independently. For example, the FullTextSearch extension
199
+ * has a method that optimizes the search tables by merging a bunch of different internal b-trees.
200
+ * If an extension makes changes to the database file outside the context of the normal changes to the main database
201
+ * table (such as the optimize command), then it MUST be sure to set the hasDiskChangesPtr to YES.
202
+ * This is because the internal architecture has optimizations if no disk changes occurred.
203
+ **/
204
+ - (void)getInternalChangeset:(NSMutableDictionary **)internalPtr
205
+ externalChangeset:(NSMutableDictionary **)externalPtr
206
+ hasDiskChanges:(BOOL *)hasDiskChangesPtr;
207
+
208
+ /**
209
+ * Subclasses MUST implement this method.
210
+ *
211
+ * This method processes an internal changeset from another connection.
212
+ * The internal changeset was generated from getInternalChangeset:externalChangeset:: on a sibling connection.
213
+ *
214
+ * This is one of the primary methods within the architecture to keep multiple connections up-to-date
215
+ * as they move from one snapshot to the next. It is the responsibility of this method to process
216
+ * the changeset to ensure the connection's state is properly updated.
217
+ **/
218
+ - (void)processChangeset:(NSDictionary *)changeset;
219
+
220
+ @end
221
+
222
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
223
+ #pragma mark -
224
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
225
+
226
+ /**
227
+ * An extension transaction is where a majority of the action happens.
228
+ * Subclasses will list the majority of their public API within the transaction.
229
+ *
230
+ * [databaseConnection readWithBlock:^(YapDatabaseReadTransaction *transaction){
231
+ *
232
+ * object = [[transaction ext:@"view"] objectAtIndex:index inGroup:@"sales"];
233
+ * // ^^^^^^^^^^^^^^^^^^^^^^^
234
+ * // ^ Returns a YapDatabaseExtensionTransaction subclass instance.
235
+ * }];
236
+ *
237
+ * An extension transaction has a reference to the database transction (and therefore to sqlite),
238
+ * as well as a reference to its parent extension connection. It is the same in architecture as
239
+ * database connections and transactions. That is, all access (read-only or read-write) goes
240
+ * through a transaction. Further, each connection only has a single transaction at a time.
241
+ * Thus transactions are optimized by storing a majority of their state within their respective connection.
242
+ *
243
+ * An extension transaction is created on-demand (or as needed) from within a database transaction.
244
+ *
245
+ * During a read-only transaction:
246
+ * - If the extension is not requested, then it is not created.
247
+ * - If the extension is requested, it is created once per transaction.
248
+ * - Additional requests for the same extension return the existing instance.
249
+ *
250
+ * During a read-write transaction:
251
+ * - If a modification to the database is initiated,
252
+ * every registered extension has an associated transaction created in order to handle the associated hook calls.
253
+ * - If the extension is requested, it is created once per transaction.
254
+ * - Additional requests for the same extension return the existing instance.
255
+ *
256
+ * The extension transaction is only valid from within the database transaction.
257
+ **/
258
+ @interface YapDatabaseExtensionTransaction () {
259
+
260
+ // You should store an unretained reference to the parent,
261
+ // and an unretained reference to the corresponding database transaction.
262
+ //
263
+ // Yours should be similar to the example below, but typed according to your needs.
264
+
265
+ /* Example from YapDatabaseViewTransaction
266
+
267
+ @private
268
+ __unsafe_unretained YapDatabaseViewConnection *viewConnection;
269
+ __unsafe_unretained YapDatabaseTransaction *databaseTransaction;
270
+
271
+ */
272
+ }
273
+
274
+ /**
275
+ * Subclasses MUST implement this method.
276
+ *
277
+ * This method is called during the registration process.
278
+ * Subclasses should perform any tasks needed in order to setup the extension for use by other connections.
279
+ *
280
+ * This includes creating any necessary tables,
281
+ * as well as possibly populating the tables by enumerating over the existing rows in the database.
282
+ *
283
+ * The method should check to see if it has already been created.
284
+ * That is, is this a re-registration from a subsequent app launch,
285
+ * or is this the first time the extension has been registered under this name?
286
+ *
287
+ * The recommended way of accomplishing this is via the yap2 table (which was designed for this purpose).
288
+ * There are various convenience methods that allow you store various settings about your extension in this table.
289
+ * See 'intValueForExtensionKey:' and other related methods.
290
+ *
291
+ * Note: This method is invoked on a special readWriteTransaction that is created internally
292
+ * within YapDatabase for the sole purpose of registering and unregistering extensions.
293
+ * So this method need not setup itself for regular use.
294
+ * It is designed only to do the prep work of creating the extension dependencies (such as tables)
295
+ * so that regular instances (possibly read-only) can operate normally.
296
+ *
297
+ * See YapDatabaseViewTransaction for a reference implementation.
298
+ *
299
+ * Return YES if completed successfully, or if already created.
300
+ * Return NO if some kind of error occured.
301
+ **/
302
+ - (BOOL)createIfNeeded;
303
+
304
+ /**
305
+ * Subclasses MUST implement this method.
306
+ *
307
+ * This method is invoked in order to prepare an extension transaction for use.
308
+ * Remember, transactions are short lived instances.
309
+ * So an extension transaction should store the vast majority of its state information within the extension connection.
310
+ * Thus an extension transaction instance should generally only need to prepare itself once. (*)
311
+ * It should store preparation info in the connection.
312
+ * And future invocations of this method will see that the connection has all the prepared state it needs,
313
+ * and then this method will return immediately.
314
+ *
315
+ * (*) an exception to this rule may occur if the user aborts a read-write transaction (via rollback),
316
+ * and the extension connection must dump all its prepared state.
317
+ *
318
+ * Changes that occur on other connections should get incorporated via the changeset architecture
319
+ * from within the extension connection subclass.
320
+ *
321
+ * This method may be invoked on a read-only OR read-write transaction.
322
+ *
323
+ * Return YES if completed successfully, or if already prepared.
324
+ * Return NO if some kind of error occured.
325
+ **/
326
+ - (BOOL)prepareIfNeeded;
327
+
328
+ /**
329
+ * Subclasses may OPTIONALLY implement this method.
330
+ * This method is only called if within a readwrite transaction.
331
+ *
332
+ * Subclasses may implement it to perform any "cleanup" before the changeset is requested.
333
+ * Remember, the changeset is requested before the commitTransaction method is invoked.
334
+ **/
335
+ - (void)preCommitReadWriteTransaction;
336
+
337
+ /**
338
+ * Subclasses MUST implement this method.
339
+ * This method is only called if within a readwrite transaction.
340
+ **/
341
+ - (void)commitTransaction;
342
+
343
+ /**
344
+ * Subclasses MUST implement this method.
345
+ * This method is only called if within a readwrite transaction.
346
+ **/
347
+ - (void)rollbackTransaction;
348
+
349
+ /**
350
+ * Subclasses MUST implement these methods.
351
+ * They are needed by various utility methods.
352
+ **/
353
+ - (YapDatabaseReadTransaction *)databaseTransaction;
354
+ - (YapDatabaseExtensionConnection *)extensionConnection;
355
+
356
+ /**
357
+ * The following method are implemented by YapDatabaseExtensionTransaction.
358
+ *
359
+ * They are convenience methods for getting and setting persistent configuration values for the extension.
360
+ * The persistent values are stored in the yap2 table, which is specifically designed for this use.
361
+ *
362
+ * The yap2 table is structured like this:
363
+ *
364
+ * CREATE TABLE IF NOT EXISTS "yap2" (
365
+ * "extension" CHAR NOT NULL,
366
+ * "key" CHAR NOT NULL,
367
+ * "data" BLOB,
368
+ * PRIMARY KEY ("extension", "key")
369
+ * );
370
+ *
371
+ * You pass the "key" and the "data" (which can be typed however you want it to be such as int, string, etc).
372
+ * The "extension" value is automatically set to the registeredName.
373
+ *
374
+ * Usage example:
375
+ *
376
+ * The View extension stores a "version" which is given to it during the init method by the user.
377
+ * If the "version" changes, this signifies that the user has changed something about the view,
378
+ * such as the sortingBlock or groupingBlock. The view then knows to flush its tables and re-populate them.
379
+ * It stores the "version" in the yap2 table via the methods below.
380
+ *
381
+ * When an extension is unregistered, either manually or automatically (if orphaned),
382
+ * then the database system automatically deletes all values from the yap2 table where extension == registeredName.
383
+ **/
384
+
385
+ - (BOOL)getBoolValue:(BOOL *)valuePtr forExtensionKey:(NSString *)key;
386
+ - (BOOL)boolValueForExtensionKey:(NSString *)key;
387
+ - (void)setBoolValue:(BOOL)value forExtensionKey:(NSString *)key;
388
+
389
+ - (BOOL)getIntValue:(int *)valuePtr forExtensionKey:(NSString *)key;
390
+ - (int)intValueForExtensionKey:(NSString *)key;
391
+ - (void)setIntValue:(int)value forExtensionKey:(NSString *)key;
392
+
393
+ - (BOOL)getDoubleValue:(double *)valuePtr forExtensionKey:(NSString *)key;
394
+ - (double)doubleValueForExtensionKey:(NSString *)key;
395
+ - (void)setDoubleValue:(double)value forExtensionKey:(NSString *)key;
396
+
397
+ - (NSString *)stringValueForExtensionKey:(NSString *)key;
398
+ - (void)setStringValue:(NSString *)value forExtensionKey:(NSString *)key;
399
+
400
+ - (NSData *)dataValueForExtensionKey:(NSString *)key;
401
+ - (void)setDataValue:(NSData *)value forExtensionKey:(NSString *)key;
402
+
403
+ @end
404
+
405
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
406
+ #pragma mark -
407
+ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
408
+
409
+ /**
410
+ * The YapDatabaseExtensionTransaction subclass MUST implement the methods in this protocol.
411
+ **/
412
+ @protocol YapDatabaseExtensionTransaction_Hooks
413
+ @required
414
+
415
+ - (void)handleInsertObject:(id)object
416
+ forKey:(NSString *)key
417
+ inCollection:(NSString *)collection
418
+ withMetadata:(id)metadata
419
+ rowid:(int64_t)rowid;
420
+
421
+ - (void)handleUpdateObject:(id)object
422
+ forKey:(NSString *)key
423
+ inCollection:(NSString *)collection
424
+ withMetadata:(id)metadata
425
+ rowid:(int64_t)rowid;
426
+
427
+ - (void)handleUpdateMetadata:(id)metadata
428
+ forKey:(NSString *)key
429
+ inCollection:(NSString *)collection
430
+ withRowid:(int64_t)rowid;
431
+
432
+ - (void)handleTouchObjectForKey:(NSString *)key inCollection:(NSString *)collection withRowid:(int64_t)rowid;
433
+ - (void)handleTouchMetadataForKey:(NSString *)key inCollection:(NSString *)collection withRowid:(int64_t)rowid;
434
+
435
+ - (void)handleRemoveObjectForKey:(NSString *)key inCollection:(NSString *)collection withRowid:(int64_t)rowid;
436
+ - (void)handleRemoveObjectsForKeys:(NSArray *)keys inCollection:(NSString *)collection withRowids:(NSArray *)rowids;
437
+
438
+ - (void)handleRemoveAllObjectsInAllCollections;
439
+
440
+ @end
@@ -0,0 +1,15 @@
1
+ #import <Foundation/Foundation.h>
2
+
3
+ #import "YapDatabaseExtensionConnection.h"
4
+ #import "YapDatabaseExtensionTransaction.h"
5
+
6
+
7
+ @interface YapDatabaseExtension : NSObject
8
+
9
+ /**
10
+ * After an extension has been successfully registered with a database,
11
+ * the registeredName property will be set by the database.
12
+ **/
13
+ @property (atomic, copy, readonly) NSString *registeredName;
14
+
15
+ @end