cuboid 0.0.5 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (217) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/README.md +13 -13
  4. data/lib/cuboid/application.rb +10 -10
  5. data/lib/cuboid/option_groups/{dispatcher.rb → agent.rb} +9 -9
  6. data/lib/cuboid/option_groups/paths.rb +1 -1
  7. data/lib/cuboid/options.rb +1 -1
  8. data/lib/cuboid/processes/{dispatchers.rb → agents.rb} +25 -25
  9. data/lib/cuboid/processes/executables/agent.rb +5 -0
  10. data/lib/cuboid/processes/helpers/agents.rb +23 -0
  11. data/lib/cuboid/processes/helpers/instances.rb +4 -4
  12. data/lib/cuboid/processes/helpers.rb +1 -1
  13. data/lib/cuboid/processes/instances.rb +9 -9
  14. data/lib/cuboid/processes/schedulers.rb +2 -2
  15. data/lib/cuboid/processes.rb +2 -2
  16. data/lib/cuboid/rest/server/instance_helpers.rb +13 -13
  17. data/lib/cuboid/rest/server/routes/dispatcher.rb +11 -11
  18. data/lib/cuboid/rest/server/routes/grid.rb +8 -8
  19. data/lib/cuboid/rest/server/routes/instances.rb +1 -1
  20. data/lib/cuboid/rest/server.rb +5 -5
  21. data/lib/cuboid/rpc/client/{dispatcher.rb → agent.rb} +4 -4
  22. data/lib/cuboid/rpc/client/instance.rb +2 -2
  23. data/lib/cuboid/rpc/client.rb +1 -1
  24. data/lib/cuboid/rpc/server/agent/node.rb +247 -0
  25. data/lib/cuboid/rpc/server/{dispatcher → agent}/service.rb +13 -13
  26. data/lib/cuboid/rpc/server/{dispatcher.rb → agent.rb} +32 -31
  27. data/lib/cuboid/rpc/server/application_wrapper.rb +1 -1
  28. data/lib/cuboid/rpc/server/instance.rb +4 -4
  29. data/lib/cuboid/rpc/server/scheduler.rb +12 -12
  30. data/lib/version +1 -1
  31. data/spec/cuboid/option_groups/dispatcher_spec.rb +2 -2
  32. data/spec/cuboid/rest/server_spec.rb +45 -45
  33. data/spec/cuboid/rpc/client/dispatcher_spec.rb +2 -2
  34. data/spec/cuboid/rpc/server/dispatcher/node_spec.rb +65 -65
  35. data/spec/cuboid/rpc/server/dispatcher/service_spec.rb +16 -16
  36. data/spec/cuboid/rpc/server/dispatcher_spec.rb +95 -95
  37. data/spec/cuboid/rpc/server/scheduler_spec.rb +8 -8
  38. data/spec/support/fixtures/executables/node.rb +3 -3
  39. data/spec/support/fixtures/mock_app/test_service.rb +8 -8
  40. data/spec/support/fixtures/mock_app.rb +1 -1
  41. data/spec/support/fixtures/services/echo.rb +6 -6
  42. data/spec/support/helpers/resets.rb +1 -1
  43. data/spec/support/lib/web_server_client.rb +2 -2
  44. data/spec/support/lib/web_server_dispatcher.rb +1 -1
  45. metadata +10 -348
  46. data/lib/cuboid/processes/executables/dispatcher.rb +0 -5
  47. data/lib/cuboid/processes/helpers/dispatchers.rb +0 -23
  48. data/lib/cuboid/rpc/server/dispatcher/node.rb +0 -247
  49. data/spec/support/logs/Dispatcher - 1520492-37227.log +0 -6
  50. data/spec/support/logs/Dispatcher - 1520680-13689.log +0 -6
  51. data/spec/support/logs/Dispatcher - 1520682-24167.log +0 -6
  52. data/spec/support/logs/Dispatcher - 1520688-42731.log +0 -6
  53. data/spec/support/logs/Dispatcher - 1520690-5750.log +0 -10
  54. data/spec/support/logs/Dispatcher - 1520692-55183.log +0 -10
  55. data/spec/support/logs/Dispatcher - 1520695-39752.log +0 -10
  56. data/spec/support/logs/Dispatcher - 1520697-44327.log +0 -10
  57. data/spec/support/logs/Dispatcher - 1520699-58785.log +0 -10
  58. data/spec/support/logs/Dispatcher - 1520701-60952.log +0 -10
  59. data/spec/support/logs/Dispatcher - 1520796-50420.log +0 -6
  60. data/spec/support/logs/Dispatcher - 1520894-56883.log +0 -6
  61. data/spec/support/logs/Dispatcher - 1520896-21419.log +0 -6
  62. data/spec/support/logs/Dispatcher - 1520898-62584.log +0 -6
  63. data/spec/support/logs/Dispatcher - 1520900-59721.log +0 -6
  64. data/spec/support/logs/Dispatcher - 1520910-51632.log +0 -6
  65. data/spec/support/logs/Dispatcher - 1520920-21801.log +0 -6
  66. data/spec/support/logs/Dispatcher - 1520930-49223.log +0 -6
  67. data/spec/support/logs/Dispatcher - 1520933-34241.log +0 -6
  68. data/spec/support/logs/Dispatcher - 1520935-64571.log +0 -6
  69. data/spec/support/logs/Dispatcher - 1520937-50734.log +0 -6
  70. data/spec/support/logs/Dispatcher - 1520939-60841.log +0 -6
  71. data/spec/support/logs/Dispatcher - 1520944-8124.log +0 -6
  72. data/spec/support/logs/Dispatcher - 1520946-25192.log +0 -16
  73. data/spec/support/logs/Dispatcher - 1520948-9752.log +0 -14
  74. data/spec/support/logs/Dispatcher - 1520952-45543.log +0 -10
  75. data/spec/support/logs/Dispatcher - 1520958-36653.log +0 -16
  76. data/spec/support/logs/Dispatcher - 1520960-17456.log +0 -14
  77. data/spec/support/logs/Dispatcher - 1520964-5774.log +0 -10
  78. data/spec/support/logs/Dispatcher - 1520976-40848.log +0 -16
  79. data/spec/support/logs/Dispatcher - 1520978-29867.log +0 -14
  80. data/spec/support/logs/Dispatcher - 1520982-17715.log +0 -10
  81. data/spec/support/logs/Dispatcher - 1520987-8925.log +0 -16
  82. data/spec/support/logs/Dispatcher - 1520989-25480.log +0 -14
  83. data/spec/support/logs/Dispatcher - 1520993-5124.log +0 -10
  84. data/spec/support/logs/Dispatcher - 1520999-12901.log +0 -16
  85. data/spec/support/logs/Dispatcher - 1521004-32265.log +0 -14
  86. data/spec/support/logs/Dispatcher - 1521008-33455.log +0 -10
  87. data/spec/support/logs/Dispatcher - 1521014-13779.log +0 -6
  88. data/spec/support/logs/Dispatcher - 1521017-14755.log +0 -6
  89. data/spec/support/logs/Dispatcher - 1521022-48687.log +0 -6
  90. data/spec/support/logs/Dispatcher - 1521024-59097.log +0 -6
  91. data/spec/support/logs/Dispatcher - 1521034-12604.log +0 -6
  92. data/spec/support/logs/Dispatcher - 1521038-64272.log +0 -6
  93. data/spec/support/logs/Dispatcher - 1521043-8680.log +0 -6
  94. data/spec/support/logs/Dispatcher - 1521047-22949.log +0 -6
  95. data/spec/support/logs/Dispatcher - 1521051-3355.log +0 -6
  96. data/spec/support/logs/Dispatcher - 1521074-12332.log +0 -6
  97. data/spec/support/logs/Dispatcher - 1521118-53130.log +0 -16
  98. data/spec/support/logs/Dispatcher - 1521128-47137.log +0 -14
  99. data/spec/support/logs/Dispatcher - 1521136-30328.log +0 -10
  100. data/spec/support/logs/Dispatcher - 1521161-21329.log +0 -16
  101. data/spec/support/logs/Dispatcher - 1521172-19183.log +0 -14
  102. data/spec/support/logs/Dispatcher - 1521179-34902.log +0 -10
  103. data/spec/support/logs/Dispatcher - 1521190-20155.log +0 -16
  104. data/spec/support/logs/Dispatcher - 1521204-43843.log +0 -14
  105. data/spec/support/logs/Dispatcher - 1521211-23972.log +0 -10
  106. data/spec/support/logs/Dispatcher - 1521237-20879.log +0 -10
  107. data/spec/support/logs/Dispatcher - 1521239-61999.log +0 -10
  108. data/spec/support/logs/Dispatcher - 1521242-20975.log +0 -16
  109. data/spec/support/logs/Dispatcher - 1521246-28409.log +0 -14
  110. data/spec/support/logs/Dispatcher - 1521250-58505.log +0 -10
  111. data/spec/support/logs/Dispatcher - 1521262-53292.log +0 -6
  112. data/spec/support/logs/Dispatcher - 1521266-42758.log +0 -6
  113. data/spec/support/logs/Dispatcher - 1521277-4215.log +0 -6
  114. data/spec/support/logs/Dispatcher - 1521292-16086.log +0 -6
  115. data/spec/support/logs/Dispatcher - 1521301-42112.log +0 -6
  116. data/spec/support/logs/Dispatcher - 1521312-61196.log +0 -6
  117. data/spec/support/logs/Dispatcher - 1521316-23353.log +0 -6
  118. data/spec/support/logs/Dispatcher - 1521321-46361.log +0 -6
  119. data/spec/support/logs/Dispatcher - 1521438-46016.log +0 -6
  120. data/spec/support/logs/Dispatcher - 1521454-49862.log +0 -6
  121. data/spec/support/logs/Dispatcher - 1521470-54737.log +0 -6
  122. data/spec/support/logs/Instance - 1521353-26273.error.log +0 -105
  123. data/spec/support/logs/Instance - 1521355-56591.error.log +0 -105
  124. data/spec/support/logs/Instance - 1521363-26218.error.log +0 -105
  125. data/spec/support/logs/Scheduler - 1520469-35703.log +0 -3
  126. data/spec/support/logs/Scheduler - 1520473-60524.log +0 -6
  127. data/spec/support/logs/Scheduler - 1520509-34951.log +0 -3
  128. data/spec/support/logs/Scheduler - 1520517-31455.log +0 -6
  129. data/spec/support/logs/Scheduler - 1520529-43808.log +0 -4
  130. data/spec/support/logs/Scheduler - 1520536-23387.log +0 -1
  131. data/spec/support/logs/Scheduler - 1520549-48260.log +0 -3
  132. data/spec/support/logs/Scheduler - 1520563-45636.log +0 -6
  133. data/spec/support/logs/Scheduler - 1520599-40643.log +0 -3
  134. data/spec/support/logs/Scheduler - 1520608-54106.log +0 -6
  135. data/spec/support/logs/Scheduler - 1520629-24722.log +0 -3
  136. data/spec/support/logs/Scheduler - 1520637-61755.log +0 -6
  137. data/spec/support/logs/Scheduler - 1520663-17447.log +0 -4
  138. data/spec/support/logs/Scheduler - 1520671-38282.log +0 -6
  139. data/spec/support/logs/Scheduler - 1520703-33082.log +0 -1
  140. data/spec/support/logs/Scheduler - 1520706-22309.log +0 -1
  141. data/spec/support/logs/Scheduler - 1520709-1816.log +0 -1
  142. data/spec/support/logs/Scheduler - 1520711-19998.log +0 -1
  143. data/spec/support/logs/Scheduler - 1520714-47570.log +0 -1
  144. data/spec/support/logs/Scheduler - 1520723-18521.log +0 -1
  145. data/spec/support/logs/Scheduler - 1520725-40913.log +0 -3
  146. data/spec/support/logs/Scheduler - 1520749-45742.log +0 -6
  147. data/spec/support/logs/Scheduler - 1520759-44350.log +0 -4
  148. data/spec/support/logs/Scheduler - 1520770-53219.log +0 -1
  149. data/spec/support/logs/Scheduler - 1520773-54792.log +0 -1
  150. data/spec/support/logs/Scheduler - 1520777-19636.log +0 -1
  151. data/spec/support/logs/Scheduler - 1520780-51801.log +0 -1
  152. data/spec/support/logs/Scheduler - 1520782-9652.log +0 -3
  153. data/spec/support/logs/Scheduler - 1520786-59472.log +0 -1
  154. data/spec/support/logs/Scheduler - 1520789-1603.log +0 -1
  155. data/spec/support/logs/Scheduler - 1520792-35476.log +0 -1
  156. data/spec/support/logs/Scheduler - 1521410-47324.log +0 -16
  157. data/spec/support/logs/Scheduler - 1521422-33737.log +0 -6
  158. data/spec/support/logs/Scheduler - 1521433-36637.log +0 -6
  159. data/spec/support/logs/Scheduler - 1521440-15066.log +0 -6
  160. data/spec/support/logs/Scheduler - 1521456-48637.log +0 -3
  161. data/spec/support/logs/Scheduler - 1521472-54425.log +0 -5
  162. data/spec/support/logs/Scheduler - 1521496-12923.log +0 -1
  163. data/spec/support/logs/Scheduler - 1521518-46819.log +0 -1
  164. data/spec/support/logs/Scheduler - 1521522-21417.log +0 -1
  165. data/spec/support/logs/Scheduler - 1521525-35088.log +0 -1
  166. data/spec/support/logs/Scheduler - 1521528-13676.log +0 -1
  167. data/spec/support/logs/Scheduler - 1521530-48176.log +0 -1
  168. data/spec/support/logs/Scheduler - 1521532-13207.log +0 -1
  169. data/spec/support/logs/Scheduler - 1521535-5799.log +0 -3
  170. data/spec/support/logs/Scheduler - 1521543-62784.log +0 -3
  171. data/spec/support/logs/Scheduler - 1521551-10263.log +0 -3
  172. data/spec/support/logs/Scheduler - 1521556-56026.log +0 -3
  173. data/spec/support/logs/Scheduler - 1521560-14551.log +0 -4
  174. data/spec/support/logs/Scheduler - 1521573-47584.log +0 -1
  175. data/spec/support/logs/Scheduler - 1521578-14443.log +0 -4
  176. data/spec/support/logs/Scheduler - 1521580-60337.log +0 -1
  177. data/spec/support/logs/Scheduler - 1521583-52039.log +0 -1
  178. data/spec/support/logs/Scheduler - 1521586-1500.log +0 -16
  179. data/spec/support/logs/Scheduler - 1521598-61298.log +0 -4
  180. data/spec/support/logs/Scheduler - 1521602-61490.log +0 -1
  181. data/spec/support/logs/Scheduler - 1521604-29209.log +0 -1
  182. data/spec/support/logs/Scheduler - 1521606-47734.log +0 -1
  183. data/spec/support/logs/Scheduler - 1521612-63269.log +0 -1
  184. data/spec/support/logs/Scheduler - 1521614-47018.log +0 -3
  185. data/spec/support/logs/Scheduler - 1521619-32411.log +0 -1
  186. data/spec/support/logs/Scheduler - 1521621-42861.log +0 -1
  187. data/spec/support/logs/Scheduler - 1521623-56258.log +0 -1
  188. data/spec/support/logs/Scheduler - 1521627-9487.log +0 -1
  189. data/spec/support/logs/Scheduler - 1521630-3345.log +0 -1
  190. data/spec/support/logs/Scheduler - 1521632-47325.log +0 -1
  191. data/spec/support/logs/Scheduler - 1521635-22156.log +0 -2
  192. data/spec/support/logs/error-1520329.log +0 -797
  193. data/spec/support/logs/output_spec_1520329.log +0 -390
  194. data/spec/support/reports/003bed585153336c2548d1c60a026a3e.crf +0 -0
  195. data/spec/support/reports/30e3c7a8c13e9b40a0a443a5e5a4ff94.crf +0 -0
  196. data/spec/support/reports/31655751a9f0eee91e588bc796985b1e.crf +0 -0
  197. data/spec/support/reports/40801b7993c0ed919b73242a9c078dde.crf +0 -0
  198. data/spec/support/reports/4719b89667e92bb80102f4b0bb4c0c75.crf +0 -0
  199. data/spec/support/reports/4e765a3d2870d2763ea72167bd3db9d6.crf +0 -0
  200. data/spec/support/reports/61968f732d8ae715c104175e43679915.crf +0 -0
  201. data/spec/support/reports/63446a8ec637d9991b8c6a1151ae59a9.crf +0 -0
  202. data/spec/support/reports/737144b18305c7a115ad7964b9bbe41c.crf +0 -0
  203. data/spec/support/reports/73fe5f7adf905045c3fe4669bdf60d02.crf +0 -0
  204. data/spec/support/reports/86cd396db9ef97472876f32e57c44ce7.crf +0 -0
  205. data/spec/support/reports/8a031ac2b2730dfd07a1d1ca870299f2.crf +0 -0
  206. data/spec/support/reports/8e16ac74484ee5d8cf7073fe22adf787.crf +0 -0
  207. data/spec/support/reports/8eff857213ab6ff712a0b0e8582855c9.crf +0 -0
  208. data/spec/support/reports/9e0e6ed8718973b3d4e63bbb7dd1d1c6.crf +0 -0
  209. data/spec/support/reports/a9c88f967d09cb9c4e8e1180cfb24828.crf +0 -0
  210. data/spec/support/reports/ba32970a64686e45ec8caa5032f65c2e.crf +0 -0
  211. data/spec/support/reports/cceb7596659fd619ab4438953cbda78b.crf +0 -0
  212. data/spec/support/reports/d2e0f4558b605ffd1215e9226815b951.crf +0 -0
  213. data/spec/support/snapshots/Cuboid 2022-01-24 14_38_16 +0200 8238609e31cedaf1bcb89205f9d42121.csf +0 -0
  214. data/spec/support/snapshots/Cuboid 2022-01-24 14_38_30 +0200 68690b002e79c7bc9e3aabfcbc7ac5a7.csf +0 -0
  215. data/spec/support/snapshots/Cuboid 2022-01-24 14_46_39 +0200 6fd3c9491d3e784e18f9c3c0d9deddec.csf +0 -0
  216. data/spec/support/snapshots/Cuboid 2022-01-24 14_46_44 +0200 c3a012fba59210bc7c169afb0565d5a8.csf +0 -0
  217. data/spec/support/snapshots/Cuboid 2022-01-24 14_46_46 +0200 e4c1ce35d8e62e6a16f84eccd36b2283.csf +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b01651b87b7bf659764002cbb1aaa3b8293caf047f9675874b7393dd36c54ced
4
- data.tar.gz: 0b831b738a29e23eecdb949e17079294eb75b57cc902395ec54021cd2d923bee
3
+ metadata.gz: 710475f0dbd6f248872b6772e83856011d8c8fc59e157d61832b072c56bd33bc
4
+ data.tar.gz: e2c2f7e6beaceffdc163ad1feb59bbbe59471f9789f092fbe1033827f0c0c35f
5
5
  SHA512:
6
- metadata.gz: 4aaca66ce49f16888f68e39d84c4d2d9e3f81b7cc8551b31ee6f74505d0c379a6aa92443e698724da65babd8d32c3f9cc5695c272cca4d5d0c2e4d9637d50f6a
7
- data.tar.gz: 258a9295ef9d4765ef9f8cc9ff60ec53e2ee2b11cb342069db7574853ce7db8c1bceb242c80012170a52bba8b9e8f1a489d7969b150e0be15135aa70a0ba15b6
6
+ metadata.gz: 914ec2ab3b83c6271ca0ea4af8a863dd96de24d4ebb5dc7b9b8151c28a7a89a757acaaffed5f4b7f6066fa53d66c567e84e82799aee4033ed3ad98d57814e226
7
+ data.tar.gz: 4fa2db1af048c789ebd1778ca854ce7bb86a3a8ea98b24618e1da6fdd56f3204fc1cb693d41ca0a05c3ad4a7d83c7777fc7ca641da33e37166b9c1fbdfcd085c
data/CHANGELOG.md CHANGED
@@ -0,0 +1,5 @@
1
+ # 0.1.0
2
+
3
+ * `Dispatcher` => `Agent`
4
+ * `Dispatcher#dispatch` => `Agent#spawn`
5
+ * `neighbour` => `peer`
data/README.md CHANGED
@@ -10,8 +10,8 @@ _Cloud_ within a _Cloud_.
10
10
 
11
11
  It offers:
12
12
 
13
- * Load-balancing of _**Instances**_ via a software mesh network (_**Grid**_) of _**Dispatchers**_.
14
- * No need to setup a topology manually, _**Dispatchers**_ will reach
13
+ * Load-balancing of _**Instances**_ via a network (_**Grid**_) of _**Agents**_.
14
+ * No need to setup a topology manually, _**Agents**_ will reach
15
15
  convergence on their own, just point them to an existing _**Grid**_ member.
16
16
  * Scaling up and down can be easily achieved by _plugging_ or _unplugging_ nodes.
17
17
  * Horizontal (`default`) and vertical workload distribution strategies available.
@@ -58,7 +58,7 @@ framework:
58
58
  * `:restore`
59
59
  * `instance_service_for( Symbol, Class )` -- Adds a custom _**Instance**_ RPC API.
60
60
  * `rest_service_for( Symbol, Module )` -- Hooks-up to the _**REST**_ service to provide a custom REST API.
61
- * `dispatcher_service_for( Symbol, Class )` -- Hooks-up to the _**Dispatcher**_ to provide a custom RPC API.
61
+ * `agent_service_for( Symbol, Class )` -- Hooks-up to the _**Agent**_ to provide a custom RPC API.
62
62
  * `serialize_with( Module )` -- A serializer to be used for:
63
63
  * `#options`
64
64
  * `Report#data`
@@ -84,10 +84,10 @@ This is in order to enforce isolation (_state_, _data_, _fault_) between
84
84
  _**Applications**_, take advantage of _OS_ task management and generally keep
85
85
  things simple.
86
86
 
87
- ### Dispatcher
87
+ ### Agent
88
88
 
89
- A _**Dispatcher**_ is a server which awaits for _**Instance**_ spawn requests
90
- (`dispatch` calls) upon which it spawns and passes the _**Instance**_'s
89
+ A _**Agent**_ is a server which awaits for _**Instance**_ spawn requests
90
+ (`spawn` calls) upon which it spawns and passes the _**Instance**_'s
91
91
  connection info to the client.
92
92
 
93
93
  The client can then proceed to use the _**Instance**_ to run and generally manage
@@ -95,7 +95,7 @@ the contained _**Application**_.
95
95
 
96
96
  #### Grid
97
97
 
98
- A _**Dispatcher**_ _**Grid**_ is a software mesh network of _**Dispatcher**_
98
+ A _**Agent**_ _**Grid**_ is a software mesh network of _**Agent**_
99
99
  servers, aimed towards providing automated _load-balancing_ based on available
100
100
  system resources and each _**Application**_'s provisioning configuration.
101
101
 
@@ -104,11 +104,11 @@ providing any existing _**Grid**_ member upon start-up and the rest will be
104
104
  sorted out automatically.
105
105
 
106
106
  The network is _self-healing_ and will monitor _node_ connectivity, taking steps
107
- to ensure that neither server nor network conditions will disrupt dispatching.
107
+ to ensure that neither server nor network conditions will disrupt spawning.
108
108
 
109
109
  ##### Scalability
110
110
 
111
- _**Dispatchers**_ can be easily _plugged_ to or _unplugged_ from the _**Grid**_
111
+ _**Agents**_ can be easily _plugged_ to or _unplugged_ from the _**Grid**_
112
112
  to scale up or down as necessary.
113
113
 
114
114
  _Plugging_ happens at boot-time and _unplugging_ can take place via the available
@@ -125,12 +125,12 @@ The _**Scheduler**_ is a server which:
125
125
  5. Upon _**Application**_ completion stores report to disk.
126
126
  6. Shuts down the _**Instance**_.
127
127
 
128
- #### Dispatcher
128
+ #### Agent
129
129
 
130
- The _**Scheduler**_ can be configured with a _**Dispatcher**_, upon which case,
130
+ The _**Scheduler**_ can be configured with a _**Agent**_, upon which case,
131
131
  it will use it to spawn _**Instances**_.
132
132
 
133
- If the _**Dispatcher**_ is a _**Grid**_ member then the _**Scheduler**_ will
133
+ If the _**Agent**_ is a _**Grid**_ member then the _**Scheduler**_ will
134
134
  also enjoy _load-balancing_ features.
135
135
 
136
136
  ## APIs
@@ -154,7 +154,7 @@ RPC interface.
154
154
  A REST API is also available, taking advantage of HTTP sessions to make progress
155
155
  tracking easier.
156
156
 
157
- The REST interface is basically a web _**Dispatcher**_ and centralised point of
157
+ The REST interface is basically a web _**Agent**_ and centralised point of
158
158
  management for the rest of the entities.
159
159
 
160
160
  Each _**Application**_ can extend upon this and expose an API via its _**REST**_
@@ -103,15 +103,15 @@ class Application
103
103
  @max_memory ||= 0
104
104
  end
105
105
 
106
- def provision_disk( ram )
107
- @max_disk = ram
106
+ def provision_disk( disk )
107
+ @max_disk = disk
108
108
  end
109
109
 
110
110
  def max_disk
111
- @max_memory ||= 0
111
+ @max_disk ||= 0
112
112
  end
113
113
 
114
- def instance_service_for(name, service )
114
+ def instance_service_for( name, service )
115
115
  instance_services[name] = service
116
116
  end
117
117
 
@@ -127,12 +127,12 @@ class Application
127
127
  @rest_services ||= {}
128
128
  end
129
129
 
130
- def dispatcher_service_for( name, service )
131
- dispatcher_services[name] = service
130
+ def agent_service_for( name, service )
131
+ agent_services[name] = service
132
132
  end
133
133
 
134
- def dispatcher_services
135
- @dispatcher_services ||= {}
134
+ def agent_services
135
+ @agent_services ||= {}
136
136
  end
137
137
 
138
138
  def handler_for( signal, handler )
@@ -183,8 +183,8 @@ class Application
183
183
  case type
184
184
  when :instance
185
185
  const = :Instances
186
- when :dispatcher
187
- const = :Dispatchers
186
+ when :agent
187
+ const = :Agents
188
188
  when :scheduler
189
189
  const = :Schedulers
190
190
  when :rest
@@ -1,14 +1,14 @@
1
1
  module Cuboid::OptionGroups
2
2
 
3
- # Holds options for {RPC::Server::Dispatcher} servers.
3
+ # Holds options for {RPC::Server::Agent} servers.
4
4
  #
5
5
  # @author Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
6
- class Dispatcher < Cuboid::OptionGroup
6
+ class Agent < Cuboid::OptionGroup
7
7
 
8
8
  STRATEGIES = Set.new([:horizontal, :vertical])
9
9
 
10
10
  # @return [String]
11
- # URL of a {RPC::Server::Dispatcher}.
11
+ # URL of a {RPC::Server::Agent}.
12
12
  attr_accessor :url
13
13
 
14
14
  # @return [Array<Integer>]
@@ -17,18 +17,18 @@ class Dispatcher < Cuboid::OptionGroup
17
17
  attr_accessor :instance_port_range
18
18
 
19
19
  # @return [String]
20
- # The URL of a neighbouring {RPC::Server::Dispatcher}, applicable when
21
- # {RPC::Server::Dispatcher} are connected to each other to form a Grid.
20
+ # The URL of a peering {RPC::Server::Agent}, applicable when
21
+ # {RPC::Server::Agent} are connected to each other to form a Grid.
22
22
  #
23
- # @see RPC::Server::Dispatcher::Node
24
- attr_accessor :neighbour
23
+ # @see RPC::Server::Agent::Node
24
+ attr_accessor :peer
25
25
 
26
26
  # @return [Float]
27
- # How regularly to check for neighbour statuses.
27
+ # How regularly to check for peer statuses.
28
28
  attr_accessor :ping_interval
29
29
 
30
30
  # @return [String]
31
- # Dispatcher name.
31
+ # Agent name.
32
32
  attr_accessor :name
33
33
 
34
34
  attr_accessor :strategy
@@ -70,7 +70,7 @@ class Paths < Cuboid::OptionGroup
70
70
 
71
71
  # @!attribute executables
72
72
  # @return [String]
73
- # System processes (instance, dispatcher, browser, etc.).
73
+ # System processes (instance, agent, browser, etc.).
74
74
 
75
75
  def initialize
76
76
  @root = self.root_path
@@ -76,7 +76,7 @@ class Options
76
76
  require_relative 'option_groups'
77
77
 
78
78
  TO_RPC_IGNORE = Set.new([
79
- :instance, :rpc, :dispatcher, :queue, :paths,
79
+ :instance, :rpc, :agent, :queue, :paths,
80
80
  :snapshot, :report, :output, :system
81
81
  ])
82
82
 
@@ -2,28 +2,28 @@ module Cuboid
2
2
  module Processes
3
3
 
4
4
  #
5
- # Helper for managing {RPC::Server::Dispatcher} processes.
5
+ # Helper for managing {RPC::Server::Agent} processes.
6
6
  #
7
7
  # @author Tasos "Zapotek" Laskos <tasos.laskos@gmail.com>
8
8
  #
9
- class Dispatchers
9
+ class Agents
10
10
  include Singleton
11
11
  include Utilities
12
12
 
13
- # @return [Array<String>] URLs of all running Dispatchers.
13
+ # @return [Array<String>] URLs of all running Agents.
14
14
  attr_reader :list
15
15
 
16
16
  def initialize
17
17
  @list = []
18
- @dispatcher_connections = {}
18
+ @agent_connections = {}
19
19
  end
20
20
 
21
- # Connects to a Dispatcher by URL.
21
+ # Connects to a Agent by URL.
22
22
  #
23
- # @param [String] url URL of the Dispatcher.
23
+ # @param [String] url URL of the Agent.
24
24
  # @param [Hash] options Options for the RPC client.
25
25
  #
26
- # @return [RPC::Client::Dispatcher]
26
+ # @return [RPC::Client::Agent]
27
27
  def connect( url, options = nil )
28
28
  Arachni::Reactor.global.run_in_thread if !Arachni::Reactor.global.running?
29
29
 
@@ -33,26 +33,26 @@ class Dispatchers
33
33
  end
34
34
 
35
35
  if fresh
36
- @dispatcher_connections[url] = RPC::Client::Dispatcher.new( url, options )
36
+ @agent_connections[url] = RPC::Client::Agent.new( url, options )
37
37
  else
38
- @dispatcher_connections[url] ||= RPC::Client::Dispatcher.new( url, options )
38
+ @agent_connections[url] ||= RPC::Client::Agent.new( url, options )
39
39
  end
40
40
  end
41
41
 
42
- # @param [Block] block Block to pass an RPC client for each Dispatcher.
42
+ # @param [Block] block Block to pass an RPC client for each Agent.
43
43
  def each( &block )
44
44
  @list.each do |url|
45
45
  block.call connect( url )
46
46
  end
47
47
  end
48
48
 
49
- # Spawns a {RPC::Server::Dispatcher} process.
49
+ # Spawns a {RPC::Server::Agent} process.
50
50
  #
51
51
  # @param [Hash] options
52
52
  # To be passed to {Cuboid::Options#set}. Allows `address` instead of
53
53
  # `rpc_server_address` and `port` instead of `rpc_port`.
54
54
  #
55
- # @return [RPC::Client::Dispatcher]
55
+ # @return [RPC::Client::Agent]
56
56
  def spawn( options = {} )
57
57
  options = options.dup
58
58
  fork = options.delete(:fork)
@@ -63,9 +63,9 @@ class Dispatchers
63
63
  }
64
64
 
65
65
  options = {
66
- dispatcher: {
66
+ agent: {
67
67
  name: options[:name],
68
- neighbour: options[:neighbour],
68
+ peer: options[:peer],
69
69
  strategy: options[:strategy],
70
70
  },
71
71
  rpc: {
@@ -88,11 +88,11 @@ class Dispatchers
88
88
  options[:rpc].delete :server_external_address
89
89
  end
90
90
 
91
- if options[:dispatcher][:neighbour].nil?
92
- options[:dispatcher].delete :neighbour
91
+ if options[:agent][:peer].nil?
92
+ options[:agent].delete :peer
93
93
  end
94
94
 
95
- pid = Manager.spawn( :dispatcher, options: options, fork: fork )
95
+ pid = Manager.spawn( :agent, options: options, fork: fork )
96
96
 
97
97
  url = "#{options[:rpc][:server_address]}:#{options[:rpc][:server_port]}"
98
98
  while sleep( 0.1 )
@@ -110,26 +110,26 @@ class Dispatchers
110
110
 
111
111
  def grid_spawn( options = {} )
112
112
  d = spawn( options )
113
- spawn( options.merge neighbour: d.url )
113
+ spawn( options.merge peer: d.url )
114
114
  end
115
115
 
116
- # @note Will also kill all Instances started by the Dispatcher.
116
+ # @note Will also kill all Instances started by the Agent.
117
117
  #
118
- # @param [String] url URL of the Dispatcher to kill.
118
+ # @param [String] url URL of the Agent to kill.
119
119
  def kill( url )
120
- dispatcher = connect( url )
121
- Manager.kill_many dispatcher.statistics['consumed_pids']
122
- Manager.kill dispatcher.pid
120
+ agent = connect( url )
121
+ Manager.kill_many agent.statistics['consumed_pids']
122
+ Manager.kill agent.pid
123
123
  rescue => e
124
124
  #ap e
125
125
  #ap e.backtrace
126
126
  nil
127
127
  ensure
128
128
  @list.delete( url )
129
- @dispatcher_connections.delete( url )
129
+ @agent_connections.delete( url )
130
130
  end
131
131
 
132
- # Kills all {Dispatchers #list}.
132
+ # Kills all {Agents #list}.
133
133
  def killall
134
134
  @list.dup.each do |url|
135
135
  kill url
@@ -0,0 +1,5 @@
1
+ require Options.paths.lib + 'rpc/server/agent'
2
+
3
+ Arachni::Reactor.global.run do
4
+ RPC::Server::Agent.new
5
+ end
@@ -0,0 +1,23 @@
1
+ # @param (see Cuboid::Processes::Agents#spawn)
2
+ # @return (see Cuboid::Processes::Agents#spawn)
3
+ def agent_spawn( *args )
4
+ Cuboid::Processes::Agents.spawn( *args )
5
+ end
6
+
7
+ # @param (see Cuboid::Processes::Agents#kill)
8
+ # @return (see Cuboid::Processes::Agents#kill)
9
+ def agent_kill( *args )
10
+ Cuboid::Processes::Agents.kill( *args )
11
+ end
12
+
13
+ # @param (see Cuboid::Processes::Agents#killall)
14
+ # @return (see Cuboid::Processes::Agents#killall)
15
+ def agent_killall
16
+ Cuboid::Processes::Agents.killall
17
+ end
18
+
19
+ # @param (see Cuboid::Processes::Agents#connect)
20
+ # @return (see Cuboid::Processes::Agents#connect)
21
+ def agent_connect( *args )
22
+ Cuboid::Processes::Agents.connect( *args )
23
+ end
@@ -10,10 +10,10 @@ def instance_grid_spawn( *args )
10
10
  Cuboid::Processes::Instances.grid_spawn( *args )
11
11
  end
12
12
 
13
- # @param (see Cuboid::Processes::Instances#dispatcher_spawn)
14
- # @return (see Cuboid::Processes::Instances#dispatcher_spawn)
15
- def instance_dispatcher_spawn( *args )
16
- Cuboid::Processes::Instances.dispatcher.spawn( *args )
13
+ # @param (see Cuboid::Processes::Instances#agent_spawn)
14
+ # @return (see Cuboid::Processes::Instances#agent_spawn)
15
+ def instance_agent_spawn( *args )
16
+ Cuboid::Processes::Instances.agent.spawn( *args )
17
17
  end
18
18
 
19
19
  def instance_kill( url )
@@ -1,4 +1,4 @@
1
1
  require_relative 'helpers/processes'
2
- require_relative 'helpers/dispatchers'
2
+ require_relative 'helpers/agents'
3
3
  require_relative 'helpers/instances'
4
4
  require_relative 'helpers/schedulers'
@@ -21,7 +21,7 @@ class Instances
21
21
  #
22
22
  # Connects to a Instance by URL.
23
23
  #
24
- # @param [String] url URL of the Dispatcher.
24
+ # @param [String] url URL of the Agent.
25
25
  # @param [String] token
26
26
  # Authentication token -- only need be provided once.
27
27
  #
@@ -125,10 +125,10 @@ class Instances
125
125
  end
126
126
  end
127
127
 
128
- # Starts {RPC::Server::Dispatcher} grid and returns a high-performance Instance.
128
+ # Starts {RPC::Server::Agent} grid and returns a high-performance Instance.
129
129
  #
130
130
  # @param [Hash] options
131
- # @option options [Integer] :grid_size (3) Amount of Dispatchers to spawn.
131
+ # @option options [Integer] :grid_size (3) Amount of Agents to spawn.
132
132
  #
133
133
  # @return [RPC::Client::Instance]
134
134
  def grid_spawn(options = {} )
@@ -136,23 +136,23 @@ class Instances
136
136
 
137
137
  last_member = nil
138
138
  options[:grid_size].times do |i|
139
- last_member = Dispatchers.spawn(
140
- neighbour: last_member ? last_member.url : last_member,
139
+ last_member = Agents.spawn(
140
+ peer: last_member ? last_member.url : last_member,
141
141
  pipe_id: Utilities.available_port.to_s + Utilities.available_port.to_s
142
142
  )
143
143
  end
144
144
 
145
145
  info = nil
146
- info = last_member.dispatch while !info && sleep( 0.1 )
146
+ info = last_member.spawn while !info && sleep( 0.1 )
147
147
 
148
148
  connect( info['url'], info['token'] )
149
149
  end
150
150
 
151
- # Starts {RPC::Server::Dispatcher} and returns an Instance.
151
+ # Starts {RPC::Server::Agent} and returns an Instance.
152
152
  #
153
153
  # @return [RPC::Client::Instance]
154
- def dispatcher_spawn
155
- info = Dispatchers.spawn.dispatch
154
+ def agent_spawn
155
+ info = Agents.spawn.spawn
156
156
  connect( info['url'], info['token'] )
157
157
  end
158
158
 
@@ -61,8 +61,8 @@ class Schedulers
61
61
  }
62
62
 
63
63
  options = {
64
- dispatcher: {
65
- url: options[:dispatcher],
64
+ agent: {
65
+ url: options[:agent],
66
66
  strategy: options[:strategy]
67
67
  },
68
68
  rpc: {
@@ -3,11 +3,11 @@ require 'ostruct'
3
3
 
4
4
  lib = Cuboid::Options.paths.lib
5
5
  require lib + 'rpc/client/instance'
6
- require lib + 'rpc/client/dispatcher'
6
+ require lib + 'rpc/client/agent'
7
7
  require lib + 'rpc/client/scheduler'
8
8
 
9
9
  lib = Cuboid::Options.paths.lib + 'processes/'
10
10
  require lib + 'manager'
11
- require lib + 'dispatchers'
11
+ require lib + 'agents'
12
12
  require lib + 'instances'
13
13
  require lib + 'schedulers'
@@ -5,10 +5,10 @@ class Server
5
5
  module InstanceHelpers
6
6
 
7
7
  @@instances = {}
8
- @@dispatchers = {}
8
+ @@agents = {}
9
9
 
10
10
  def get_instance
11
- if dispatcher
11
+ if agent
12
12
  options = {
13
13
  owner: self.class.to_s,
14
14
  helpers: {
@@ -18,7 +18,7 @@ module InstanceHelpers
18
18
  }
19
19
  }
20
20
 
21
- if (info = dispatcher.dispatch( options ))
21
+ if (info = agent.spawn( options ))
22
22
  connect_to_instance( info['url'], info['token'] )
23
23
  end
24
24
  else
@@ -26,24 +26,24 @@ module InstanceHelpers
26
26
  end
27
27
  end
28
28
 
29
- def dispatchers
30
- @@dispatchers.keys
29
+ def agents
30
+ @@agents.keys
31
31
  end
32
32
 
33
- def dispatcher
34
- return if !Options.dispatcher.url
35
- @dispatcher ||= connect_to_dispatcher( Options.dispatcher.url )
33
+ def agent
34
+ return if !Options.agent.url
35
+ @agent ||= connect_to_agent( Options.agent.url )
36
36
  end
37
37
 
38
- def unplug_dispatcher( url )
39
- connect_to_dispatcher( url ).node.unplug
38
+ def unplug_agent( url )
39
+ connect_to_agent( url ).node.unplug
40
40
 
41
- c = @@dispatchers.delete( url )
41
+ c = @@agents.delete( url )
42
42
  c.close if c
43
43
  end
44
44
 
45
- def connect_to_dispatcher( url )
46
- @@dispatchers[url] ||= RPC::Client::Dispatcher.new( url )
45
+ def connect_to_agent( url )
46
+ @@agents[url] ||= RPC::Client::Agent.new( url )
47
47
  end
48
48
 
49
49
  def connect_to_instance( url, token )
@@ -3,32 +3,32 @@ module Rest
3
3
  class Server
4
4
  module Routes
5
5
 
6
- module Dispatcher
6
+ module Agent
7
7
 
8
8
  def self.registered( app )
9
9
 
10
- app.get '/dispatcher/url' do
11
- ensure_dispatcher!
10
+ app.get '/agent/url' do
11
+ ensure_agent!
12
12
 
13
- json Options.dispatcher.url
13
+ json Options.agent.url
14
14
  end
15
15
 
16
- app.put '/dispatcher/url' do
16
+ app.put '/agent/url' do
17
17
  url = ::JSON.load( request.body.read ) || {}
18
18
 
19
19
  handle_error do
20
- connect_to_dispatcher( url ).alive?
20
+ connect_to_agent( url ).alive?
21
21
 
22
- @dispatcher = nil
23
- Options.dispatcher.url = url
22
+ @agent = nil
23
+ Options.agent.url = url
24
24
  json nil
25
25
  end
26
26
  end
27
27
 
28
- app.delete '/dispatcher/url' do
29
- ensure_dispatcher!
28
+ app.delete '/agent/url' do
29
+ ensure_agent!
30
30
 
31
- json @dispatcher = Options.dispatcher.url = nil
31
+ json @agent = Options.agent.url = nil
32
32
  end
33
33
 
34
34
  end
@@ -8,24 +8,24 @@ module Grid
8
8
  def self.registered( app )
9
9
 
10
10
  app.get '/grid' do
11
- ensure_dispatcher!
11
+ ensure_agent!
12
12
 
13
13
  handle_error do
14
- json [Options.dispatcher.url] + dispatcher.statistics['node']['neighbours']
14
+ json [Options.agent.url] + agent.statistics['node']['peers']
15
15
  end
16
16
  end
17
17
 
18
- app.get '/grid/:dispatcher' do |url|
19
- ensure_dispatcher!
18
+ app.get '/grid/:agent' do |url|
19
+ ensure_agent!
20
20
 
21
- handle_error { json connect_to_dispatcher( url ).statistics }
21
+ handle_error { json connect_to_agent( url ).statistics }
22
22
  end
23
23
 
24
- app.delete '/grid/:dispatcher' do |url|
25
- ensure_dispatcher!
24
+ app.delete '/grid/:agent' do |url|
25
+ ensure_agent!
26
26
 
27
27
  handle_error do
28
- unplug_dispatcher( url )
28
+ unplug_agent( url )
29
29
  end
30
30
 
31
31
  json nil
@@ -16,7 +16,7 @@ module Instances
16
16
 
17
17
  # Create
18
18
  app.post '/instances' do
19
- max_utilization! if !dispatcher && System.max_utilization?
19
+ max_utilization! if !agent && System.max_utilization?
20
20
 
21
21
  options = ::JSON.load( request.body.read ) || {}
22
22
 
@@ -23,7 +23,7 @@ class Server < Sinatra::Base
23
23
  end
24
24
 
25
25
  register Routes::Instances
26
- register Routes::Dispatcher
26
+ register Routes::Agent
27
27
  register Routes::Grid
28
28
  register Routes::Scheduler
29
29
 
@@ -81,9 +81,9 @@ class Server < Sinatra::Base
81
81
  halt 404, json( "Scan not found for id: #{h id}." )
82
82
  end
83
83
 
84
- def ensure_dispatcher!
85
- return if dispatcher
86
- halt 501, json( 'No Dispatcher has been set.' )
84
+ def ensure_agent!
85
+ return if agent
86
+ halt 501, json( 'No Agent has been set.' )
87
87
  end
88
88
 
89
89
  def ensure_scheduler!
@@ -114,7 +114,7 @@ class Server < Sinatra::Base
114
114
 
115
115
  def reset
116
116
  @@instances.clear
117
- @@dispatchers.clear
117
+ @@agents.clear
118
118
  end
119
119
 
120
120
  def run!( options )