Update server to working condition
This commit is contained in:
parent
bdc649fde6
commit
7efb952163
@ -1,6 +1,5 @@
|
||||
package ru.inr.mass.data.proto
|
||||
|
||||
import kotlinx.coroutines.launch
|
||||
import ru.inr.mass.data.api.NumassPoint
|
||||
import space.kscience.dataforge.context.AbstractPlugin
|
||||
import space.kscience.dataforge.context.Context
|
||||
@ -64,15 +63,14 @@ public suspend fun NumassProtoPlugin.readRepository(path: Path): DataTree<Numass
|
||||
NameToken(segment.fileName.toString())
|
||||
})
|
||||
val value = readNumassDirectory(childPath)
|
||||
launch {
|
||||
static(name, value, value.meta)
|
||||
}
|
||||
static(name, value, value.meta)
|
||||
}
|
||||
|
||||
//TODO add file watcher
|
||||
}
|
||||
|
||||
public suspend fun NumassProtoPlugin.readRepository(path: String): DataTree<NumassDirectorySet> = readRepository(Path.of(path))
|
||||
public suspend fun NumassProtoPlugin.readRepository(path: String): DataTree<NumassDirectorySet> =
|
||||
readRepository(Path.of(path))
|
||||
|
||||
public fun NumassProtoPlugin.readPoint(path: String): NumassPoint = readNumassPointFile(path)
|
||||
?: error("Can't read numass point at $path")
|
||||
|
@ -27,6 +27,7 @@ public class NumassCommonPlugin(meta: Meta = Meta.EMPTY) : VisionPlugin(meta) {
|
||||
subclass(VisionOfNumassHv.serializer())
|
||||
subclass(VisionOfNumassPoint.serializer())
|
||||
subclass(VisionOfNumassSet.serializer())
|
||||
subclass(VisionOfNumassSetRef.serializer())
|
||||
subclass(VisionOfNumassRepository.serializer())
|
||||
}
|
||||
}
|
||||
|
@ -4,10 +4,11 @@ import kotlinx.serialization.Serializable
|
||||
import ru.inr.mass.data.api.NumassSet
|
||||
import space.kscience.dataforge.data.DataTree
|
||||
import space.kscience.dataforge.data.DataTreeItem
|
||||
import space.kscience.dataforge.data.await
|
||||
import space.kscience.dataforge.misc.Named
|
||||
import space.kscience.dataforge.names.Name
|
||||
import space.kscience.dataforge.names.NameToken
|
||||
import space.kscience.dataforge.names.plus
|
||||
import space.kscience.visionforge.AbstractVision
|
||||
import space.kscience.visionforge.AbstractVisionGroup
|
||||
|
||||
@Serializable
|
||||
@ -15,13 +16,18 @@ public class VisionOfNumassRepository : AbstractVisionGroup() {
|
||||
override fun createGroup(): VisionOfNumassRepository = VisionOfNumassRepository()
|
||||
}
|
||||
|
||||
@Serializable
|
||||
public class VisionOfNumassSetRef(
|
||||
override val name: Name,
|
||||
) : Named, AbstractVision()
|
||||
|
||||
public suspend fun VisionOfNumassRepository(
|
||||
repoName: Name,
|
||||
tree: DataTree<NumassSet>,
|
||||
): VisionOfNumassRepository = VisionOfNumassRepository().apply {
|
||||
tree.items.forEach { (key: NameToken, value) ->
|
||||
children[key] = when (value) {
|
||||
is DataTreeItem.Leaf -> VisionOfNumassSet(repoName + key, value.data.await())
|
||||
is DataTreeItem.Leaf -> VisionOfNumassSetRef(repoName + key)
|
||||
is DataTreeItem.Node -> VisionOfNumassRepository(repoName + key, value.tree)
|
||||
}
|
||||
}
|
||||
|
@ -19,11 +19,13 @@ public data class PointRef(
|
||||
|
||||
@Serializable
|
||||
public class VisionOfNumassSet(
|
||||
public val meta: Meta,
|
||||
public val points: List<PointRef>,
|
||||
public val hvData: HVData? = null,
|
||||
) : AbstractVision()
|
||||
|
||||
public fun VisionOfNumassSet(setName: Name, set: NumassSet): VisionOfNumassSet = VisionOfNumassSet(
|
||||
set.meta,
|
||||
set.points.map { point ->
|
||||
PointRef(
|
||||
setName + point.index.toString(),
|
||||
|
Loading…
Reference in New Issue
Block a user