diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2022-12-04 22:03:18 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-04 22:03:18 +0000 |
| commit | b88f07ebb056293b1a29f24e4f42203c09bcbcf8 (patch) | |
| tree | 52e2de58503714cc6510db614b4a654af2fdda3c /opendc-experiments/opendc-experiments-compute | |
| parent | 2ca72c0b62e08efd244eba1723bc4fc65d30eed2 (diff) | |
| parent | 4dfae28c5bd656806a7baf7855c95770f4ad0ed8 (diff) | |
merge: Clean up compute service (v1)
This pull request is one in a series of changes that attempt to clean up the
warts of the OpenDC Compute Service. These changes should make the
API more robust for future developments.
## Implementation Notes :hammer_and_pick:
* Do not suspend in compute API
* Expose state directly to clients
* Do not split interface and implementation
## External Dependencies :four_leaf_clover:
* N/A
## Breaking API Changes :warning:
* The methods of `ComputeClient` do not have the suspend modifier anymore.
* Changes to the classes of `ComputeClient` are now immediately visible on the server side.
It is not necessary to call `refresh` anymore.
* `ComputeService` must be constructed via its builder class now.
Diffstat (limited to 'opendc-experiments/opendc-experiments-compute')
| -rw-r--r-- | opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeServiceProvisioningStep.kt | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeServiceProvisioningStep.kt b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeServiceProvisioningStep.kt index d7347327..4470c418 100644 --- a/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeServiceProvisioningStep.kt +++ b/opendc-experiments/opendc-experiments-compute/src/main/kotlin/org/opendc/experiments/compute/ComputeServiceProvisioningStep.kt @@ -41,7 +41,9 @@ public class ComputeServiceProvisioningStep internal constructor( private val schedulingQuantum: Duration ) : ProvisioningStep { override fun apply(ctx: ProvisioningContext): AutoCloseable { - val service = ComputeService(ctx.dispatcher, scheduler(ctx), schedulingQuantum) + val service = ComputeService.builder(ctx.dispatcher, scheduler(ctx)) + .withQuantum(schedulingQuantum) + .build() ctx.registry.register(serviceDomain, ComputeService::class.java, service) return AutoCloseable { service.close() } |
