Skip to content

Commit 71df6ac

Browse files
committed
chore: rename Sink.submit to receive
1 parent 03b182a commit 71df6ac

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

src/main/kotlin/dev/silenium/libs/flows/api/Sink.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ interface Sink<T, P> : FlowCollector<FlowItem<T, P>>, AutoCloseable {
1818

1919
fun configure(pad: UInt, metadata: P): Result<Unit>
2020

21-
suspend fun submit(item: FlowItem<T, P>): Result<Unit>
21+
suspend fun receive(item: FlowItem<T, P>): Result<Unit>
2222

2323
override suspend fun emit(value: FlowItem<T, P>) {
2424
check(inputMetadata.containsKey(value.pad)) { "pad not configured" }
2525
check(inputMetadata[value.pad] == value.metadata) { "metadata mismatch" }
2626

27-
submit(value).getOrThrow()
27+
receive(value).getOrThrow()
2828
}
2929
}

src/test/kotlin/dev/silenium/libs/flows/test/Base64Decoder.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Base64Decoder : SourceBase<ByteArray, DataType>(), Transformer<Base64Buffe
3535
return Result.success(Unit)
3636
}
3737

38-
override suspend fun submit(item: FlowItem<Base64Buffer, DataType>): Result<Unit> = runCatching {
38+
override suspend fun receive(item: FlowItem<Base64Buffer, DataType>): Result<Unit> = runCatching {
3939
queue.send(FlowItem(item.pad, DataType.PLAIN, item.value))
4040
}
4141

src/test/kotlin/dev/silenium/libs/flows/test/BufferSink.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class BufferSink<T, P>(vararg pads: Pair<UInt, P>) : Sink<T, P> {
1515
private val flow_ = MutableStateFlow<Map<UInt, List<FlowItem<T, P>>>>(emptyMap())
1616
val flow: StateFlow<Map<UInt, List<FlowItem<T, P>>>> = flow_.asStateFlow()
1717

18-
override suspend fun submit(item: FlowItem<T, P>): Result<Unit> {
18+
override suspend fun receive(item: FlowItem<T, P>): Result<Unit> {
1919
buffer_.getOrPut(item.pad, ::mutableListOf).add(item)
2020
flow_.emit(buffer)
2121
return Result.success(Unit)

0 commit comments

Comments
 (0)