DataSource

interface DataSource<out T : Any> : DataSet<T> , CoroutineScope

A DataSet with propagated updates.

Inheritors

Properties

Link copied to clipboard
Link copied to clipboard
abstract val dataType: KType

The minimal common ancestor to all data in the node

Link copied to clipboard
abstract val meta: Meta

Meta-data associated with this node. If no meta is provided, returns Meta.EMPTY.

Link copied to clipboard
val CoroutineScope.monitor: CoroutineMonitor?
Link copied to clipboard
abstract val updates: Flow<Name>

A flow of updated item names. Updates are propagated in a form of Flow of names of updated nodes. Those can include new data items and replacement of existing ones. The replaced items could update existing data content and replace it completely, so they should be pulled again.

Link copied to clipboard
val <T : Any> DataSet<T>.updates: Flow<Name>
Link copied to clipboard

Functions

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

Link copied to clipboard
open fun close()

Stop generating updates from this DataSource

Link copied to clipboard
suspend fun <T : Any> DataSet<T>.computeAndJoinAll()
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> 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
abstract operator fun get(name: Name): Data<T>?

Get data with given name.

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
abstract operator fun iterator(): Iterator<NamedData<T>>

Traverse this DataSet returning named data instances. The order is not guaranteed.

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>
Link copied to clipboard
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>
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> 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
fun DataSet<*>.toMeta(): Meta
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