rhoconnect 3.4.5 → 4.0.0.beta.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (337) hide show
  1. data/CHANGELOG.md +57 -3
  2. data/Gemfile +9 -7
  3. data/Gemfile.lock +37 -37
  4. data/Rakefile +18 -7
  5. data/bench/benchapp/Gemfile +1 -1
  6. data/bench/benchapp/config.ru +0 -3
  7. data/bench/benchapp/controllers/ruby/application.rb +17 -0
  8. data/bench/benchapp/controllers/ruby/application_controller.rb +17 -0
  9. data/bench/benchapp/controllers/ruby/mock_adapter_controller.rb +8 -0
  10. data/bench/benchapp/controllers/ruby/queue_mock_adapter_controller.rb +8 -0
  11. data/bench/benchapp/{sources → models/ruby}/mock_adapter.rb +1 -1
  12. data/bench/benchapp/{sources → models/ruby}/queue_mock_adapter.rb +0 -0
  13. data/bench/benchapp/spec/{sources → models/ruby}/mock_adapter_spec.rb +1 -1
  14. data/bench/benchapp/spec/{sources → models/ruby}/queue_mock_adapter_spec.rb +1 -1
  15. data/bench/benchapp/spec/spec_helper.rb +2 -2
  16. data/bench/blobapp/Gemfile +1 -1
  17. data/bench/blobapp/config.ru +0 -3
  18. data/bench/blobapp/controllers/ruby/application_controller.rb +17 -0
  19. data/bench/blobapp/controllers/ruby/blob_adapter_controller.rb +8 -0
  20. data/bench/blobapp/{sources → models/ruby}/blob_adapter.rb +9 -2
  21. data/bench/blobapp/spec/{sources → models/ruby}/blob_adapter_spec.rb +1 -1
  22. data/bench/blobapp/spec/spec_helper.rb +1 -1
  23. data/bench/lib/bench/cli.rb +1 -1
  24. data/bench/scripts/blob_cud_script.rb +1 -1
  25. data/bench/scripts/query_md_script.rb +1 -1
  26. data/bench/scripts/query_only_script.rb +1 -1
  27. data/bench/scripts/query_script.rb +1 -1
  28. data/bench/scripts/test_query_script.rb +7 -1
  29. data/bench/spec/mock_adapter_spec.rb +1 -1
  30. data/bench/spec/result_spec.rb +3 -3
  31. data/bin/rhoconnect +5 -3
  32. data/commands/dtach/dtach_install.rb +2 -2
  33. data/commands/execute.rb +8 -3
  34. data/commands/generators/app.rb +3 -3
  35. data/commands/generators/controller.rb +6 -0
  36. data/commands/generators/model.rb +6 -0
  37. data/commands/generators/source.rb +3 -3
  38. data/commands/generators/update.rb +1 -1
  39. data/commands/redis/redis_about.rb +2 -2
  40. data/commands/redis/redis_download.rb +1 -1
  41. data/commands/redis/redis_install.rb +4 -3
  42. data/commands/redis/redis_restart.rb +4 -4
  43. data/commands/redis/redis_start.rb +5 -4
  44. data/commands/redis/redis_startbg.rb +5 -4
  45. data/commands/redis/redis_status.rb +13 -0
  46. data/commands/redis/redis_stop.rb +3 -3
  47. data/commands/rhoconnect/config.rb +28 -16
  48. data/commands/rhoconnect/flushdb.rb +1 -2
  49. data/commands/rhoconnect/get_token.rb +15 -11
  50. data/commands/rhoconnect/restart.rb +13 -5
  51. data/commands/rhoconnect/set_admin_password.rb +8 -8
  52. data/commands/rhoconnect/start.rb +74 -16
  53. data/commands/rhoconnect/startbg.rb +1 -1
  54. data/commands/rhoconnect/startdebug.rb +1 -1
  55. data/commands/rhoconnect/stop.rb +13 -1
  56. data/commands/rhoconnect/web.rb +5 -5
  57. data/commands/rhoconnect_console/console.rb +7 -5
  58. data/commands/{rhoconnect → rhoconnect_spec}/spec.rb +0 -0
  59. data/commands/rhoconnect_war/war.rb +9 -9
  60. data/commands/utilities/blank_app.ru +56 -0
  61. data/commands/utilities/redis_runner.rb +54 -19
  62. data/doc/authentication.txt +80 -6
  63. data/doc/blob-sync.txt +104 -97
  64. data/doc/bulk-sync.txt +1 -1
  65. data/doc/client-java.txt +3 -3
  66. data/doc/client-objc.txt +2 -2
  67. data/doc/client.txt +4 -4
  68. data/doc/command-line.txt +105 -200
  69. data/doc/data-partitioning.txt +40 -0
  70. data/doc/deploying.txt +249 -77
  71. data/doc/extending-rhoconnect-server.txt +40 -57
  72. data/doc/heroku-addon.txt +2 -0
  73. data/doc/install.txt +45 -95
  74. data/doc/introduction.txt +1 -1
  75. data/doc/java-plugin.txt +365 -190
  76. data/doc/metadata.txt +1 -1
  77. data/doc/migration.txt +108 -142
  78. data/doc/preparing-production.txt +1 -1
  79. data/doc/push-backend-setup.txt +2 -0
  80. data/doc/push-client-setup-android.txt +78 -0
  81. data/doc/push-client-setup-bb.txt +81 -0
  82. data/doc/push-client-setup-ios.txt +70 -0
  83. data/doc/push-client-setup-rps.txt +200 -0
  84. data/doc/push-client-setup.txt +63 -66
  85. data/doc/push-server-setup.txt +67 -40
  86. data/doc/push-testing.txt +29 -0
  87. data/doc/push.txt +21 -6
  88. data/doc/rest-api.txt +128 -55
  89. data/doc/rhoconnect-redis-stack.txt +120 -0
  90. data/doc/settings.txt +4 -12
  91. data/doc/source-adapters-intro.txt +28 -0
  92. data/doc/source-adapters.txt +235 -272
  93. data/doc/stats-middleware.txt +9 -29
  94. data/doc/supported-platforms.txt +21 -30
  95. data/doc/testing.txt +40 -42
  96. data/doc/tutorial.txt +72 -57
  97. data/examples/simple/Gemfile +1 -1
  98. data/examples/simple/application.rb +4 -5
  99. data/examples/simple/my_server.rb +2 -2
  100. data/examples/simple/settings/settings.yml +1 -1
  101. data/generators/rhoconnect.rb +151 -50
  102. data/generators/templates/application/Gemfile +1 -1
  103. data/generators/templates/application/Rakefile +3 -3
  104. data/generators/templates/application/config.ru +1 -4
  105. data/generators/templates/application/controllers/application_controller.rb +17 -0
  106. data/generators/templates/application/controllers/js/application_controller.js +14 -0
  107. data/generators/templates/application/controllers/ruby/application_controller.rb +17 -0
  108. data/generators/templates/application/package.json +8 -0
  109. data/generators/templates/application/rcgemfile +2 -5
  110. data/generators/templates/application/settings/settings.yml +3 -3
  111. data/generators/templates/application/spec/application_controller_spec.rb +23 -0
  112. data/generators/templates/application/spec/js_spec.rb +25 -0
  113. data/generators/templates/application/spec/spec_helper.rb +21 -7
  114. data/generators/templates/source/controllers/js/controller.js +7 -0
  115. data/generators/templates/source/controllers/ruby/controller.rb +8 -0
  116. data/generators/templates/source/controllers/ruby/controller_spec.rb +27 -0
  117. data/generators/templates/source/models/js/model.js +46 -0
  118. data/generators/templates/source/{source_adapter.rb → models/ruby/model.rb} +15 -10
  119. data/generators/templates/source/{source_spec.rb → models/ruby/model_spec.rb} +1 -1
  120. data/install.sh +5 -5
  121. data/installer/unix-like/create_texts.rb +2 -2
  122. data/installer/unix-like/rho_connect_install_constants.rb +2 -2
  123. data/installer/unix-like/rho_connect_install_utilities.rb +1 -1
  124. data/installer/utils/constants.rb +4 -4
  125. data/js-adapters/ballroom.js +216 -0
  126. data/js-adapters/node.rb +52 -0
  127. data/js-adapters/node_channel.rb +181 -0
  128. data/js-adapters/request.js +27 -0
  129. data/js-adapters/response.js +57 -0
  130. data/js-adapters/rhoconnect_helpers.js +60 -0
  131. data/js-adapters/router.js +60 -0
  132. data/js-adapters/server.js +5 -0
  133. data/lib/rhoconnect/api/app/ans_login.rb +3 -3
  134. data/lib/rhoconnect/api/app/bulk_data.rb +10 -10
  135. data/lib/rhoconnect/api/app/fast_delete.rb +11 -10
  136. data/lib/rhoconnect/api/app/fast_insert.rb +11 -10
  137. data/lib/rhoconnect/api/app/fast_update.rb +11 -10
  138. data/lib/rhoconnect/api/app/login.rb +5 -5
  139. data/lib/rhoconnect/api/app/push_deletes.rb +12 -11
  140. data/lib/rhoconnect/api/app/push_objects.rb +12 -11
  141. data/lib/rhoconnect/api/app/query.rb +8 -7
  142. data/lib/rhoconnect/api/app/queue_updates.rb +98 -94
  143. data/lib/rhoconnect/api/app/search.rb +8 -7
  144. data/lib/rhoconnect/api/client/client_get_db_doc.rb +5 -5
  145. data/lib/rhoconnect/api/client/client_set_db_doc.rb +8 -8
  146. data/lib/rhoconnect/api/client/create.rb +7 -7
  147. data/lib/rhoconnect/api/client/get_client_params.rb +4 -4
  148. data/lib/rhoconnect/api/client/list_client_docs.rb +17 -17
  149. data/lib/rhoconnect/api/client/register.rb +12 -12
  150. data/lib/rhoconnect/api/client/reset.rb +5 -5
  151. data/lib/rhoconnect/api/readstate/set_refresh_time.rb +9 -9
  152. data/lib/rhoconnect/api/source/get_source_params.rb +4 -4
  153. data/lib/rhoconnect/api/source/list_sources.rb +16 -16
  154. data/lib/rhoconnect/api/source/update_source_params.rb +6 -6
  155. data/lib/rhoconnect/api/store/get_db_doc.rb +4 -4
  156. data/lib/rhoconnect/api/store/set_db_doc.rb +7 -7
  157. data/lib/rhoconnect/api/system/get_adapter.rb +4 -4
  158. data/lib/rhoconnect/api/system/get_license_info.rb +8 -8
  159. data/lib/rhoconnect/api/system/login.rb +15 -15
  160. data/lib/rhoconnect/api/system/reset.rb +11 -11
  161. data/lib/rhoconnect/api/system/save_adapter.rb +4 -4
  162. data/lib/rhoconnect/api/system/stats.rb +22 -22
  163. data/lib/rhoconnect/api/user/create_user.rb +7 -7
  164. data/lib/rhoconnect/api/user/delete_client.rb +6 -6
  165. data/lib/rhoconnect/api/user/delete_user.rb +11 -10
  166. data/lib/rhoconnect/api/user/list_clients.rb +4 -4
  167. data/lib/rhoconnect/api/user/list_source_docs.rb +10 -10
  168. data/lib/rhoconnect/api/user/list_users.rb +3 -3
  169. data/lib/rhoconnect/api/user/ping.rb +3 -3
  170. data/lib/rhoconnect/api/user/show_user.rb +3 -3
  171. data/lib/rhoconnect/api/user/update_user.rb +5 -5
  172. data/lib/rhoconnect/api/user/user_get_db_doc.rb +5 -5
  173. data/lib/rhoconnect/api/user/user_set_db_doc.rb +10 -10
  174. data/lib/rhoconnect/api_token.rb +5 -6
  175. data/lib/rhoconnect/app.rb +6 -46
  176. data/lib/rhoconnect/application/init.rb +5 -2
  177. data/lib/rhoconnect/async.rb +76 -39
  178. data/lib/rhoconnect/bulk_data/bulk_data.rb +6 -4
  179. data/lib/rhoconnect/client.rb +59 -9
  180. data/lib/rhoconnect/condition/admin_required.rb +27 -0
  181. data/lib/rhoconnect/condition/client_required.rb +50 -0
  182. data/lib/rhoconnect/condition/login_required.rb +22 -0
  183. data/lib/rhoconnect/condition/source_required.rb +49 -0
  184. data/lib/rhoconnect/condition/verbs.rb +17 -0
  185. data/lib/rhoconnect/condition/verify_success.rb +19 -0
  186. data/lib/rhoconnect/controller/app_base.rb +74 -0
  187. data/lib/rhoconnect/controller/base.rb +68 -0
  188. data/lib/rhoconnect/controller/clients_controller.rb +79 -0
  189. data/lib/rhoconnect/controller/dynamic_adapter_controller.rb +93 -0
  190. data/lib/rhoconnect/controller/js_base.rb +124 -0
  191. data/lib/rhoconnect/controller/read_state_controller.rb +22 -0
  192. data/lib/rhoconnect/controller/source_adapter_base.rb +14 -0
  193. data/lib/rhoconnect/controller/sources_controller.rb +44 -0
  194. data/lib/rhoconnect/controller/store_controller.rb +25 -0
  195. data/lib/rhoconnect/controller/system_controller.rb +67 -0
  196. data/lib/rhoconnect/controller/users_controller.rb +99 -0
  197. data/lib/rhoconnect/db_adapter.rb +1 -3
  198. data/lib/rhoconnect/document.rb +159 -50
  199. data/lib/rhoconnect/handler/authenticate/execute_methods.rb +77 -0
  200. data/lib/rhoconnect/handler/authenticate/runner.rb +49 -0
  201. data/lib/rhoconnect/handler/authenticate.rb +3 -0
  202. data/lib/rhoconnect/handler/bulk_data.rb +28 -0
  203. data/lib/rhoconnect/handler/changes/engine.rb +271 -0
  204. data/lib/rhoconnect/handler/changes/execute_methods.rb +88 -0
  205. data/lib/rhoconnect/handler/changes/pass_through_runner.rb +11 -0
  206. data/lib/rhoconnect/handler/changes/runner.rb +53 -0
  207. data/lib/rhoconnect/handler/changes.rb +31 -0
  208. data/lib/rhoconnect/handler/helpers/auth_method.rb +29 -0
  209. data/lib/rhoconnect/handler/helpers/binding.rb +18 -0
  210. data/lib/rhoconnect/handler/helpers/bulk_data.rb +53 -0
  211. data/lib/rhoconnect/handler/helpers/source_job.rb +14 -0
  212. data/lib/rhoconnect/handler/helpers.rb +4 -0
  213. data/lib/rhoconnect/handler/plugin_callbacks/execute_methods.rb +99 -0
  214. data/lib/rhoconnect/handler/plugin_callbacks/runner.rb +28 -0
  215. data/lib/rhoconnect/handler/plugin_callbacks.rb +67 -0
  216. data/lib/rhoconnect/handler/query/engine.rb +93 -0
  217. data/lib/rhoconnect/handler/query/execute_methods.rb +21 -0
  218. data/lib/rhoconnect/handler/query/pass_through_runner.rb +35 -0
  219. data/lib/rhoconnect/handler/query/runner.rb +270 -0
  220. data/lib/rhoconnect/handler/query.rb +19 -0
  221. data/lib/rhoconnect/handler/search/engine.rb +60 -0
  222. data/lib/rhoconnect/handler/search/execute_methods.rb +32 -0
  223. data/lib/rhoconnect/handler/search/pass_through_runner.rb +18 -0
  224. data/lib/rhoconnect/handler/search/runner.rb +104 -0
  225. data/lib/rhoconnect/handler/search.rb +26 -0
  226. data/lib/rhoconnect/handler/sync.rb +29 -0
  227. data/lib/rhoconnect/jobs/source_job.rb +13 -4
  228. data/lib/rhoconnect/js_adapter.rb +79 -0
  229. data/lib/rhoconnect/license.rb +10 -2
  230. data/lib/rhoconnect/middleware/current_user.rb +14 -1
  231. data/lib/rhoconnect/middleware/helpers.rb +10 -93
  232. data/lib/rhoconnect/middleware/x_domain_session_wrapper.rb +1 -1
  233. data/lib/rhoconnect/model/base.rb +229 -0
  234. data/lib/rhoconnect/model/dynamic_adapter_model.rb +90 -0
  235. data/lib/rhoconnect/model/js_base.rb +121 -0
  236. data/lib/rhoconnect/ping/android.rb +1 -1
  237. data/lib/rhoconnect/predefined_adapters/bench_adapter.rb +7 -4
  238. data/lib/rhoconnect/read_state.rb +3 -3
  239. data/lib/rhoconnect/server.rb +159 -190
  240. data/lib/rhoconnect/source.rb +100 -11
  241. data/lib/rhoconnect/stats/record.rb +10 -10
  242. data/lib/rhoconnect/store.rb +905 -591
  243. data/lib/rhoconnect/{model.rb → store_orm.rb} +53 -115
  244. data/lib/rhoconnect/tasks.rb +18 -4
  245. data/lib/rhoconnect/test_methods.rb +30 -17
  246. data/lib/rhoconnect/user.rb +35 -17
  247. data/lib/rhoconnect/utilities.rb +1 -1
  248. data/lib/rhoconnect/version.rb +2 -2
  249. data/lib/rhoconnect/web-console/server.rb +29 -14
  250. data/lib/rhoconnect/web-console/views/home.js +10 -10
  251. data/lib/rhoconnect/web-console/views/new_ping.js +1 -1
  252. data/lib/rhoconnect.rb +120 -51
  253. data/rhoconnect.gemspec +4 -3
  254. data/spec/api/api_helper.rb +1 -6
  255. data/spec/api/app/fast_delete_spec.rb +4 -4
  256. data/spec/api/app/fast_insert_spec.rb +4 -4
  257. data/spec/api/app/fast_update_spec.rb +8 -8
  258. data/spec/api/app/push_deletes_spec.rb +2 -2
  259. data/spec/api/app/push_objects_spec.rb +5 -5
  260. data/spec/api/client/client_get_db_doc_spec.rb +6 -4
  261. data/spec/api/client/client_set_db_doc_spec.rb +3 -2
  262. data/spec/api/client/get_client_params_spec.rb +14 -0
  263. data/spec/api/client/list_client_docs_spec.rb +30 -20
  264. data/spec/api/client/reset_spec.rb +36 -0
  265. data/spec/api/source/get_source_params_spec.rb +23 -17
  266. data/spec/api/system/get_license_info_spec.rb +0 -20
  267. data/spec/api/system/login_spec.rb +8 -0
  268. data/spec/api/system/reset_spec.rb +0 -1
  269. data/spec/api/system/stats_spec.rb +5 -5
  270. data/spec/api/user/create_user_spec.rb +14 -6
  271. data/spec/api/user/delete_user_spec.rb +20 -18
  272. data/spec/api/user/list_users_spec.rb +5 -6
  273. data/spec/api/user/update_user_spec.rb +5 -4
  274. data/spec/apps/rhotestapp/config.ru +16 -1
  275. data/spec/apps/rhotestapp/controllers/js/js_sample_controller.js +23 -0
  276. data/spec/apps/rhotestapp/controllers/js/sample2_controller.js +32 -0
  277. data/spec/apps/rhotestapp/controllers/ruby/application_controller.rb +21 -0
  278. data/spec/apps/rhotestapp/controllers/ruby/sample_adapter_controller.rb +8 -0
  279. data/spec/apps/rhotestapp/models/js/js_sample.js +55 -0
  280. data/spec/apps/rhotestapp/models/js/sample2.js +25 -0
  281. data/spec/apps/rhotestapp/{sources → models/ruby}/base_adapter.rb +0 -0
  282. data/spec/apps/rhotestapp/{sources → models/ruby}/fixed_schema_adapter.rb +0 -0
  283. data/spec/apps/rhotestapp/{sources → models/ruby}/other_adapter.rb +0 -0
  284. data/spec/apps/rhotestapp/{sources → models/ruby}/sample_adapter.rb +0 -0
  285. data/spec/apps/rhotestapp/{sources → models/ruby}/simple_adapter.rb +2 -2
  286. data/spec/apps/rhotestapp/{sources → models/ruby}/sub_adapter.rb +0 -0
  287. data/spec/apps/rhotestapp/settings/settings.yml +0 -1
  288. data/spec/bulk_data/bulk_data_spec.rb +20 -5
  289. data/spec/cli/cli_spec.rb +83 -0
  290. data/spec/client_spec.rb +20 -17
  291. data/spec/client_sync_spec.rb +244 -406
  292. data/spec/controllers/js_base_spec.rb +89 -0
  293. data/spec/doc/doc_spec.rb +18 -18
  294. data/spec/document_spec.rb +29 -13
  295. data/spec/dynamic_adapter_spec.rb +6 -6
  296. data/spec/generator/generator_spec.rb +7 -4
  297. data/spec/jobs/bulk_data_job_spec.rb +14 -10
  298. data/spec/jobs/source_job_spec.rb +8 -8
  299. data/spec/license_spec.rb +5 -2
  300. data/spec/models/js_model_spec.rb +39 -0
  301. data/spec/node_spec.rb +42 -0
  302. data/spec/perf/store_perf_spec.rb +67 -12
  303. data/spec/ping/android_spec.rb +1 -1
  304. data/spec/read_state_spec.rb +1 -1
  305. data/spec/rhoconnect_spec.rb +1 -1
  306. data/spec/server/cors_spec.rb +14 -18
  307. data/spec/server/server_spec.rb +265 -88
  308. data/spec/server/stats_spec.rb +1 -1
  309. data/spec/source_adapter_spec.rb +54 -27
  310. data/spec/source_spec.rb +8 -3
  311. data/spec/source_sync_spec.rb +538 -468
  312. data/spec/spec_helper.rb +35 -4
  313. data/spec/stats/record_spec.rb +10 -10
  314. data/spec/{model_spec.rb → store_orm_spec.rb} +56 -54
  315. data/spec/store_spec.rb +159 -179
  316. data/spec/support/shared_examples.rb +36 -27
  317. data/spec/sync_states_spec.rb +40 -33
  318. data/spec/test_methods_spec.rb +18 -14
  319. data/spec/user_spec.rb +17 -30
  320. metadata +156 -52
  321. data/bench/benchapp/application.rb +0 -39
  322. data/bench/blobapp/application.rb +0 -44
  323. data/commands/rhoconnect/clean_start.rb +0 -9
  324. data/commands/rhoconnect/create_user.rb +0 -18
  325. data/commands/rhoconnect/delete_device.rb +0 -9
  326. data/commands/rhoconnect/delete_user.rb +0 -8
  327. data/commands/rhoconnect/reset.rb +0 -16
  328. data/commands/rhoconnect/reset_refresh.rb +0 -11
  329. data/generators/templates/application/application.rb +0 -43
  330. data/lib/rhoconnect/client_sync.rb +0 -434
  331. data/lib/rhoconnect/dynamic_adapter.rb +0 -91
  332. data/lib/rhoconnect/middleware/admin_user.rb +0 -23
  333. data/lib/rhoconnect/middleware/current_request.rb +0 -16
  334. data/lib/rhoconnect/middleware/login_required.rb +0 -22
  335. data/lib/rhoconnect/source_adapter.rb +0 -132
  336. data/lib/rhoconnect/source_sync.rb +0 -464
  337. data/spec/apps/rhotestapp/application.rb +0 -23
data/doc/rest-api.txt CHANGED
@@ -4,7 +4,11 @@ The RhoConnect REST API allows you to control, monitor, and debug a running RhoC
4
4
 
5
5
  Below we describe the REST API using ruby sample code.
6
6
 
7
+ NOTE: All routes that require admin privileges must pass the API token using the special header
8
+ 'X-RhoConnect-API-TOKEN':api_token_string
9
+
7
10
  ## API Errors
11
+
8
12
  All API calls will return http 200 and requested data (if applied). Otherwise, API will return http error code and specific error message in the http message body.
9
13
 
10
14
  :::ruby
@@ -32,14 +36,10 @@ All API calls will return http 200 and requested data (if applied). Otherwise, A
32
36
  )
33
37
  end
34
38
 
35
- ## API Methods (REST API version 1)
39
+ ## System Resource - POST login
36
40
 
37
- NOTE: All routes that require admin privileges must pass the API token using the special header
38
- 'X-RhoConnect-API-TOKEN':api_token_string
39
-
40
- ### System Resource (requires API token)
41
+ POST /rc/v1/system/login
41
42
 
42
- #### `POST /rc/v1/system/login`
43
43
  Before you can use RhoConnect API you should login to the RhoConnect server and get API token:
44
44
 
45
45
  :::ruby
@@ -52,7 +52,10 @@ Before you can use RhoConnect API you should login to the RhoConnect server and
52
52
 
53
53
  @api_token = RestClient.post("#{server}/rc/v1/system/login", { :login => login, :password => password }.to_json, :content_type => :json)
54
54
 
55
- #### `GET /rc/v1/system/license`
55
+ ## System Resource - GET license
56
+
57
+ GET /rc/v1/system/license
58
+
56
59
  Returns license information of the currently used license
57
60
 
58
61
  :::ruby
@@ -61,7 +64,10 @@ Returns license information of the currently used license
61
64
  {'X-RhoConnect-API-TOKEN' => @api_token}
62
65
  ).body
63
66
 
64
- #### `POST /rc/v1/system/reset`
67
+ ## System Resource - POST reset
68
+
69
+ POST /rc/v1/system/reset
70
+
65
71
  Reset the server: flush db and re-bootstrap server
66
72
 
67
73
  :::ruby
@@ -71,7 +77,10 @@ Reset the server: flush db and re-bootstrap server
71
77
  'X-RhoConnect-API-TOKEN' => @api_token}
72
78
  )
73
79
 
74
- #### `GET /rc/v1/system/appserver`
80
+ ## System Resource - GET appserver
81
+
82
+ GET /rc/v1/system/appserver
83
+
75
84
  Returns the url of the plugin's backend from the RhoConnect server.
76
85
 
77
86
  :::ruby
@@ -80,7 +89,10 @@ Returns the url of the plugin's backend from the RhoConnect server.
80
89
  {'X-RhoConnect-API-TOKEN' => @api_token}
81
90
  ).body
82
91
 
83
- #### `POST /rc/v1/system/appserver`
92
+ ## System Resource - POST appserver
93
+
94
+ POST /rc/v1/system/appserver
95
+
84
96
  Saves the url of the plugin's backend to the RhoConnect server.
85
97
 
86
98
  :::ruby
@@ -93,18 +105,17 @@ Saves the url of the plugin's backend to the RhoConnect server.
93
105
  'X-RhoConnect-API-TOKEN' => @api_token}
94
106
  )
95
107
 
96
- #### `GET /rc/v1/system/stats`
108
+ ## System Resource - GET stats
109
+
110
+ GET /rc/v1/system/stats
111
+
97
112
  Retrieves stats for a given metric key:
98
113
 
99
114
  :::ruby
100
115
  RestClient.get(
101
116
  "#{server}/rc/v1/system/stats",
102
117
  {
103
- :params => {:metric => 'foo',
104
- :start => 0,
105
- :finish => -1}
106
- },
107
- {
118
+ :params => {:metric => 'foo', :start => 0, :finish => -1},
108
119
  'X-RhoConnect-API-TOKEN' => @api_token
109
120
  }
110
121
  )
@@ -115,16 +126,15 @@ Retrieves a list of metric keys matching a given pattern. This supports 'glob'
115
126
  RestClient.get(
116
127
  "#{server}/rc/v1/system/stats",
117
128
  {
118
- :params => {:names => 'sources:*:Product'}
119
- },
120
- {
129
+ :params => {:names => 'sources:*:Product'},
121
130
  'X-RhoConnect-API-TOKEN' => @api_token
122
131
  }
123
132
  )
124
-
125
- ### Store Resource (requires API token)
126
133
 
127
- #### `GET /rc/v1/store/:doc`
134
+ ## Store Resource - GET doc
135
+
136
+ GET /rc/v1/store/:doc
137
+
128
138
  Return content of a given document stored in Redis.
129
139
 
130
140
  :::ruby
@@ -135,7 +145,10 @@ Return content of a given document stored in Redis.
135
145
  }
136
146
  ).body
137
147
 
138
- #### `POST /rc/v1/store/:doc`
148
+ ## Store Resource - POST doc
149
+
150
+ POST /rc/v1/store/:doc
151
+
139
152
  Sets the content of the specified server document. Data should be either a string or hash of hashes.
140
153
  If `append` flag is set to `true` , the data is appended to the current doc (if it exists) instead of replacing it.
141
154
 
@@ -150,9 +163,10 @@ If `append` flag is set to `true` , the data is appended to the current doc (if
150
163
  'X-RhoConnect-API-TOKEN' => @api_token}
151
164
  )
152
165
 
153
- ### User Resource (requires API token)
166
+ ## User Resource - POST user
167
+
168
+ POST /rc/v1/users
154
169
 
155
- #### `POST /rc/v1/users`
156
170
  Create a user in this RhoConnect application.
157
171
 
158
172
  :::ruby
@@ -167,7 +181,10 @@ Create a user in this RhoConnect application.
167
181
  'X-RhoConnect-API-TOKEN' => @api_token}
168
182
  )
169
183
 
170
- #### `DELETE /rc/v1/users/:user_id`
184
+ ## User Resource - DELETE user_id
185
+
186
+ DELETE /rc/v1/users/:user_id
187
+
171
188
  Delete User and all associated devices from the RhoConnect application.
172
189
 
173
190
  :::ruby
@@ -178,7 +195,10 @@ Delete User and all associated devices from the RhoConnect application.
178
195
  }
179
196
  )
180
197
 
181
- #### `PUT /rc/v1/users/:user_id`
198
+ ## User Resource - PUT user_id
199
+
200
+ PUT /rc/v1/users/:user_id
201
+
182
202
  Update attributes for a user on this RhoConnect application.
183
203
 
184
204
  :::ruby
@@ -193,7 +213,10 @@ Update attributes for a user on this RhoConnect application.
193
213
  'X-RhoConnect-API-TOKEN' => @api_token}
194
214
  )
195
215
 
196
- #### `GET /rc/v1/users`
216
+ ## User Resource - GET users
217
+
218
+ GET /rc/v1/users
219
+
197
220
  List users registered with this RhoConnect application.
198
221
 
199
222
  :::ruby
@@ -204,7 +227,10 @@ List users registered with this RhoConnect application.
204
227
  }
205
228
  ).body
206
229
 
207
- #### `GET /rc/v1/users/:user_id`
230
+ ## User Resource - GET user_id
231
+
232
+ GET /rc/v1/users/:user_id
233
+
208
234
  Returns the information for the specified user.
209
235
 
210
236
  :::ruby
@@ -215,7 +241,10 @@ Returns the information for the specified user.
215
241
  }
216
242
  ).body
217
243
 
218
- #### `GET /rc/v1/users/:user_id/clients`
244
+ ## User Resource - GET clients
245
+
246
+ GET /rc/v1/users/:user_id/clients
247
+
219
248
  List clients (devices) associated with given user.
220
249
 
221
250
  :::ruby
@@ -227,7 +256,10 @@ List clients (devices) associated with given user.
227
256
 
228
257
  Returns list of client ids.
229
258
 
230
- #### `DELETE /rc/v1/users/:user_id/clients/:client_id`
259
+ ## User Resource - DELETE client_id
260
+
261
+ DELETE /rc/v1/users/:user_id/clients/:client_id
262
+
231
263
  Deletes the specified client (device) for the given user.
232
264
 
233
265
  :::ruby
@@ -238,7 +270,10 @@ Deletes the specified client (device) for the given user.
238
270
  }
239
271
  )
240
272
 
241
- #### `GET /rc/v1/users/:user_id/sources/:source_id/docnames`
273
+ ## User Resource - GET source_id docnames
274
+
275
+ GET /rc/v1/users/:user_id/sources/:source_id/docnames
276
+
242
277
  Return list of document keys associated with given source and user.
243
278
 
244
279
  If `:user_id` set to '*', this call will return list of keys for 'shared' documents.
@@ -251,8 +286,10 @@ If `:user_id` set to '*', this call will return list of keys for 'shared' docume
251
286
  }
252
287
  ).body
253
288
 
289
+ ## User Resource - POST ping
290
+
291
+ POST /rc/v1/users/ping
254
292
 
255
- #### `POST /rc/v1/users/ping`
256
293
  Sends PUSH message to all devices of the specified user(s):
257
294
 
258
295
  :::ruby
@@ -276,7 +313,10 @@ Sends PUSH message to all devices of the specified user(s):
276
313
  'X-RhoConnect-API-TOKEN' => @api_token }
277
314
  )
278
315
 
279
- #### `GET /rc/v1/users/:user_id/sources/:source_id/docs/:doc`
316
+ ## User Resource - GET source_id doc
317
+
318
+ GET /rc/v1/users/:user_id/sources/:source_id/docs/:doc
319
+
280
320
  Return content of a given source document for the specified user.
281
321
 
282
322
  :::ruby
@@ -287,7 +327,10 @@ Return content of a given source document for the specified user.
287
327
  }
288
328
  ).body
289
329
 
290
- #### `POST /rc/v1/users/:user_id/sources/:source_id/docs/:doc`
330
+ ## User Resource - POST source_id doc
331
+
332
+ POST /rc/v1/users/:user_id/sources/:source_id/docs/:doc
333
+
291
334
  Sets the content of the specified source document for the given user. Data should be either a string or hash of hashes.
292
335
  If `append` flag is set to `true` , the data is appended to the current doc (if it exists) instead of replacing it.
293
336
 
@@ -302,9 +345,10 @@ If `append` flag is set to `true` , the data is appended to the current doc (if
302
345
  'X-RhoConnect-API-TOKEN' => @api_token}
303
346
  )
304
347
 
305
- ### Read State Resource (requires API token)
348
+ ## Read State - POST user source_id
349
+
350
+ POST /rc/v1/read_state/users/:user_id/sources/:source_id
306
351
 
307
- #### `POST /rc/v1/read_state/users/:user_id/sources/:source_id`
308
352
  Sets source poll interval to "current time plus x seconds".
309
353
 
310
354
  :::ruby
@@ -319,9 +363,10 @@ Sets source poll interval to "current time plus x seconds".
319
363
 
320
364
  This will set the refresh time to 100 seconds from the current time. Calling `set_refresh_time` with no `:refresh_time` will trigger a refresh on the sync request for the source.
321
365
 
322
- ### Source Controller (requires API token)
366
+ ## Source Controller - GET partition_type
367
+
368
+ GET /rc/v1/sources/type/:partition_type
323
369
 
324
- #### `GET /rc/v1/sources/type/:partition_type`
325
370
  Return list of source adapters for this RhoConnect application for the given partition type.
326
371
  Partition type can be either `app` or `user`.
327
372
 
@@ -332,7 +377,10 @@ Partition type can be either `app` or `user`.
332
377
  }
333
378
  ).body
334
379
 
335
- #### `GET /rc/v1/sources/:source_id`
380
+ ## Source Controller - GET source_id
381
+
382
+ GET /rc/v1/sources/:source_id
383
+
336
384
  Return attributes associated with a given source:
337
385
 
338
386
  * `name` - name of the data source
@@ -352,7 +400,10 @@ Return attributes associated with a given source:
352
400
  }
353
401
  ).body
354
402
 
355
- #### `PUT /rc/v1/sources/:source_id`
403
+ ## Source Controller - PUT source_id
404
+
405
+ PUT /rc/v1/sources/:source_id
406
+
356
407
  Updates attributes associated with a given source:
357
408
 
358
409
  `poll_interval` - query poll interval; defines how often RhoConnect will call source adapter to query for new data, set to -1 to disable polling, 0 to always poll.
@@ -367,10 +418,11 @@ Updates attributes associated with a given source:
367
418
  'X-RhoConnect-API-TOKEN' => @api_token}
368
419
  ).body
369
420
 
370
- ### Client Resource (requires API token)
421
+ ## Client Resource - GET client_id
422
+
423
+ GET /rc/v1/clients/:client_id
371
424
 
372
- #### `GET /rc/v1/clients/:client_id`
373
- Returns client (device) attributes, such as `device_type`, `device_pin`, `device_port`. These attributes used by [RhoConnect push](/rhoconnect/push).
425
+ Returns client (device) attributes, such as `device_type`, `device_pin`, `device_port`. These attributes are used by [RhoConnect push](/rhoconnect/push).
374
426
 
375
427
  :::ruby
376
428
  client_attributes = RestClient.get(
@@ -380,7 +432,10 @@ Returns client (device) attributes, such as `device_type`, `device_pin`, `device
380
432
  }
381
433
  ).body
382
434
 
383
- #### `GET /rc/v1/clients/:client_id/sources/:source_id/docnames`
435
+ ## Client Resource - GET source_id docnames
436
+
437
+ GET /rc/v1/clients/:client_id/sources/:source_id/docnames
438
+
384
439
  Returns list of document keys associated with particular client for a given source. These documents are used by the server to sync data with the client.
385
440
 
386
441
  :::ruby
@@ -391,7 +446,10 @@ Returns list of document keys associated with particular client for a given sour
391
446
  }
392
447
  ).body
393
448
 
394
- #### `GET /rc/v1/clients/:client_id/sources/:source_id/docs/:doc`
449
+ ## Client Resource - GET source_id doc
450
+
451
+ GET /rc/v1/clients/:client_id/sources/:source_id/docs/:doc
452
+
395
453
  Return content of a given source document for the specified client.
396
454
 
397
455
  :::ruby
@@ -402,7 +460,10 @@ Return content of a given source document for the specified client.
402
460
  }
403
461
  ).body
404
462
 
405
- #### `POST /rc/v1/clients/:client_id/sources/:source_id/docs/:doc`
463
+ ## Client Resource - POST source_id doc
464
+
465
+ POST /rc/v1/clients/:client_id/sources/:source_id/docs/:doc
466
+
406
467
  Sets the content of the specified source document for the given client. Data should be either a string or hash of hashes.
407
468
  If `append` flag is set to `true` , the data is appended to the current doc (if it exists) instead of replacing it.
408
469
 
@@ -417,11 +478,11 @@ If `append` flag is set to `true` , the data is appended to the current doc (if
417
478
  'X-RhoConnect-API-TOKEN' => @api_token}
418
479
  )
419
480
 
481
+ ## Plugin source_name - POST push_objects
420
482
 
421
- ### Plugin methods (requires API token)
483
+ POST /app/v1/:source_name/push_objects
422
484
 
423
- #### `POST /app/v1/:source_name/push_objects`
424
- Push new objects or object updates to RhoConnect. These changes will be sent to device next time it synchronizes.
485
+ Push new objects or object updates to RhoConnect. These changes will be sent to the device the next time it synchronizes.
425
486
 
426
487
  **NOTE: you may use [ping](/rhoconnect/push) to notify client and trigger sync.**
427
488
 
@@ -447,7 +508,10 @@ documents, `push_objects` method can be optimized by invoking only the necessary
447
508
  the number of transactions with Redis. To force the optimization, user can use the `:rebuild_md => false` flag
448
509
  in the `push_objects` parameters hash.**
449
510
 
450
- #### `POST /app/v1/:source_name/push_deletes`
511
+ ## Plugin source_name - POST delete_objects
512
+
513
+ POST /app/v1/:source_name/push_deletes
514
+
451
515
  Delete objects from RhoConnect. These objects will be deleted from the device the next time it synchronizes.
452
516
 
453
517
  **NOTE: You may use [ping](/rhoconnect/push) to notify client and trigger sync.**
@@ -469,7 +533,10 @@ documents, `push_deletes` method can be optimized by invoking only the necessary
469
533
  the number of transactions with Redis. To force the optimization, user can use the `:rebuild_md => false` flag
470
534
  in the `push_deletes` parameters hash.**
471
535
 
472
- #### `POST /app/v1/:source_name/fast_insert`
536
+ ## Plugin sourece_name - POST fast_insert
537
+
538
+ POST /app/v1/:source_name/fast_insert
539
+
473
540
  Push new objects to RhoConnect. Changes are inserted into the Redis set without any checking for previous existence.
474
541
  This way, the insert is very fast, but user must ensure that the object didn't exist before. No safeguards are implemented.
475
542
  Use this method only when you can ensure the integrity of the data.
@@ -493,7 +560,10 @@ Use this method only when you can ensure the integrity of the data.
493
560
  'X-RhoConnect-API-TOKEN' => @api_token}
494
561
  )
495
562
 
496
- #### `POST /app/v1/:source_name/fast_update`
563
+ ## Plugin source_name - POST fast_update
564
+
565
+ POST /app/v1/:source_name/fast_update
566
+
497
567
  Push object updates to RhoConnect. This method doesn't involve pulling the existing data out of Redis. Instead it required user to provide the previous state of the data. This way, this method allows for very fast updates (since it just removes the previous data from set and adds new ones). However, no data integrity checks are performed. Therefore, this method must be used only if user can ensure the integrity of the data (i.e. previous state must exist, otherwise it won't be properly deleted). Also, this method can be used to perform fast appends and deletes for any of the object's attributes (However, you shouldn't use this method to remove all of the attributes, `fast_delete` should be used instead.)
498
568
 
499
569
  **NOTE: you may use [ping](/rhoconnect/push) to notify client after the update and trigger sync.**
@@ -524,8 +594,11 @@ Push object updates to RhoConnect. This method doesn't involve pulling the exist
524
594
  'X-RhoConnect-API-TOKEN' => @api_token}
525
595
  )
526
596
 
527
- #### `POST /app/v1/:source_name/fast_delete`
528
- Push object deletes to RhoConnect. This method doesn't involve pulling the existing data out of Redis and removing all of its attributes. Instead it required user to provide all of the object's data in the hash to be removed. This way, this method allows for very fast deletes (since it just removes the object's data from set). However, no data integrity checks are performed. Therefore, this method must be used only if user can ensure the integrity of the data (i.e. supply all of the object's data to be removed, otherwise some object's data will remain in Redis).
597
+ ## Plugin source_name - POST fast_delete
598
+
599
+ POST /app/v1/:source_name/fast_delete
600
+
601
+ Push object deletes to RhoConnect. This method doesn't involve pulling the existing data out of Redis and removing all of its attributes. Instead it requires the user to provide all of the object's data in the hash to be removed. This way, this method allows for very fast deletes (since it just removes the object's data from set). However, no data integrity checks are performed. Therefore, this method must be used only if user can ensure the integrity of the data (i.e. supply all of the object's data to be removed, otherwise some object's data will remain in Redis).
529
602
 
530
603
  **NOTE: you may use [ping](/rhoconnect/push) to notify client after the delete and trigger sync.**
531
604
 
@@ -288,6 +288,126 @@ The template will create a sample scalable rhoconnect stack with 2 elastic load
288
288
  * 2 EC2 instances of monitor servers (Haproxy/Monit)
289
289
  * 2 EC2 instances of redis servers (master/slave)
290
290
 
291
+ ## Setting up Redis Servers Horizontal Scaling
292
+
293
+ Under heavy load single Redis server might be a bottleneck in RhoConnect stack performance due to high network traffic,
294
+ large memory footprints of stored data in server instance. To address redis server performance issues RhoConnect (>= v4.0.0)
295
+ supports multiple Redis instances per app, and evenly distributing load across available Redis server instances.
296
+
297
+ ### Configure RhoConnect app to support multiple Redis instances
298
+
299
+ Edit your app `settings/settings.yml` file and replace :redis one liner by array of redis servers you are going to use:
300
+
301
+ :::yaml
302
+ # ...
303
+ :production:
304
+ :licensefile: settings/license.key
305
+ :syncserver: http://localhost:9292/api/application/
306
+ :push_server: http://appname:secret@localhost:8675/
307
+ # Two or more redis servers per app
308
+ :redis:
309
+ - localhost:6379
310
+ - localhost:6380
311
+ - localhost:6381
312
+ - localhost:6382
313
+ # ...
314
+
315
+
316
+ ### Create a custom Amazon Image with multiple Redis instances
317
+
318
+ The following recommendations are based on Ubuntu Amazon image, where [RhoConnect Redis](http://docs.rhomobile.com/rhoconnect/deploying#deploying-rhoconnect-redis-and-push-packages-on-linux-servers) package installed and you wanted host 4 redis instances on ports 6379, 6380, 6381, and 6382 respectively.
319
+
320
+ Rename `/opt/rhoconnect/etc/redis.conf` configuration file to `/opt/rhoconnect/etc/redis-6379.conf` and make sure that it has settings for the 1st instance:
321
+
322
+ :::text
323
+ ...
324
+ daemonize yes
325
+ pidfile /var/run/redis/redis6379.pid
326
+ port 6379
327
+
328
+ # DO NOT FORGET comment persistence cmds
329
+ # save ...
330
+ ...
331
+
332
+ For other servers create `/opt/rhoconnect/etc/redis-6380.conf`, `/opt/rhoconnect/etc/redis-6381.conf` and `/opt/rhoconnect/etc/redis-6382.conf`
333
+ files and do similar setting for corresponding redis instances:
334
+
335
+ :::text
336
+ # File /opt/rhoconnect/etc/redis-6380.conf
337
+ ...
338
+ daemonize yes
339
+ pidfile /var/run/redis/redis6380.pid
340
+ port 6380
341
+ # DO NOT FORGET comment persistence cmds
342
+ ...
343
+
344
+ # File /opt/rhoconnect/etc/redis-6381.conf
345
+ ...
346
+ daemonize yes
347
+ pidfile /var/run/redis/redis6381.pid
348
+ port 6381
349
+ # DO NOT FORGET comment persistence cmds
350
+ ...
351
+
352
+ # File /opt/rhoconnect/etc/redis-6382.conf
353
+ ...
354
+ daemonize yes
355
+ pidfile /var/run/redis/redis6382.pid
356
+ port 6382
357
+ # DO NOT FORGET comment persistence cmds
358
+ ...
359
+
360
+
361
+ Delete `/etc/init/rhoconnect-redis.conf` file if it's there.
362
+ Create upstart script `/etc/init/rhoconnect-redis-6379.conf` for the 1-st instance:
363
+
364
+ :::text
365
+ # /etc/init/rhoconnect-redis-6379.conf
366
+
367
+ description "Redis Datastore Server"
368
+ # Redis is a key value in memory persistent datastore
369
+
370
+ start on (local-filesystems and runlevel [2345])
371
+ stop on runlevel [016]
372
+ expect fork
373
+ respawn
374
+
375
+ pre-start script
376
+ mkdir -p /var/run/redis
377
+ chown redis:redis /var/run/redis
378
+ end script
379
+
380
+ exec start-stop-daemon --start --chuid redis:redis --pidfile /var/run/redis/redis6379.pid --umask 007 \
381
+ --exec /opt/rhoconnect/bin/redis-server -- /opt/rhoconnect/etc/redis-6379.conf
382
+
383
+ Define upstart scripts `/etc/init/rhoconnect-redis-6380.conf`, `/etc/init/rhoconnect-redis-6381.conf`, and `/etc/init/rhoconnect-redis-6382.conf` for other instances:
384
+
385
+ :::text
386
+ # /etc/init/rhoconnect-redis-6380.conf
387
+ # ...
388
+ exec start-stop-daemon --start --chuid redis:redis --pidfile /var/run/redis/redis6380.pid --umask 007 \
389
+ --exec /opt/rhoconnect/bin/redis-server -- /opt/rhoconnect/etc/redis-6380.conf
390
+
391
+ # /etc/init/rhoconnect-redis-6381.conf
392
+ # ...
393
+ exec start-stop-daemon --start --chuid redis:redis --pidfile /var/run/redis/redis6381.pid --umask 007 \
394
+ --exec /opt/rhoconnect/bin/redis-server -- /opt/rhoconnect/etc/redis-6381.conf
395
+
396
+ # /etc/init/rhoconnect-redis-6382.conf
397
+ # ...
398
+ exec start-stop-daemon --start --chuid redis:redis --pidfile /var/run/redis/redis6382.pid --umask 007 \
399
+ --exec /opt/rhoconnect/bin/redis-server -- /opt/rhoconnect/etc/redis-6382.conf
400
+
401
+
402
+ We provide a public preconfigured image with above settings for Us `West N. California` region:
403
+
404
+ * `ami-94b496d1` (Redis-Server-2.6.7 with 4 instances on ports 6379, 6380, 6381, and 6382)
405
+
406
+ ### Amazon CloudFormation Template File
407
+
408
+ This Amazon CloudFormation [template file](https://s3.amazonaws.com/rhoconnect-deploy/rhoconnect-template-2-redises-4-instances.txt)
409
+ shows how 2 redis servers with 4 instances per server might be used for a typical rhoconncect application.
410
+
291
411
 
292
412
 
293
413
 
data/doc/settings.txt CHANGED
@@ -11,12 +11,12 @@ Each of the environment categories must have the following entries:
11
11
 
12
12
  :::yaml
13
13
  :syncserver: <url>
14
- :redis: <url>
14
+ :redis: <url|array_of_urls>
15
15
  :licensefile: <filename>
16
16
 
17
17
  `:syncserver`: application's base url.
18
18
 
19
- `:redis`: Redis url.
19
+ `:redis`: Redis url. Can be specified as an Array of URLs. In that case, RhoConnect will use several Redis servers (this can be used in case of high-volume data)
20
20
 
21
21
  `:licensefile`: application's license file.
22
22
 
@@ -28,9 +28,7 @@ In addition, you can specify the following settings:
28
28
  :redis_timeout: <secs>
29
29
  :poll_interval_default: <secs>
30
30
  :bulk_sync_poll_interval: <secs>
31
- :c2dm_username: <google's email>
32
- :c2dm_passwd: <passwd>
33
- :authtoken: <authtoken>
31
+ :gcm_api_key: your_gcm_api_key_here
34
32
 
35
33
  `:connection_pool_size`: By default, RhoConnect maintains multiple concurrent connections to Redis organized in Connection Pool. This setting allows you to specify the size of the pool. By default, RhoConnect starts with five (5) Redis connections.
36
34
 
@@ -42,13 +40,7 @@ In addition, you can specify the following settings:
42
40
 
43
41
  `:bulk_sync_poll_interval`: poll interval setting for bulk data sync, in seconds.
44
42
 
45
- `:c2dm_username`: The email address for the C2DM Google account.
46
-
47
- `:c2dm_passwd`: The password for the C2DM Google account.
48
-
49
- `:authtoken`: these settings are used specifically for Android push notifications. In order to push messages to the Android device, your server needs to obtain Google's C2DM authentication token associated with the trusted google account. For this purpose, you can specify C2DM Google account's username/password combo via the `:c2dm_username` and `:c2dm_passwd` settings. At run-time, the system will use these credentials to obtain the C2DM token and store it in the Redis for the future use. Once the token is expired, the system will automatically connect to the Google C2DM service to renew the token.
50
-
51
- Alternatively, you can use the `:authtoken` setting to specify the pre-defined authentication token. This token MUST be related to the role-based google account registered for your application. See [the rhodes push instructions](/rhodes/device-caps#push-notifications) for more details. To retrieve this token, use sample script [c2dm.rb](http://github.com/rhomobile/rhodes/blob/master/bin/c2dm.rb). Uncomment last two lines and put your google account specific data, then run it. It will print token to stdout. This approach, however, will not allow the server to connect to the C2DM service and renew the token once it is expired.
43
+ `:gcm_api_key`: The [API key for Google Cloud Messaging](/rhoconnect/push-client-setup-android#setting-up-android-google-cloud-messaging).
52
44
 
53
45
  ## Source settings
54
46
 
@@ -0,0 +1,28 @@
1
+ RhoConnect Source Adapters
2
+ ===
3
+
4
+ ## What is RhoConnect Source Adapter?
5
+
6
+ A RhoConnect Source Adapter is a software entity which encapsulates:
7
+
8
+ * Source's business logic implementation (via a Model)
9
+ * Source's run-time management and HTTP route handling (via a Controller)
10
+
11
+ ## Source Adapter Controller
12
+
13
+ From a web developer's point of view - each RhoConnect application is a collection of unique HTTP route handlers grouped logically into a Source Adapter Controller.
14
+ Each Source Adapter Controller defines a serviceable end point relative to the root of the application and represents itself as a stand-alone [Sinatra](http://www.sinatrarb.com/) app.
15
+ As a Sinatra app - Source Adapter Controller defines the available routes and handles the incoming requests.
16
+ Typically, you will just re-use the default implementation of the Controller. However, in some cases, you may customize it by adding your own routes or altering the default route's behaviour. In this sense, Controller is still a Sinatra app - and you can re-use any of the available Sinatra tools and techniques.
17
+
18
+ ## Source Adapter Model
19
+
20
+ By default, each RhoConnect Source Adapter Controller defines SYNC routes to be called by the RhoConnect client's application.
21
+ At run-time, the Source Adapter controller prepares the context of the request (for example, parses and prepares the query parameters, etc.), then instantiates the corresponding RhoConnect Source Adapter Model and calls its methods.
22
+
23
+ As a developer - you will need to implement the business logic inside of the RhoConnect Source Adapter Model class.
24
+ Connecting to a backend service with RhoConnect means that you will be required to write a small amount of code for the query, create, update and delete operations of your particular enterprise backend. In this way - the RhoConnect Source Adapter model is a collection of Ruby code to access and process the data from your enterprise backend.
25
+
26
+ ## Source Adapter API
27
+
28
+ Starting with RhoConnect 4, Source Adapters can be developed in Ruby or JavaScript. The next sections describe the Source Adapter API available for each of these languages.