@@ -67,12 +67,6 @@ Manages devices that have an Artemis service running on them.
6767*/
6868class Broker :
6969 fleet-id / Uuid
70- /**
71- The $Scope to use when talking to this broker.
72-
73- Carried over from the fleet file's per-server scope entry.
74- */
75- scope / Scope
7670 server-config / ServerConfig
7771 cli_ / Cli
7872 network_ / net.Client? := null
@@ -88,7 +82,6 @@ class Broker:
8882
8983 constructor
9084 -- .fleet-id / Uuid
91- -- .scope / Scope
9285 -- .server-config
9386 --cli / Cli
9487 --tmp-directory / string
@@ -137,7 +130,8 @@ class Broker:
137130 return error .contains "duplicate key value" or error .contains "already exists"
138131
139132 /**
140- Uploads the given $pod to the broker for the given $fleet-id under $scope.
133+ Uploads the given $pod to the broker for the given $fleet-id under the
134+ broker's configured scope.
141135
142136 Also uploads the trivial patches.
143137 */
@@ -149,25 +143,25 @@ class Broker:
149143 // Only upload if we don't have it in our cache.
150144 key := cache-key-pod-parts
151145 --broker-config = server-config
152- --scope = scope
146+ --scope = server-config . scope
153147 --part-id = id
154148 cli_ .cache .get-file-path key : | store / FileStore |
155149 broker-connection_ .pod-registry-upload-pod-part contents --part-id = id
156- --scope = scope
150+ --scope = server-config . scope
157151 store .save contents
158152 key := cache-key-pod-manifest
159153 --broker-config = server-config
160- --scope = scope
154+ --scope = server-config . scope
161155 --pod-id = pod .id
162156 cli_ .cache .get-file-path key : | store / FileStore |
163157 encoded := ubjson .encode manifest
164158 broker-connection_ .pod-registry-upload-pod-manifest encoded --pod-id = pod .id
165- --scope = scope
159+ --scope = server-config . scope
166160 store .save encoded
167161
168162 description-ids := broker-connection_ .pod-registry-descriptions
169163 --fleet-id = fleet-id
170- --scope = scope
164+ --scope = server-config . scope
171165 --names = [ pod .name ]
172166 --create-if-absent
173167
@@ -210,7 +204,7 @@ class Broker:
210204 upload-patch_ it
211205
212206 /**
213- Uploads the given $patch to the broker under the configured $scope .
207+ Uploads the given $patch to the broker.
214208 */
215209 upload-patch_ patch / FirmwarePatch :
216210 diff-and-upload_ patch
@@ -223,12 +217,12 @@ class Broker:
223217 trivial-id := id_ --to = patch .to_
224218 cache-key := cache-key-patch
225219 --broker-config = server-config
226- --scope = scope
220+ --scope = server-config . scope
227221 --patch-id = trivial-id
228222 cli_ .cache .get cache-key : | store / FileStore |
229223 trivial := build-trivial-patch patch .bits_
230224 broker-connection_ .upload-firmware trivial
231- --scope = scope
225+ --scope = server-config . scope
232226 --firmware-id = trivial-id
233227 store .save-via-writer : | writer / io .Writer |
234228 trivial .do : writer .write it
@@ -240,12 +234,12 @@ class Broker:
240234 old-id := id_ --to = patch .from_
241235 cache-key = cache-key-patch
242236 --broker-config = server-config
243- --scope = scope
237+ --scope = server-config . scope
244238 --patch-id = old-id
245239 trivial-old := cli_ .cache .get cache-key : | store / FileStore |
246240 downloaded := null
247241 catch : downloaded = broker-connection_ .download-firmware
248- --scope = scope
242+ --scope = server-config . scope
249243 --id = old-id
250244 if not downloaded :
251245 cli_ .ui .emit --warning "Failed to download old firmware for patch $ old-id -> $ trivial-id ."
@@ -269,7 +263,7 @@ class Broker:
269263 diff-id := id_ --from = patch .from_ --to = patch .to_
270264 cache-key = cache-key-patch
271265 --broker-config = server-config
272- --scope = scope
266+ --scope = server-config . scope
273267 --patch-id = diff-id
274268 cli_ .cache .get cache-key : | store / FileStore |
275269 // Build the diff and verify that we can apply it and get the
@@ -284,7 +278,7 @@ class Broker:
284278 to64 := base64 .encode patch .to_ --url-mode
285279 cli_ .ui .emit --info "Uploading patch $ from64 -> $ to64 ($ diff-size )."
286280 broker-connection_ .upload-firmware diff
287- --scope = scope
281+ --scope = server-config . scope
288282 --firmware-id = diff-id
289283 store .save-via-writer : | writer / io .Writer |
290284 diff .do : writer .write it
@@ -307,19 +301,19 @@ class Broker:
307301 is-cached --pod-id / Uuid -> bool :
308302 manifest-key := cache-key-pod-manifest
309303 --broker-config = server-config
310- --scope = scope
304+ --scope = server-config . scope
311305 --pod-id = pod-id
312306 return cli_ .cache .contains manifest-key
313307
314308 download --pod-id / Uuid -> Pod :
315309 manifest-key := cache-key-pod-manifest
316310 --broker-config = server-config
317- --scope = scope
311+ --scope = server-config . scope
318312 --pod-id = pod-id
319313 encoded-manifest := cli_ .cache .get manifest-key : | store / FileStore |
320314 bytes := broker-connection_ .pod-registry-download-pod-manifest
321315 --pod-id = pod-id
322- --scope = scope
316+ --scope = server-config . scope
323317 store .save bytes
324318 manifest := ubjson .decode encoded-manifest
325319 return Pod .from-manifest
@@ -328,12 +322,12 @@ class Broker:
328322 --download =: | part-id / string |
329323 key := cache-key-pod-parts
330324 --broker-config = server-config
331- --scope = scope
325+ --scope = server-config . scope
332326 --part-id = part-id
333327 cli_ .cache .get key : | store / FileStore |
334328 bytes := broker-connection_ .pod-registry-download-pod-part
335329 part-id
336- --scope = scope
330+ --scope = server-config . scope
337331 store .save bytes
338332
339333 list-pods --names / List -> Map :
@@ -343,7 +337,7 @@ class Broker:
343337 else:
344338 descriptions = broker-connection_ .pod-registry-descriptions
345339 --fleet-id = fleet-id
346- --scope = scope
340+ --scope = server-config . scope
347341 --names = names
348342 --no-create-if-absent
349343 result := { : }
@@ -355,7 +349,7 @@ class Broker:
355349 delete --description-names / List :
356350 descriptions := broker-connection_ .pod-registry-descriptions
357351 --fleet-id = fleet-id
358- --scope = scope
352+ --scope = server-config . scope
359353 --names = description-names
360354 --no-create-if-absent
361355 unknown-pod-descriptions := []
@@ -424,7 +418,7 @@ class Broker:
424418
425419 descriptions := broker-connection_ .pod-registry-descriptions
426420 --fleet-id = fleet-id
427- --scope = scope
421+ --scope = server-config . scope
428422 --names = names .to-list
429423 --no-create-if-absent
430424
0 commit comments