Package space.kscience.dataforge.workspace

Types

ContextGoalLogger
Link copied to clipboard
common
class ContextGoalLogger(context: Context) : GoalLogger
DataSelector
Link copied to clipboard
common
interface DataSelector<T : Any>
FileFormatResolver
Link copied to clipboard
interface FileFormatResolver<T : Any>
SimpleWorkspace
Link copied to clipboard
common
class SimpleWorkspace(context: Context, data: DataSet<*>, targets: Map<String, Meta>, externalTasks: Map<Name, Task<*>>) : Workspace

A simple workspace without caching

Task
Link copied to clipboard
common
@Type(id = "workspace.task")
interface Task<out T : Any> : Described
TaskContainer
Link copied to clipboard
common
interface TaskContainer
TaskData
Link copied to clipboard
common
interface TaskData<out T : Any> : NamedData<T>

A Workspace-locked NamedData, that serves as a computation model.

TaskReference
Link copied to clipboard
common
data class TaskReference<T : Any>(taskName: Name, task: Task<T>) : DataSelector<T>
TaskResult
Link copied to clipboard
common
interface TaskResult<out T : Any> : DataSet<T>

A result of a Task

TaskResultBuilder
Link copied to clipboard
common
class TaskResultBuilder<T : Any>(workspace: Workspace, taskName: Name, taskMeta: Meta, dataDrop: DataSetBuilder<T>) : DataSetBuilder<T>
Workspace
Link copied to clipboard
common
@Type(id = "workspace")
interface Workspace : ContextAware, Provider
WorkspaceBuilder
Link copied to clipboard
common
class WorkspaceBuilder(parentContext: Context) : TaskContainer
WorkspacePlugin
Link copied to clipboard
abstract class WorkspacePlugin : AbstractPlugin, TaskContainer

An abstract plugin with some additional boilerplate to effectively work with workspace context

Functions

data
Link copied to clipboard
inline fun <T : Any> TaskResultBuilder<*>.data(namePattern: Name? = null): DataSelector<T>
fun WorkspaceBuilder.data(builder: suspend DataSetBuilder<Any>.() -> Unit)
file
Link copied to clipboard
suspend fun <T : Any> DataSetBuilder<T>.file(plugin: IOPlugin, path: Path, formatResolver: FileFormatResolver<T>)

Add file/directory-based data tree item

from
Link copied to clipboard
common
suspend fun <T : Any> TaskResultBuilder<*>.from(selector: DataSelector<T>): DataSet<T>

Select data using given selector

fromTask
Link copied to clipboard
inline suspend fun <T : Any> TaskResultBuilder<*>.fromTask(task: Name, taskMeta: Meta = Meta.EMPTY): DataSet<T>
pipeFrom
Link copied to clipboard
common
inline suspend fun <T : Any, R : Any> TaskResultBuilder<R>.pipeFrom(selector: DataSelector<T>, crossinline action: suspend (T, name: Name, meta: Meta) -> R)

Perform a lazy mapping task using given selector and action. The meta of resulting TODO move selector to receiver with multi-receivers

produce
Link copied to clipboard
common
suspend fun Workspace.produce(task: String, block: MutableMeta.() -> Unit = {}): TaskResult<*>
suspend fun Workspace.produce(task: String, target: String): TaskResult<*>
suspend fun Workspace.produce(task: String, meta: Meta): TaskResult<*>
readDataDirectory
Link copied to clipboard
inline suspend fun <T : Any> IOPlugin.readDataDirectory(path: Path): DataTree<T>
suspend fun <T : Any> IOPlugin.readDataDirectory(path: Path, formatResolver: FileFormatResolver<T>): DataTree<T>

Read the directory as a data node. If path is a zip archive, read it as directory

readDataFile
Link copied to clipboard
inline fun <T : Any> IOPlugin.readDataFile(path: Path): Data<T>
fun <T : Any> IOPlugin.readDataFile(path: Path, formatResolver: FileFormatResolver<T>): Data<T>

Read data with supported envelope format and binary format. If envelope format is null, then read binary directly from file. The operation is blocking since it must read meta header. The reading of envelope body is lazy

registerTask
Link copied to clipboard
common
inline fun <T : Any> TaskContainer.registerTask(name: String, noinline descriptorBuilder: MetaDescriptorBuilder.() -> Unit = {}, noinline builder: suspend TaskResultBuilder<T>.() -> Unit)
target
Link copied to clipboard
common
inline fun WorkspaceBuilder.target(name: String, mutableMeta: MutableMeta.() -> Unit)

Define a new target with a builder

Task
Link copied to clipboard
common
inline fun <T : Any> TaskContainer.task(noinline descriptorBuilder: MetaDescriptorBuilder.() -> Unit = {}, noinline builder: suspend TaskResultBuilder<T>.() -> Unit): PropertyDelegateProvider<Any?, ReadOnlyProperty<Any?, TaskReference<T>>>
inline fun <T : Any> TaskContainer.task(descriptor: MetaDescriptor, noinline builder: suspend TaskResultBuilder<T>.() -> Unit): PropertyDelegateProvider<Any?, ReadOnlyProperty<Any?, TaskReference<T>>>
toData
Link copied to clipboard
common
fun <T : Any> Envelope.toData(format: IOFormat<T>): Data<T>

Convert an Envelope to a data via given format. The actual parsing is done lazily.

toEnvelope
Link copied to clipboard
common
suspend fun <T : Any> Data<T>.toEnvelope(format: IOFormat<T>): Envelope
Workspace
Link copied to clipboard
common
fun Workspace(parentContext: Context = Global, builder: WorkspaceBuilder.() -> Unit): Workspace
wrapData
Link copied to clipboard
common
fun <T : Any> Workspace.wrapData(data: Data<T>, name: Name, taskName: Name, stageMeta: Meta): TaskData<T>
wrapResult
Link copied to clipboard
common
fun <T : Any> Workspace.wrapResult(dataSet: DataSet<T>, taskName: Name, taskMeta: Meta): TaskResult<T>

Wrap data into TaskResult

writeDataDirectory
Link copied to clipboard
suspend fun <T : Any> IOPlugin.writeDataDirectory(path: Path, tree: DataTree<T>, format: IOFormat<T>, envelopeFormat: EnvelopeFormat? = null, metaFormat: MetaFormatFactory? = null)

Write data tree to existing directory or create a new one using default java.nio.file.FileSystem provider

writeZip
Link copied to clipboard
suspend fun <T : Any> IOPlugin.writeZip(path: Path, tree: DataTree<T>, format: IOFormat<T>, envelopeFormat: EnvelopeFormat = TaggedEnvelopeFormat)

Properties

allData
Link copied to clipboard
common
val TaskResultBuilder<*>.allData: DataSelector<*>
goalLogger
Link copied to clipboard
common
val Workspace.goalLogger: GoalLogger