Commit d98a68dc by Tomasz Ciesielczyk

integrate FM

parent 5044470e
package psnc.m2dc.rtm
import psnc.m2dc.rtm.dao.LightStorage
import psnc.m2dc.rtm.model.rest.ESMPowerPolicy
import psnc.m2dc.rtm.model.rest.NodePriority
import psnc.m2dc.rtm.model.rest.PowerCappingMode
import psnc.m2dc.rtm.model.rest.PowerCappingStrategy
import psnc.m2dc.rtm.model.rest.*
import psnc.m2dc.rtm.pcm.algorithm.Evaluation
import psnc.m2dc.rtm.properties.keys.Keys
......@@ -12,34 +9,37 @@ object StorageKeys {
private const val pcm = "PCM_"
private const val RTM = "RTM_"
val PERFORMANCE_SETTINGS = LightStorage.getNullableMapWrapper<Double>("${pcm}PERFORMANCE_SETTINGS")
val PROFILE_MAP = LightStorage.getNullableMapWrapper<String>("${pcm}PROFILE_MAP")
private const val esm = "ESM_"
private const val fm = "FM_"
private const val rtm = "RTM_"
val PERFORMANCE_SETTINGS = LightStorage.getNullableMapWrapper<Double>("${rtm}PERFORMANCE_SETTINGS")
val PROFILE_MAP = LightStorage.getNullableMapWrapper<String>("${rtm}PROFILE_MAP")
val TEMPERATURE_LIMIT = LightStorage.getNullableMapWrapper<TemperatureLimit>("${fm}TEMPERATURE_LIMIT")
var POWER_LIMIT: Double?
get() = LightStorage.instance.get("${pcm}POWER_LIMIT")
set(value) = value?.let { LightStorage.instance.put("${pcm}POWER_LIMIT", value) }
?: LightStorage.instance.delete("${pcm}POWER_LIMIT")
var PC_POWER_POLICY: PowerCappingMode
get() = LightStorage.instance.get("${pcm}PC_POWER_POLICY") ?: PowerCappingMode.DEFAULT
set(value) = LightStorage.instance.put("${pcm}PC_POWER_POLICY", value)
var ESM_POWER_POLICY: ESMPowerPolicy
get() = LightStorage.instance.get("${pcm}ESM_POWER_POLICY") ?: ESMPowerPolicy.DEFAULT
set(value) = LightStorage.instance.put("${pcm}ESM_POWER_POLICY", value)
get() = LightStorage.instance.get("${esm}ESM_POWER_POLICY") ?: ESMPowerPolicy.DEFAULT
set(value) = LightStorage.instance.put("${esm}ESM_POWER_POLICY", value)
var NODE_PRIORITIES_MAP = LightStorage.getNullableMapWrapper<NodePriority>("${pcm}NODE_PRIORITIES_MAP")
var NODE_PRIORITIES_MAP = LightStorage.getNullableMapWrapper<NodePriority>("${rtm}NODE_PRIORITIES_MAP")
var POWER_CAPPING_STRATEGY: PowerCappingStrategy
get() = LightStorage.instance.get("${pcm}POWER_CAPPING_STRATEGY") ?: PowerCappingStrategy.LAZY
set(value) = LightStorage.instance.put("${pcm}POWER_CAPPING_STRATEGY", value)
var POWER_SETTING_EVALUATION_MODE: Evaluation.PowerMode
get() = LightStorage.instance.get("${RTM}POWER_SETTING_EVALUATION_MODE")
get() = LightStorage.instance.get("${rtm}POWER_SETTING_EVALUATION_MODE")
?: Evaluation.PowerMode.valueOf(Keys.RTM.power_setting_evaluation_mode.get())
set(value) = LightStorage.instance.put("${RTM}POWER_SETTING_EVALUATION_MODE", value)
set(value) = LightStorage.instance.put("${rtm}POWER_SETTING_EVALUATION_MODE", value)
fun loadSettings(map: HashMap<String, Any>) {
......@@ -48,7 +48,7 @@ object StorageKeys {
val key = it.key
val value = it.value
when (key) {
RTM + "EVALUATION_POWER_MODE" ->
rtm + "EVALUATION_POWER_MODE" ->
POWER_SETTING_EVALUATION_MODE = Evaluation.PowerMode.valueOf(value.toString())
}
}
......@@ -56,7 +56,7 @@ object StorageKeys {
fun getSettings(): HashMap<String, Any> {
val result = HashMap<String, Any>()
result[RTM + "EVALUATION_POWER_MODE"] = POWER_SETTING_EVALUATION_MODE
result[rtm + "EVALUATION_POWER_MODE"] = POWER_SETTING_EVALUATION_MODE
return result
}
......
package psnc.m2dc.rtm.fm
package psnc.m2dc.rtm.fm
import org.slf4j.LoggerFactory
import psnc.m2dc.rtm.StorageKeys
import psnc.m2dc.rtm.dao.DAO
import psnc.m2dc.rtm.model.rest.TemperatureLimit
import psnc.m2dc.rtm.model.rest.TimeInterval
......@@ -32,7 +31,7 @@ class FMApi {
fun init() {
synchronized(lock) {
this.Instance = FMApi()
Instance = FMApi()
log.info("PCM Api initialized")
initialized = true
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment