diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..b08d3d08 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,18 @@ +# Changelog + +## [Unreleased] +### Added + +### Changed +- Empty query in Name is null instead of "" +- Provider provides an empty map instead of error by default + +### Deprecated + +### Removed +- Functional server prototype + +### Fixed +- Global context CoroutineScope resolution + +### Security diff --git a/build.gradle.kts b/build.gradle.kts index 93d3c926..06cfe9e2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,9 +4,10 @@ plugins { id("scientifik.jvm") version toolsVersion apply false id("scientifik.publish") version toolsVersion apply false id("org.jetbrains.dokka") version "0.10.1" + id("org.jetbrains.changelog") version "0.4.0" } -val dataforgeVersion by extra("0.1.9-dev") +val dataforgeVersion by extra("0.1.9-dev-1") val bintrayRepo by extra("dataforge") val githubProject by extra("dataforge-core") diff --git a/dataforge-context/src/commonMain/kotlin/hep/dataforge/context/Context.kt b/dataforge-context/src/commonMain/kotlin/hep/dataforge/context/Context.kt index bf901991..8bcdff57 100644 --- a/dataforge-context/src/commonMain/kotlin/hep/dataforge/context/Context.kt +++ b/dataforge-context/src/commonMain/kotlin/hep/dataforge/context/Context.kt @@ -8,6 +8,7 @@ import hep.dataforge.provider.Provider import hep.dataforge.provider.top import hep.dataforge.values.Value import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.Job import kotlinx.coroutines.SupervisorJob import mu.KLogger @@ -92,7 +93,7 @@ open class Context( config.action() } - override val coroutineContext: CoroutineContext by lazy { + open override val coroutineContext: CoroutineContext by lazy { (parent ?: Global).coroutineContext.let { parenContext -> parenContext + SupervisorJob(parenContext[Job]) } @@ -130,6 +131,9 @@ inline fun Context.content(target: String): Map = * A global root context. Closing [Global] terminates the framework. */ object Global : Context("GLOBAL".asName(), null) { + + override val coroutineContext: CoroutineContext = GlobalScope.coroutineContext + SupervisorJob() + /** * Closing all contexts * diff --git a/dataforge-context/src/commonMain/kotlin/hep/dataforge/provider/Provider.kt b/dataforge-context/src/commonMain/kotlin/hep/dataforge/provider/Provider.kt index a1c2faa1..bea7b12c 100644 --- a/dataforge-context/src/commonMain/kotlin/hep/dataforge/provider/Provider.kt +++ b/dataforge-context/src/commonMain/kotlin/hep/dataforge/provider/Provider.kt @@ -16,7 +16,6 @@ package hep.dataforge.provider import hep.dataforge.names.Name -import hep.dataforge.names.toName /** * A marker utility interface for providers. @@ -64,16 +63,16 @@ fun Provider.provide(path: Path, targetOverride: String? = null): Any? { /** * Type checked provide */ -inline fun Provider.provide(path: String): T? { - return provide(Path.parse(path)) as? T +inline fun Provider.provide(path: String, targetOverride: String? = null): T? { + return provide(Path.parse(path), targetOverride) as? T } - -inline fun Provider.provide(target: String, name: Name): T? { - return provide(PathToken(name, target).toPath()) as? T -} - -inline fun Provider.provide(target: String, name: String): T? = - provide(target, name.toName()) +// +//inline fun Provider.provide(target: String, name: Name): T? { +// return provide(PathToken(name, target).toPath()) as? T +//} +// +//inline fun Provider.provide(target: String, name: String): T? = +// provide(target, name.toName()) /** * Typed top level content diff --git a/dataforge-context/src/jvmMain/kotlin/hep/dataforge/provider/Types.kt b/dataforge-context/src/jvmMain/kotlin/hep/dataforge/provider/Types.kt index dfe81ce0..a7c27662 100644 --- a/dataforge-context/src/jvmMain/kotlin/hep/dataforge/provider/Types.kt +++ b/dataforge-context/src/jvmMain/kotlin/hep/dataforge/provider/Types.kt @@ -26,11 +26,11 @@ inline fun Provider.provideByType(name: String): T? { val target = Types[T::class] return provide(target, name) } - -inline fun Provider.provideByType(name: Name): T? { - val target = Types[T::class] - return provide(target, name) -} +// +//inline fun Provider.provideByType(name: Name): T? { +// val target = Types[T::class] +// return provide(target, name) +//} inline fun Provider.top(): Map { val target = Types[T::class]