Package-level declarations

Types

Link copied to clipboard

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

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

A data element characterized by its meta

Link copied to clipboard
interface DataSet<out T : Any>
Link copied to clipboard
interface DataSetBuilder<in T : Any>
Link copied to clipboard
interface DataSource<out T : Any> : DataSet<T> , CoroutineScope

A DataSet with propagated updates.

Link copied to clipboard
Link copied to clipboard
@DfId(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

Link copied to clipboard
class DataTreeBuilder<T : Any>(val dataType: KType, coroutineContext: CoroutineContext) : DataTree<T> , DataSourceBuilder<T>

A mutable DataTree that propagates updates

Link copied to clipboard
sealed class DataTreeItem<out T : Any>
Link copied to clipboard
Link copied to clipboard
interface Goal<out T>

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

Link copied to clipboard
class GoalExecutionRestriction(val policy: GoalExecutionRestrictionPolicy = GoalExecutionRestrictionPolicy.ERROR) : CoroutineContext.Element

A special coroutine context key that allows or disallows goal execution during configuration time (eager execution).

Link copied to clipboard

Coroutine context element that provides logging capabilities

Link copied to clipboard
interface GroupRule
Link copied to clipboard
open class LazyGoal<T>(coroutineContext: CoroutineContext = EmptyCoroutineContext, val dependencies: Collection<Goal<*>> = emptyList(), val block: suspend () -> T) : Goal<T>
Link copied to clipboard
interface NamedData<out T : Any> : Named, Data<T>
Link copied to clipboard
data class NamedValueWithMeta<T>(val name: Name, val meta: Meta, val value: T)
Link copied to clipboard
class StaticData<T : Any>(val type: KType, value: T, val meta: Meta = Meta.EMPTY) : StaticGoal<T> , Data<T>
Link copied to clipboard
open class StaticGoal<T>(val value: T) : Goal<T>
Link copied to clipboard
data class ValueWithMeta<T>(val meta: Meta, val value: T)

Properties

Link copied to clipboard
val <T : Any> DataTreeItem<T>?.data: Data<T>?
Link copied to clipboard
val Job.dependencies: Collection<Job>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val Job.progress: Double
Link copied to clipboard
val Job.status: String
Link copied to clipboard
val Job.totalWork: Double
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
val <T : Any> DataSet<T>.updates: Flow<Name>
Link copied to clipboard
Link copied to clipboard
val Job.workDone: Double

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
suspend fun <T> Goal<T>.await(): T
Link copied to clipboard
Link copied to clipboard
fun <T : Any> DataSet<T>.branch(branchName: String): DataSet<T>
fun <T : Any> DataTree<T>.branch(branchName: String): DataTree<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

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

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

Link copied to clipboard
operator fun NamedData<*>.component1(): Name
Link copied to clipboard
operator fun <T : Any> NamedData<T>.component2(): Data<T>
Link copied to clipboard
suspend fun <T : Any> DataSet<T>.computeAndJoinAll()
Link copied to clipboard
inline fun <T : Any> Data(value: T, meta: Meta = Meta.EMPTY): StaticData<T>
inline fun <T : Any> Data(meta: Meta = Meta.EMPTY, context: CoroutineContext = EmptyCoroutineContext, dependencies: Collection<Goal<*>> = emptyList(), noinline block: suspend () -> T): Data<T>
fun <T : Any> Data(type: KType, meta: Meta = Meta.EMPTY, context: CoroutineContext = EmptyCoroutineContext, dependencies: Collection<Goal<*>> = emptyList(), block: suspend () -> T): Data<T>
Link copied to clipboard
fun <T : Any> DataSetBuilder<T>.data(name: String, value: Data<T>)
Link copied to clipboard
inline suspend fun <T : Any> DataSource(crossinline block: DataSourceBuilder<T>.() -> Unit = {}): DataTreeBuilder<T>
inline fun <T : Any> DataSource(parent: CoroutineScope, crossinline block: DataSourceBuilder<T>.() -> Unit): DataTreeBuilder<T>

fun <T : Any> DataSource(type: KType, parent: CoroutineScope, block: DataSourceBuilder<T>.() -> Unit): DataTreeBuilder<T>

Create a dynamic DataSource. Initial data is placed synchronously.

Link copied to clipboard
inline fun <T : Any> DataTree(noinline block: DataSetBuilder<T>.() -> Unit): DataTree<T>
inline fun <T : Any> DataTree(dataType: KType, block: DataSetBuilder<T>.() -> Unit): DataTree<T>
Link copied to clipboard
inline fun <T : Any> DataSourceBuilder<T>.emit(name: String, parent: CoroutineScope, noinline block: DataSourceBuilder<T>.() -> Unit)
inline fun <T : Any> DataSourceBuilder<T>.emit(name: Name, parent: CoroutineScope, noinline block: DataSourceBuilder<T>.() -> Unit)
Link copied to clipboard
fun <T : Any> DataSet<T>.filter(predicate: (Name, Meta) -> Boolean): DataSource<T>

A stateless filtered DataSet

Link copied to clipboard
inline fun <R : Any> DataSet<*>.filterByType(noinline predicate: (name: Name, meta: Meta) -> Boolean = { _, _ -> true }): DataSet<R>

Select a single datum of the appropriate type

fun <R : Any> DataSet<*>.filterByType(type: KType, predicate: (name: Name, meta: Meta) -> Boolean = { _, _ -> true }): DataSource<R>

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

Link copied to clipboard
inline fun <T : Any, R : Any> Iterable<NamedData<T>>.foldNamedToData(initial: R, coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, crossinline block: suspend (result: R, data: NamedValueWithMeta<T>) -> R): Data<R>

Fold a Iterable of named data into a single Data

Link copied to clipboard
inline fun <T : Any, R : Any> Iterable<Data<T>>.foldToData(initial: R, coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, crossinline block: suspend (result: R, data: ValueWithMeta<T>) -> R): Data<R>
inline fun <T : Any, R : Any> DataSet<T>.foldToData(initial: R, coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, crossinline block: suspend (result: R, data: NamedValueWithMeta<T>) -> R): Data<R>
Link copied to clipboard
inline fun <T : Any> DataSet<T>.forEach(block: (NamedData<T>) -> Unit)
Link copied to clipboard
operator fun <T : Any> DataSet<T>.get(name: String): Data<T>?
Link copied to clipboard
inline fun <R : Any> DataSet<*>.getByType(name: String): NamedData<R>?
inline fun <R : Any> DataSet<*>.getByType(name: Name): NamedData<R>?

fun <R : Any> DataSet<*>.getByType(type: KType, name: Name): NamedData<R>?

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

Link copied to clipboard
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

Link copied to clipboard
fun Goal<*>.launch(coroutineScope: CoroutineScope): Job
Link copied to clipboard
fun <T : Any> DataTree<T>.listChildren(prefix: Name): List<Name>
Link copied to clipboard
inline suspend fun <T : Any, R : Any> DataSet<T>.map(coroutineContext: CoroutineContext = EmptyCoroutineContext, noinline metaTransform: MutableMeta.() -> Unit = {}, noinline block: suspend (NamedValueWithMeta<T>) -> R): DataTree<R>
suspend fun <T : Any, R : Any> DataSet<T>.map(outputType: KType, coroutineContext: CoroutineContext = EmptyCoroutineContext, metaTransform: MutableMeta.() -> Unit = {}, block: suspend (NamedValueWithMeta<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).

Link copied to clipboard
fun <T : Any> DataSetBuilder<T>.meta(mutableMeta: MutableMeta.() -> Unit)
fun <T : Any> DataSetBuilder<T>.meta(value: Meta)

Define meta in this DataSet

Link copied to clipboard
fun <T : Any> Data<T>.named(name: Name): NamedData<T>
Link copied to clipboard
inline fun <T : Any> DataSetBuilder<T>.node(name: String, crossinline block: DataSetBuilder<T>.() -> Unit)
fun <T : Any> DataSetBuilder<T>.node(name: String, set: DataSet<T>)
inline fun <T : Any> DataSetBuilder<T>.node(name: Name, crossinline block: DataSetBuilder<T>.() -> Unit)
Link copied to clipboard

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

Link copied to clipboard
inline 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 fun <T : Any> DataSetBuilder<T>.produce(name: Name, meta: Meta = Meta.EMPTY, noinline producer: suspend () -> T)
Link copied to clipboard
infix fun <T : Any> String.put(block: DataSetBuilder<T>.() -> Unit)

Build and append node

infix fun <T : Any> String.put(dataSet: DataSet<T>)

Append node

infix fun <T : Any> String.put(data: Data<T>)

Append data to node

Link copied to clipboard
inline fun <T : Any, R : Any> Iterable<NamedData<T>>.reduceNamedToData(coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, crossinline transformation: suspend (Collection<NamedValueWithMeta<T>>) -> R): Data<R>

inline fun <T : Any, R : Any> Iterable<NamedData<T>>.reduceNamedToData(outputType: KType, coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, crossinline transformation: suspend (Collection<NamedValueWithMeta<T>>) -> R): Data<R>

Transform an Iterable of NamedData to a single Data.

Link copied to clipboard
inline fun <T : Any, R : Any> Collection<Data<T>>.reduceToData(coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, crossinline block: suspend (List<ValueWithMeta<T>>) -> R): Data<R>

Lazily reduce a collection of Data to a single data.

inline fun <T : Any, R : Any> Iterable<Data<T>>.reduceToData(coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, crossinline transformation: suspend (Collection<ValueWithMeta<T>>) -> R): Data<R>
inline fun <T : Any, R : Any> DataSet<T>.reduceToData(coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, crossinline transformation: suspend (Iterable<NamedValueWithMeta<T>>) -> R): Data<R>
inline fun <T : Any, R : Any> Iterable<Data<T>>.reduceToData(outputType: KType, coroutineContext: CoroutineContext = EmptyCoroutineContext, meta: Meta = Meta.EMPTY, crossinline transformation: suspend (Collection<ValueWithMeta<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, ValueWithMeta<T>>) -> R): Data<R>

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

Lazily reduce a Map of Data with any static key.

Link copied to clipboard
suspend fun <T : Any> DataSet<T>.rootData(): Data<T>?
Link copied to clipboard
fun <T : Any> DataSet<T>.seal(): DataTree<T>
Link copied to clipboard
fun <T : Any> DataSetBuilder<T>.set(value: NamedData<T>)
Link copied to clipboard
fun <T : Any> CoroutineScope.setAndWatch(name: Name, dataSet: DataSet<T>): Job

Copy given data set and mirror its changes to this DataTreeBuilder in this@setAndObserve. Returns an update Job

Link copied to clipboard
fun <T : Any> DataSet<T>.single(): NamedData<T>

Return a single Data in this DataSet. Throw error if it is not single.

Link copied to clipboard
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

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

inline fun <T : Any> DataSetBuilder<T>.static(name: String, data: T, meta: Meta = Meta.EMPTY)

Emit a static data with the fixed value

Link copied to clipboard
fun DataSet<*>.toMeta(): Meta
Link copied to clipboard

A Sequence of all children including nodes

Link copied to clipboard
fun <T : Any> DataSet<T>.withNamePrefix(prefix: Name): DataSet<T>

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