Skip to content
Snippets Groups Projects
Commit 28dcc7dc authored by Simon Ehrenstein's avatar Simon Ehrenstein
Browse files

Improve naming and improve some kdoc

parent 754e660b
No related branches found
No related tags found
4 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!112Add Kdoc,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
This commit is part of merge request !112. Comments created here will be created in the context of that merge request.
......@@ -13,7 +13,7 @@ import theodolite.util.Results
* @see Results
*/
class LowerBoundRestriction(results: Results) : RestrictionStrategy(results) {
override fun next(load: LoadDimension, resources: List<Resource>): List<Resource> {
override fun apply(load: LoadDimension, resources: List<Resource>): List<Resource> {
val maxLoad: LoadDimension? = this.results.getMaxBenchmarkedLoad(load)
var lowerBound: Resource? = this.results.getMinRequiredInstances(maxLoad)
if (lowerBound == null) {
......
......@@ -8,11 +8,15 @@ import theodolite.util.Results
/**
* A 'Restriction Strategy' restricts a list of resources based on the current
* results of all previously performed benchmarks.
*
* @param results the result object
*
* @see Results
*/
@RegisterForReflection
abstract class RestrictionStrategy(val results: Results) {
/**
* Restrict the given resource list for the given load based on the result object.
* Apply the restriction of the given resource list for the given load based on the results object.
*
* @param load Load dimension for which a subset of resources are required.
* @param resources List of resources to be restricted.
......@@ -21,6 +25,7 @@ abstract class RestrictionStrategy(val results: Results) {
*
* @see LoadDimension
* @see Resource
* @see Results
*/
abstract fun next(load: LoadDimension, resources: List<Resource>): List<Resource>
abstract fun apply(load: LoadDimension, resources: List<Resource>): List<Resource>
}
......@@ -18,6 +18,14 @@ class BinarySearch(benchmarkExecutor: BenchmarkExecutor) : SearchStrategy(benchm
return resources[result]
}
/**
* Apply binary search.
*
* @param load the load dimension to perform experiments for
* @param resources the list in which binary search is performed
* @param lower lower bound for binary search (inclusive)
* @param upper upper bound for binary search (inclusive)
*/
private fun binarySearch(load: LoadDimension, resources: List<Resource>, lower: Int, upper: Int): Int {
if (lower > upper) {
throw IllegalArgumentException()
......
......@@ -27,7 +27,7 @@ class CompositeStrategy(
override fun findSuitableResource(load: LoadDimension, resources: List<Resource>): Resource? {
var restrictedResources = resources.toList()
for (strategy in this.restrictionStrategies) {
restrictedResources = restrictedResources.intersect(strategy.next(load, resources)).toList()
restrictedResources = restrictedResources.intersect(strategy.apply(load, resources)).toList()
}
return this.searchStrategy.findSuitableResource(load, restrictedResources)
}
......
......@@ -5,13 +5,19 @@ import io.quarkus.runtime.annotations.RegisterForReflection
/**
* Representation of a configuration override.
*
* @param patcher the PatcherDefinition
* @param value the value of the configuration override
*
* @see PatcherDefinition
*/
@RegisterForReflection
class ConfigurationOverride {
/**
* Patcher of the configuration override.
*/
lateinit var patcher: PatcherDefinition
/**
* Value of the patched configuration override.
*/
lateinit var value: String
}
......@@ -7,14 +7,18 @@ import kotlin.properties.Delegates
/**
* Configuration of Kafka connection.
*
* @param bootstrapServer the bootstrap server connection string
* @param topics the list of topics
*
* @see TopicWrapper
*/
@RegisterForReflection
class KafkaConfig {
/**
* The bootstrap server connection string
*/
lateinit var bootstrapServer: String
/**
* The list of topics
*/
lateinit var topics: List<TopicWrapper>
/**
......@@ -28,15 +32,22 @@ class KafkaConfig {
/**
* Wrapper for a topic definition.
*
* @param name the topic name
* @param numPartitions the number of partitions
* @param replicationFactor the replication factor of this topic
*/
@RegisterForReflection
class TopicWrapper {
/**
* The topic name
*/
lateinit var name: String
/**
* The number of partitions
*/
var numPartitions by Delegates.notNull<Int>()
/**
* The replication factor of this topic
*/
var replicationFactor by Delegates.notNull<Short>()
}
}
......@@ -4,5 +4,12 @@ package theodolite.util
* Interface for parsing files.
*/
interface Parser {
/**
* Parse a file.
*
* @param path The path of the file
* @param E The class of the type to parse
* @param T The type to parse
*/
fun <T> parse(path: String, E: Class<T>): T?
}
......@@ -7,8 +7,23 @@ import io.quarkus.runtime.annotations.RegisterForReflection
*/
@RegisterForReflection
class PatcherDefinition {
/**
* The type of the patcher
*/
lateinit var type: String
/**
* The resource which the patcher is applied to
*/
lateinit var resource: String
/**
* The container which the patcher is applied to
*/
lateinit var container: String
/**
* The variable name for the patcher
*/
lateinit var variableName: String
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment