Call remote tasks of service workspace #75
@ -1,5 +1,7 @@
|
||||
|
||||
package space.kscience.dataforge.distributed.serialization
|
||||
|
||||
import kotlinx.coroutines.Deferred
|
||||
Again, you do not need a separate structure. All you need is a generic DataSet with serializer. Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
When When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
|
||||
import kotlinx.coroutines.async
|
||||
Again, you do not need a separate structure. All you need is a generic DataSet with serializer. Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
When When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.asFlow
|
||||
import kotlinx.coroutines.flow.map
|
||||
@ -29,11 +31,11 @@ internal data class DataSetPrototype(val data: Map<String, DataPrototype>) {
|
||||
Again, you do not need a separate structure. All you need is a generic DataSet with serializer. Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
Again, you do not need a separate structure. All you need is a generic DataSet with serializer. Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
When When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
When When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
|
||||
companion object {
|
||||
fun <T : Any> of(dataSet: DataSet<T>): DataSetPrototype = runBlocking {
|
||||
val serializer = serializer(dataSet.dataType)
|
||||
val map = mutableListOf<Pair<String, DataPrototype>>()
|
||||
Again, you do not need a separate structure. All you need is a generic DataSet with serializer. Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
When When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
|
||||
val map = mutableListOf<Pair<String, Deferred<DataPrototype>>>()
|
||||
Again, you do not need a separate structure. All you need is a generic DataSet with serializer. Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
When When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
|
||||
dataSet.flowData().map { (name, data) ->
|
||||
name.toString() to DataPrototype.of(data, serializer)
|
||||
Again, you do not need a separate structure. All you need is a generic DataSet with serializer. Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
When When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
|
||||
name.toString() to async { DataPrototype.of(data, serializer) }
|
||||
Again, you do not need a separate structure. All you need is a generic DataSet with serializer. Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
When When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
|
||||
}.toList(map)
|
||||
DataSetPrototype(map.associate { it })
|
||||
Again, you do not need a separate structure. All you need is a generic DataSet with serializer. Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
When When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
|
||||
DataSetPrototype(map.associate { (name, deferred) -> name to deferred.await() })
|
||||
Again, you do not need a separate structure. All you need is a generic DataSet with serializer. Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
When When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
|
||||
}
|
||||
|
||||
fun fromJson(string: String): DataSetPrototype = Json.decodeFromString(serializer(), string)
|
||||
|
||||
Again, you do not need a separate structure. All you need is a generic DataSet with serializer. Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
Again, you do not need a separate structure. All you need is a generic DataSet with serializer. Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
When When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
When When `ServiceWorkspace.execute` returns result to the client, it do not know yet about serializer for the `T`. Then `RemoteTask` uses serializer to deserialize DataSet from prototype.
|
Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
Again, you do not need a separate structure. All you need is a generic DataSet with serializer.
When
ServiceWorkspace.execute
returns result to the client, it do not know yet about serializer for theT
. ThenRemoteTask
uses serializer to deserialize DataSet from prototype.When
ServiceWorkspace.execute
returns result to the client, it do not know yet about serializer for theT
. ThenRemoteTask
uses serializer to deserialize DataSet from prototype.