This is an automated email from the ASF dual-hosted git repository. toulmean pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-tuweni.git
commit 65856ce88c15a0daa6fe49676f404ccbec4a71f0 Author: Antoine Toulme <anto...@lunar-ocean.com> AuthorDate: Wed Jun 12 10:05:00 2019 -0700 Add more docs --- .../org/apache/tuweni/hobbits/HobbitsTransport.kt | 9 +++++++++ .../main/kotlin/org/apache/tuweni/hobbits/Relayer.kt | 17 ++++++++++++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/hobbits/src/main/kotlin/org/apache/tuweni/hobbits/HobbitsTransport.kt b/hobbits/src/main/kotlin/org/apache/tuweni/hobbits/HobbitsTransport.kt index 98e0f6a..185ce5c 100644 --- a/hobbits/src/main/kotlin/org/apache/tuweni/hobbits/HobbitsTransport.kt +++ b/hobbits/src/main/kotlin/org/apache/tuweni/hobbits/HobbitsTransport.kt @@ -239,6 +239,9 @@ class HobbitsTransport( } } + /** + * Starts the hobbits transport. + */ suspend fun start() { if (started.compareAndSet(false, true)) { httpClient = vertx.createHttpClient() @@ -344,6 +347,9 @@ class HobbitsTransport( } } + /** + * Stops the hobbits transport. + */ fun stop() { if (started.compareAndSet(true, false)) { httpClient!!.close() @@ -382,6 +388,9 @@ internal data class Endpoint( val handler: (Message) -> Unit ) +/** + * Transport types supported. + */ enum class Transport() { HTTP, TCP, diff --git a/hobbits/src/main/kotlin/org/apache/tuweni/hobbits/Relayer.kt b/hobbits/src/main/kotlin/org/apache/tuweni/hobbits/Relayer.kt index cd97281..e5d2ff3 100644 --- a/hobbits/src/main/kotlin/org/apache/tuweni/hobbits/Relayer.kt +++ b/hobbits/src/main/kotlin/org/apache/tuweni/hobbits/Relayer.kt @@ -23,8 +23,17 @@ import kotlinx.coroutines.async import java.net.URI import kotlin.coroutines.CoroutineContext +/** + * Relays messages between two endpoints, with an interceptor reading passed messages. + * + * @param vertx a Vert.x instance + * @param bind the endpoint to bind to + * @param to the endpoint to send to + * @param interceptor the interceptor function consuming messages being relayed + * @param coroutineContext the coroutine context of the relayer + */ class Relayer( - private val vertx: Vertx, + vertx: Vertx, bind: String, to: String, interceptor: (Message) -> Unit, @@ -71,10 +80,16 @@ class Relayer( } } + /** + * Starts the relayer. + */ suspend fun start() { transport.start() } + /** + * Stops the relayer. + */ fun stop() { transport.stop() } --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@tuweni.apache.org For additional commands, e-mail: commits-h...@tuweni.apache.org