Package space.kscience.dataforge.data

Types

ActiveDataSet
Link copied to clipboard
common
interface ActiveDataSet<T : Any> : DataSet<T>
ActiveDataTree
Link copied to clipboard
common
class ActiveDataTree<T : Any>(dataType: KType) : DataTree<T> , DataSetBuilder<T> , ActiveDataSet<T>

A mutable DataTree.Companion.active. It

CachingAction
Link copied to clipboard
common
abstract class CachingAction<in T : Any, out R : Any>(outputType: KType) : Action<T, R>

An action that caches results on-demand and recalculates them on source push

CoroutineMonitor
Link copied to clipboard
common
class CoroutineMonitor : CoroutineContext.Element

A monitor of goal state that could be accessed only form inside the goal

Data
Link copied to clipboard
common
@Type(id = "data")
interface Data<out T : Any> : Goal<T> , MetaRepr

A data element characterized by its meta

DataSet
Link copied to clipboard
common
interface DataSet<out T : Any>
DataSetBuilder
Link copied to clipboard
common
interface DataSetBuilder<in T : Any>
DataTree
Link copied to clipboard
common
@Type(id = "dataTree")
interface DataTree<out T : Any> : DataSet<T>

A tree-like DataSet grouped into the node. All data inside the node must inherit its type

DataTreeItem
Link copied to clipboard
common
sealed class DataTreeItem<out T : Any>
Dependencies
Link copied to clipboard
common
class Dependencies(values: Collection<Job>) : CoroutineContext.Element
Goal
Link copied to clipboard
common
interface Goal<out T>

Lazy computation result with its dependencies to allowing to stat computing dependencies ahead of time

GoalExecutionRestriction
Link copied to clipboard
common
GoalExecutionRestrictionPolicy
Link copied to clipboard
common
GoalLogger
Link copied to clipboard
common
interface GoalLogger : CoroutineContext.Element
GroupRule
Link copied to clipboard
common
interface GroupRule
LazyGoal
Link copied to clipboard
common
open class LazyGoal<T>(coroutineContext: CoroutineContext, dependencies: Collection<Goal<*>>, block: suspend () -> T) : Goal<T>
NamedData
Link copied to clipboard
common
interface NamedData<out T : Any> : Named, Data<T>
StaticData
Link copied to clipboard
common
class StaticData<T : Any>(type: KType, value: T, meta: Meta) : StaticGoal<T> , Data<T>
StaticGoal
Link copied to clipboard
common
open class StaticGoal<T>(value: T) : Goal<T>

Functions

ActiveDataTree
Link copied to clipboard
common
inline suspend fun <T : Any> ActiveDataTree(crossinline block: suspend ActiveDataTree<T>.() -> Unit): ActiveDataTree<T>
suspend fun <T : Any> ActiveDataTree(type: KType, block: suspend ActiveDataTree<T>.() -> Unit): ActiveDataTree<T>

Create a dynamic tree. Initial data is placed synchronously. Updates are propagated via updatesScope

await
Link copied to clipboard
common
suspend fun <T> Goal<T>.await(): T
branch
Link copied to clipboard
common
fun <T : Any> DataSet<T>.branch(branchName: String): DataSet<T>
fun <T : Any> DataSet<T>.branch(branchName: Name): DataSet<T>

Get a subset of data starting with a given branchName

fun <T : Any> DataTree<T>.branch(branchName: Name): DataTree<T>

Get a branch of this DataTree with a given branchName. The difference from similar method for DataSet is that internal logic is more simple and the return value is a DataTree

combine
Link copied to clipboard
common
inline fun <T1 : Any, T2 : Any, R : Any> Data<T1>.combine(other: Data<T2>, coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = this.meta, crossinline block: suspend (T1, T2) -> R): Data<R>

Combine this data with the other data using block. See map for other details

Data
Link copied to clipboard
common
inline fun <T : Any> Data(meta: Meta = Meta.EMPTY, context: CoroutineContext = EmptyCoroutineContext, dependencies: Collection<Data<*>> = emptyList(), noinline block: suspend () -> T): Data<T>
fun <T : Any> Data(type: KType, meta: Meta = Meta.EMPTY, context: CoroutineContext = EmptyCoroutineContext, dependencies: Collection<Data<*>> = emptyList(), block: suspend () -> T): Data<T>
DataTree
Link copied to clipboard
common
inline suspend fun <T : Any> DataTree(noinline block: suspend DataSetBuilder<T>.() -> Unit): DataTree<T>
suspend fun <T : Any> DataTree(dataType: KType, block: suspend DataSetBuilder<T>.() -> Unit): DataTree<T>
emit
Link copied to clipboard
common
suspend fun <T : Any> DataSetBuilder<T>.emit(data: NamedData<T>)
inline suspend fun <T : Any> ActiveDataTree<T>.emit(name: String, noinline block: suspend ActiveDataTree<T>.() -> Unit)
inline suspend fun <T : Any> ActiveDataTree<T>.emit(name: Name, noinline block: suspend ActiveDataTree<T>.() -> Unit)
suspend fun <T : Any> DataSetBuilder<T>.emit(name: String, block: suspend DataSetBuilder<T>.() -> Unit)
suspend fun <T : Any> DataSetBuilder<T>.emit(name: String, set: DataSet<T>)
suspend fun <T : Any> DataSetBuilder<T>.emit(name: String, data: Data<T>)
suspend fun <T : Any> DataSetBuilder<T>.emit(name: Name, block: suspend DataSetBuilder<T>.() -> Unit)
filter
Link copied to clipboard
common
fun <T : Any> DataSet<T>.filter(predicate: suspend (Name, Data<T>) -> Boolean): ActiveDataSet<T>

A stateless filtered DataSet

flowChildren
Link copied to clipboard
common
fun <T : Any> DataSet<T>.flowChildren(branchName: Name): Flow<NamedData<T>>

Flow all data nodes with names starting with branchName

foldToData
Link copied to clipboard
common
inline suspend fun <T : Any, R : Any> Flow<NamedData<T>>.foldToData(initial: R, coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, noinline block: suspend (R, data: NamedData<T>) -> R): Data<R>

Fold a flow of named data into a single Data

inline suspend fun <T : Any, R : Any> DataSet<T>.foldToData(initial: R, coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, noinline block: suspend (R, data: NamedData<T>) -> R): Data<R>
forEach
Link copied to clipboard
common
suspend fun <T : Any> DataSet<T>.forEach(block: suspend (NamedData<T>) -> Unit)
getData
Link copied to clipboard
common
suspend fun <T : Any> DataSet<T>.getData(name: String): Data<T>?
getItem
Link copied to clipboard
common
suspend tailrec fun <T : Any> DataTree<T>.getItem(name: Name): DataTreeItem<T>?

Get a DataTreeItem with given name or null if the item does not exist

getMeta
Link copied to clipboard
common
suspend fun DataSet<*>.getMeta(): Meta?

Get a metadata node for this set if it is present

itemFlow
Link copied to clipboard
common
fun <T : Any> DataTree<T>.itemFlow(): Flow<Pair<Name, DataTreeItem<T>>>

Flow of all children including nodes

join
Link copied to clipboard
common
suspend fun <T : Any> DataSet<T>.join()
launch
Link copied to clipboard
common
fun Goal<*>.launch(coroutineScope: CoroutineScope): Job
map
Link copied to clipboard
common
inline suspend fun <T : Any, R : Any> DataSet<T>.map(coroutineContext: CoroutineContext = EmptyCoroutineContext, noinline metaTransform: MutableMeta.() -> Unit = {}, noinline block: suspend (T) -> R): DataTree<R>
suspend fun <T : Any, R : Any> DataSet<T>.map(outputType: KType, coroutineContext: CoroutineContext = EmptyCoroutineContext, metaTransform: MutableMeta.() -> Unit = {}, block: suspend (T) -> R): DataTree<R>
inline fun <T : Any, R : Any> Data<T>.map(coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = this.meta, crossinline block: suspend (T) -> R): Data<R>

Lazily transform this data to another data. By convention block should not use external data (be pure).

meta
Link copied to clipboard
common
suspend fun DataSetBuilder<*>.meta(mutableMeta: MutableMeta.() -> Unit)
suspend fun DataSetBuilder<*>.meta(meta: Meta)

Add meta-data node to a DataSet

named
Link copied to clipboard
common
fun <T : Any> Data<T>.named(name: Name): NamedData<T>
populate
Link copied to clipboard
common
suspend fun <T : Any> DataSetBuilder<T>.populate(flow: Flow<NamedData<T>>)
suspend fun <T : Any> DataSetBuilder<T>.populate(tree: DataSet<T>)

Update data with given node data and meta with node meta.

produce
Link copied to clipboard
common
inline suspend fun <T : Any> DataSetBuilder<T>.produce(name: String, meta: Meta = Meta.EMPTY, noinline producer: suspend () -> T)

Produce lazy Data and emit it into the DataSetBuilder

inline suspend fun <T : Any> DataSetBuilder<T>.produce(name: Name, meta: Meta = Meta.EMPTY, noinline producer: suspend () -> T)
reduceToData
Link copied to clipboard
common
inline fun <T : Any, R : Any> Collection<Data<T>>.reduceToData(coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, crossinline block: suspend (Collection<T>) -> R): Data<R>

Lazily reduce a collection of Data to a single data.

inline fun <K, T : Any, R : Any> Map<K, Data<T>>.reduceToData(coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, noinline block: suspend (Map<K, T>) -> R): Data<R>

Lazily reduce a Map of Data with any static key.

inline suspend fun <T : Any, R : Any> Flow<NamedData<T>>.reduceToData(coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, noinline transformation: suspend (Flow<NamedData<T>>) -> R): Data<R>
inline suspend fun <T : Any, R : Any> DataSet<T>.reduceToData(coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, noinline transformation: suspend (Flow<NamedData<T>>) -> R): Data<R>
fun <K, T : Any, R : Any> Map<K, Data<T>>.reduceToData(outputType: KType, coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, block: suspend (Map<K, T>) -> R): Data<R>
suspend fun <T : Any, R : Any> Flow<NamedData<T>>.reduceToData(outputType: KType, coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, transformation: suspend (Flow<NamedData<T>>) -> R): Data<R>

Transform a Flow of NamedData to a single Data.

rootData
Link copied to clipboard
common
suspend fun <T : Any> DataSet<T>.rootData(): Data<T>?
seal
Link copied to clipboard
common
suspend fun <T : Any> DataSet<T>.seal(): DataTree<T>
select
Link copied to clipboard
inline fun <R : Any> DataSet<*>.select(namePattern: Name? = null, noinline filter: (name: Name, meta: Meta) -> Boolean = { _, _ -> true }): DataSet<R>

Select a single datum of the appropriate type

fun <R : Any> DataSet<*>.select(type: KType, namePattern: Name? = null, filter: (name: Name, meta: Meta) -> Boolean = { _, _ -> true }): ActiveDataSet<R>

Select all data matching given type and filters. Does not modify paths

selectOne
Link copied to clipboard
inline suspend fun <R : Any> DataSet<*>.selectOne(name: String): NamedData<R>?
inline suspend fun <R : Any> DataSet<*>.selectOne(name: Name): NamedData<R>?
suspend fun <R : Any> DataSet<*>.selectOne(type: KType, name: Name): NamedData<R>?

Select a single datum if it is present and of given type

startAll
Link copied to clipboard
common
fun <T : Any> DataSet<T>.startAll(coroutineScope: CoroutineScope): Job

Start computation for all goals in data node and return a job for the whole node

static
Link copied to clipboard
common
inline suspend fun <T : Any> DataSetBuilder<T>.static(name: String, data: T, mutableMeta: MutableMeta.() -> Unit)
inline suspend fun <T : Any> DataSetBuilder<T>.static(name: Name, data: T, meta: Meta = Meta.EMPTY)
inline suspend fun <T : Any> DataSetBuilder<T>.static(name: String, data: T, meta: Meta = Meta.EMPTY)

Emit a static data with the fixed value

toMeta
Link copied to clipboard
common
suspend fun DataSet<*>.toMeta(): Meta
withNamePrefix
Link copied to clipboard
common
fun <T : Any> DataSet<T>.withNamePrefix(prefix: Name): DataSet<T>

Generate a wrapper data set with a given name prefix appended to all names

Properties

data
Link copied to clipboard
common
val <T : Any> DataTreeItem<T>?.data: Data<T>?
dependencies
Link copied to clipboard
common
val Job.dependencies: Collection<Job>
isComplete
Link copied to clipboard
common
val Goal<*>.isComplete: Boolean
monitor
Link copied to clipboard
common
val CoroutineContext.monitor: CoroutineMonitor?
monitor
Link copied to clipboard
common
val CoroutineScope.monitor: CoroutineMonitor?
progress
Link copied to clipboard
common
val Job.progress: Double
status
Link copied to clipboard
common
val Job.status: String
totalWork
Link copied to clipboard
common
val Job.totalWork: Double
tree
Link copied to clipboard
common
val <T : Any> DataTreeItem<T>?.tree: DataTree<T>?
type
Link copied to clipboard
common
val <T : Any> DataTreeItem<T>.type: KType
updates
Link copied to clipboard
common
val <T : Any> DataSet<T>.updates: Flow<Name>
updatesWithData
Link copied to clipboard
common
val <T : Any> DataSet<T>.updatesWithData: Flow<NamedData<T>>
workDone
Link copied to clipboard
common
val Job.workDone: Double