dwrtc / ch.hsr.dsl.dwrtc.util / net.tomp2p.dht.FutureGet

Extensions for net.tomp2p.dht.FutureGet

onGet

fun <T> FutureGet.onGet(emitter: (data: T?, future: BaseFuture) -> Unit): Unit

A response has been received (for one element).

onGetAll

fun <T> FutureGet.onGetAll(emitter: (data: List<T>?, future: BaseFuture) -> Unit): Unit

A response has been received (for multiple elements).

onGetAllCustom

fun <T, U> FutureGet.onGetAllCustom(emitter: (data: U?, future: BaseFuture) -> Unit, transformer: (List<T>) -> U): Unit

A response has been received (for multiple elements) and you need to transform them, before returning.

onGetCustom

fun <T, U> FutureGet.onGetCustom(emitter: (data: U?, future: BaseFuture) -> Unit, transformer: (T) -> U): Unit

A response has been received (for one element) and you need to transform it, before returning.