summaryrefslogtreecommitdiff
path: root/simulator/opendc-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'simulator/opendc-core/src')
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt34
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt40
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt34
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt33
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt46
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/Resource.kt35
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt34
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt45
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistry.kt61
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistryImpl.kt43
-rw-r--r--simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt37
11 files changed, 442 insertions, 0 deletions
diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt
new file mode 100644
index 00000000..a5055cff
--- /dev/null
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Environment.kt
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+package org.opendc.core
+
+/**
+ * A description of a large-scale computing environment. This description includes including key size and topology
+ * information of the environment, types of resources, but also various operational and management rules such as
+ * scheduled maintenance, allocation and other constraints.
+ *
+ * @property name The name of the environment.
+ * @property description A small textual description about the environment that is being modeled.
+ * @property platforms The cloud platforms (such as AWS or GCE) in this environment.
+ */
+public data class Environment(val name: String, val description: String?, val platforms: List<Platform>)
diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt
new file mode 100644
index 00000000..252c40f5
--- /dev/null
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Identity.kt
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package org.opendc.core
+
+import java.util.*
+
+/**
+ * An object that has a unique identity.
+ */
+public interface Identity {
+ /**
+ * A unique, opaque, system-generated value, representing the object.
+ */
+ public val uid: UUID
+
+ /**
+ * A non-empty, human-readable string representing the object.
+ */
+ public val name: String
+}
diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt
new file mode 100644
index 00000000..5550ffed
--- /dev/null
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Platform.kt
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+package org.opendc.core
+
+import java.util.*
+
+/**
+ * A representation of a cloud platform such as Amazon Web Services (AWS), Microsoft Azure or Google Cloud.
+ *
+ * @property uid The unique identifier of this topology.
+ * @property name the name of the platform.
+ * @property zones The availability zones available on this platform.
+ */
+public data class Platform(override val uid: UUID, override val name: String, val zones: List<Zone>) : Identity
diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt
new file mode 100644
index 00000000..fc542cef
--- /dev/null
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/User.kt
@@ -0,0 +1,33 @@
+/*
+ * 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.
+ */
+
+package org.opendc.core
+
+/**
+ * A user of the cloud network.
+ */
+public interface User : Identity {
+ /**
+ * The name of the user.
+ */
+ override val name: String
+}
diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt
new file mode 100644
index 00000000..834f6cf2
--- /dev/null
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/Zone.kt
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+package org.opendc.core
+
+import org.opendc.core.services.ServiceRegistry
+import java.util.*
+
+/**
+ * An isolated location within a topology region from which public cloud services operate, roughly equivalent to a
+ * single topology. Zones contain one or more clusters and secondary storage.
+ *
+ * This class models *only* the static information of a zone, with dynamic information being contained within the zone's
+ * actor. During runtime, it's actor acts as a registry for all the cloud services provided by the zone.
+ *
+ * @property uid The unique identifier of this availability zone.
+ * @property name The name of the zone within its platform.
+ * @property services The service registry containing the services of the zone.
+ */
+public data class Zone(
+ override val uid: UUID,
+ override val name: String,
+ val services: ServiceRegistry
+) : Identity {
+ override fun equals(other: Any?): Boolean = other is Zone && uid == other.uid
+ override fun hashCode(): Int = uid.hashCode()
+}
diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/Resource.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/Resource.kt
new file mode 100644
index 00000000..5bb2c2ce
--- /dev/null
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/Resource.kt
@@ -0,0 +1,35 @@
+/*
+ * 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.
+ */
+
+package org.opendc.core.resource
+
+import org.opendc.core.Identity
+
+/**
+ * Represents a generic cloud resource.
+ */
+public interface Resource : Identity {
+ /**
+ * The tags of this cloud resource.
+ */
+ public val tags: TagContainer
+}
diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt
new file mode 100644
index 00000000..6a4ff102
--- /dev/null
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/resource/TagContainer.kt
@@ -0,0 +1,34 @@
+/*
+ * 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.
+ */
+
+package org.opendc.core.resource
+
+/**
+ * An immutable map containing the tags of some resource.
+ */
+public typealias TagContainer = Map<String, Any>
+
+/**
+ * Obtain the value of the tag with the specified [key] of type [T]. If the tag does not exist or the tag is of
+ * different type, `null` is returned.
+ */
+public inline fun <reified T : Any> TagContainer.typed(key: String): T? = this[key] as? T
diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt
new file mode 100644
index 00000000..9078ecdd
--- /dev/null
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceKey.kt
@@ -0,0 +1,45 @@
+/*
+ * 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.
+ */
+
+package org.opendc.core.services
+
+import org.opendc.core.Identity
+import java.util.*
+
+/**
+ * An interface for identifying service implementations of the same type (providing the same service).
+ *
+ * @param T The shape of the messages the service responds to.
+ */
+public interface ServiceKey<T : Any> : Identity
+
+/**
+ * Helper class for constructing a [ServiceKey].
+ *
+ * @property uid The unique identifier of the service.
+ * @property name The name of the service.
+ */
+public abstract class AbstractServiceKey<T : Any>(override val uid: UUID, override val name: String) : ServiceKey<T> {
+ override fun equals(other: Any?): Boolean = other is ServiceKey<*> && uid == other.uid
+ override fun hashCode(): Int = uid.hashCode()
+ override fun toString(): String = "ServiceKey[uid=$uid, name=$name]"
+}
diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistry.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistry.kt
new file mode 100644
index 00000000..7434d91c
--- /dev/null
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistry.kt
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+package org.opendc.core.services
+
+/**
+ * An immutable service registry interface.
+ */
+public interface ServiceRegistry {
+ /**
+ * The keys in this registry.
+ */
+ public val keys: Collection<ServiceKey<*>>
+
+ /**
+ * Determine if this map contains the service with the specified [ServiceKey].
+ *
+ * @param key The key of the service to check for.
+ * @return `true` if the service is in the map, `false` otherwise.
+ */
+ public operator fun contains(key: ServiceKey<*>): Boolean
+
+ /**
+ * Obtain the service with the specified [ServiceKey].
+ *
+ * @param key The key of the service to obtain.
+ * @return The references to the service.
+ * @throws IllegalArgumentException if the key does not exist in the map.
+ */
+ public operator fun <T : Any> get(key: ServiceKey<T>): T
+
+ /**
+ * Return the result of associating the specified [service] with the given [key] in this registry.
+ */
+ public fun <T : Any> put(key: ServiceKey<T>, service: T): ServiceRegistry
+}
+
+/**
+ * Construct an empty [ServiceRegistry].
+ */
+@Suppress("FunctionName")
+public fun ServiceRegistry(): ServiceRegistry = ServiceRegistryImpl(emptyMap())
diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistryImpl.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistryImpl.kt
new file mode 100644
index 00000000..e117bec6
--- /dev/null
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/services/ServiceRegistryImpl.kt
@@ -0,0 +1,43 @@
+/*
+ * 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.
+ */
+
+package org.opendc.core.services
+
+/**
+ * Default implementation of the [ServiceRegistry] interface.
+ */
+internal class ServiceRegistryImpl(private val map: Map<ServiceKey<*>, Any>) : ServiceRegistry {
+ override val keys: Collection<ServiceKey<*>>
+ get() = map.keys
+
+ override fun contains(key: ServiceKey<*>): Boolean = key in map
+
+ override fun <T : Any> get(key: ServiceKey<T>): T {
+ @Suppress("UNCHECKED_CAST")
+ return map[key] as T
+ }
+
+ override fun <T : Any> put(key: ServiceKey<T>, service: T): ServiceRegistry =
+ ServiceRegistryImpl(map.plus(key to service))
+
+ override fun toString(): String = map.toString()
+}
diff --git a/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt b/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt
new file mode 100644
index 00000000..f0bd1137
--- /dev/null
+++ b/simulator/opendc-core/src/main/kotlin/org/opendc/core/workload/Workload.kt
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package org.opendc.core.workload
+
+import org.opendc.core.Identity
+import org.opendc.core.User
+
+/**
+ * A high-level abstraction that represents the actual work that a set of compute resources perform, such
+ * as running an application on a machine or a whole workflow running multiple tasks on numerous machines.
+ */
+public interface Workload : Identity {
+ /**
+ * The owner of this workload.
+ */
+ public val owner: User
+}