DataSet

interface DataSet<out T : Any>

Types

Companion
Link copied to clipboard
common
object Companion

Functions

flowData
Link copied to clipboard
common
abstract fun flowData(): Flow<NamedData<T>>

Traverse this provider or its child. The order is not guaranteed.

getData
Link copied to clipboard
common
abstract suspend fun getData(name: Name): Data<T>?

Get data with given name.

listTop
Link copied to clipboard
common
open suspend fun listTop(prefix: Name = Name.EMPTY): List<Name>

Get a snapshot of names of top level children of given node. Empty if node does not exist or is a leaf.

Properties

dataType
Link copied to clipboard
common
abstract val dataType: KType

The minimal common ancestor to all data in the node

Inheritors

ActiveDataSet
Link copied to clipboard
DataTree
Link copied to clipboard

Extensions

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

Get a subset of data starting with a given branchName

fun <T : Any> DataSet<T>.branch(branchName: String): DataSet<T>
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> 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>?
getMeta
Link copied to clipboard
common
suspend fun DataSet<*>.getMeta(): Meta?

Get a metadata node for this set if it is present

join
Link copied to clipboard
common
suspend fun <T : Any> DataSet<T>.join()
map
Link copied to clipboard
common
suspend fun <T : Any, R : Any> DataSet<T>.map(outputType: KType, coroutineContext: CoroutineContext = EmptyCoroutineContext, metaTransform: MutableMeta.() -> Unit = {}, block: suspend (T) -> R): DataTree<R>
inline suspend fun <T : Any, R : Any> DataSet<T>.map(coroutineContext: CoroutineContext = EmptyCoroutineContext, noinline metaTransform: MutableMeta.() -> Unit = {}, noinline block: suspend (T) -> R): DataTree<R>
reduceToData
Link copied to clipboard
common
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>
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
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

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

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

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

inline suspend fun <R : Any> DataSet<*>.selectOne(name: Name): NamedData<R>?
inline suspend fun <R : Any> DataSet<*>.selectOne(name: String): NamedData<R>?
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

toMeta
Link copied to clipboard
common
suspend fun DataSet<*>.toMeta(): Meta
transformWith
Link copied to clipboard
common
suspend fun <T : Any, R : Any> DataSet<T>.transformWith(action: Action<T, R>, meta: Meta = Meta.EMPTY, scope: CoroutineScope? = null): DataSet<R>
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>>
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