diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-10-01 00:23:37 +0200 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2020-10-01 00:23:37 +0200 |
| commit | 0df646c2951e9950f27472fdf0cb2624303c2d74 (patch) | |
| tree | 0e8fed649af780a518afb8e60a7823d212da213f /simulator | |
| parent | fcae560208df4860bc7461f955bf3b522b0e61c5 (diff) | |
Move custom Flows to separate utility module
This change moves the custom Flow object we provide (e.g. EventFlow and
StateFlow) outside of the odcsim-api module into a separate opendc-utils
module.
This is in preparation for the removal of the odcsim components in OpenDC.
Diffstat (limited to 'simulator')
10 files changed, 44 insertions, 13 deletions
diff --git a/simulator/opendc/opendc-compute/build.gradle.kts b/simulator/opendc/opendc-compute/build.gradle.kts index 0e44785e..a8852cba 100644 --- a/simulator/opendc/opendc-compute/build.gradle.kts +++ b/simulator/opendc/opendc-compute/build.gradle.kts @@ -32,6 +32,7 @@ plugins { dependencies { api(project(":odcsim:odcsim-api")) api(project(":opendc:opendc-core")) + implementation(project(":opendc:opendc-utils")) implementation("io.github.microutils:kotlin-logging:1.7.9") testImplementation(project(":opendc:opendc-simulator")) diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt index c118cc3d..0c758e6b 100644 --- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt +++ b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/metal/driver/SimpleBareMetalDriver.kt @@ -24,8 +24,6 @@ package com.atlarge.opendc.compute.metal.driver -import com.atlarge.odcsim.flow.EventFlow -import com.atlarge.odcsim.flow.StateFlow import com.atlarge.opendc.compute.core.Flavor import com.atlarge.opendc.compute.core.MemoryUnit import com.atlarge.opendc.compute.core.ProcessingUnit @@ -57,6 +55,8 @@ import kotlinx.coroutines.intrinsics.startCoroutineCancellable import kotlinx.coroutines.launch import kotlinx.coroutines.selects.SelectClause0 import kotlinx.coroutines.selects.SelectInstance +import org.opendc.utils.flow.EventFlow +import org.opendc.utils.flow.StateFlow import java.lang.Exception import java.time.Clock import java.util.UUID diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt index bd266208..fa172e6e 100644 --- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt +++ b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/driver/SimpleVirtDriver.kt @@ -24,7 +24,6 @@ package com.atlarge.opendc.compute.virt.driver -import com.atlarge.odcsim.flow.EventFlow import com.atlarge.opendc.compute.core.Flavor import com.atlarge.opendc.compute.core.ProcessingUnit import com.atlarge.opendc.compute.core.Server @@ -47,6 +46,7 @@ import kotlinx.coroutines.selects.SelectClause0 import kotlinx.coroutines.selects.SelectInstance import kotlinx.coroutines.selects.select import mu.KotlinLogging +import org.opendc.utils.flow.EventFlow import java.time.Clock import java.util.UUID import kotlin.math.ceil diff --git a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/SimpleVirtProvisioningService.kt b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/SimpleVirtProvisioningService.kt index 6b2cfc40..5e151cbb 100644 --- a/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/SimpleVirtProvisioningService.kt +++ b/simulator/opendc/opendc-compute/src/main/kotlin/com/atlarge/opendc/compute/virt/service/SimpleVirtProvisioningService.kt @@ -1,6 +1,5 @@ package com.atlarge.opendc.compute.virt.service -import com.atlarge.odcsim.flow.EventFlow import com.atlarge.opendc.compute.core.Flavor import com.atlarge.opendc.compute.core.Server import com.atlarge.opendc.compute.core.ServerEvent @@ -19,6 +18,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import mu.KotlinLogging +import org.opendc.utils.flow.EventFlow import java.time.Clock import kotlin.coroutines.Continuation import kotlin.coroutines.resume diff --git a/simulator/opendc/opendc-utils/build.gradle.kts b/simulator/opendc/opendc-utils/build.gradle.kts new file mode 100644 index 00000000..d66148c4 --- /dev/null +++ b/simulator/opendc/opendc-utils/build.gradle.kts @@ -0,0 +1,32 @@ +/* + * Copyright (c) 2020 AtLarge Research + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +description = "Utilities used across OpenDC modules" + +/* Build configuration */ +plugins { + `kotlin-library-convention` +} + +dependencies { + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Library.KOTLINX_COROUTINES}") +} diff --git a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/flow/EventFlow.kt b/simulator/opendc/opendc-utils/src/main/kotlin/org/opendc/utils/flow/EventFlow.kt index 4918a535..948595b1 100644 --- a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/flow/EventFlow.kt +++ b/simulator/opendc/opendc-utils/src/main/kotlin/org/opendc/utils/flow/EventFlow.kt @@ -1,7 +1,5 @@ /* - * MIT License - * - * Copyright (c) 2020 atlarge-research + * Copyright (c) 2020 AtLarge Research * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -22,7 +20,7 @@ * SOFTWARE. */ -package com.atlarge.odcsim.flow +package org.opendc.utils.flow import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.FlowPreview diff --git a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/flow/StateFlow.kt b/simulator/opendc/opendc-utils/src/main/kotlin/org/opendc/utils/flow/StateFlow.kt index 50add0ad..996e7700 100644 --- a/simulator/odcsim/odcsim-api/src/main/kotlin/com/atlarge/odcsim/flow/StateFlow.kt +++ b/simulator/opendc/opendc-utils/src/main/kotlin/org/opendc/utils/flow/StateFlow.kt @@ -1,7 +1,5 @@ /* - * MIT License - * - * Copyright (c) 2020 atlarge-research + * Copyright (c) 2020 AtLarge Research * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -22,7 +20,7 @@ * SOFTWARE. */ -package com.atlarge.odcsim.flow +package org.opendc.utils.flow import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.FlowPreview diff --git a/simulator/opendc/opendc-workflows/build.gradle.kts b/simulator/opendc/opendc-workflows/build.gradle.kts index 62c4bc25..f8a9a1f3 100644 --- a/simulator/opendc/opendc-workflows/build.gradle.kts +++ b/simulator/opendc/opendc-workflows/build.gradle.kts @@ -32,6 +32,7 @@ plugins { dependencies { api(project(":opendc:opendc-core")) api(project(":opendc:opendc-compute")) + implementation(project(":opendc:opendc-utils")) testImplementation(project(":opendc:opendc-simulator")) testImplementation(project(":opendc:opendc-format")) diff --git a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowService.kt b/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowService.kt index aea27972..3a5b963c 100644 --- a/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowService.kt +++ b/simulator/opendc/opendc-workflows/src/main/kotlin/com/atlarge/opendc/workflows/service/StageWorkflowService.kt @@ -24,7 +24,6 @@ package com.atlarge.opendc.workflows.service -import com.atlarge.odcsim.flow.EventFlow import com.atlarge.opendc.compute.core.Server import com.atlarge.opendc.compute.core.ServerEvent import com.atlarge.opendc.compute.core.ServerState @@ -43,6 +42,7 @@ import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch +import org.opendc.utils.flow.EventFlow import java.time.Clock import java.util.PriorityQueue import java.util.Queue diff --git a/simulator/settings.gradle.kts b/simulator/settings.gradle.kts index ccfb68fc..cd7121c0 100644 --- a/simulator/settings.gradle.kts +++ b/simulator/settings.gradle.kts @@ -26,6 +26,7 @@ rootProject.name = "opendc-simulator" include(":odcsim:odcsim-api") include(":odcsim:odcsim-engine-omega") include(":opendc:opendc-simulator") +include(":opendc:opendc-utils") include(":opendc:opendc-core") include(":opendc:opendc-compute") include(":opendc:opendc-format") |
