Operator 계약
mapIndexed { i, v → "$i:$v" }collection마다 0부터 증가하는 index를 같은 위치의 값에 결합합니다.
#430 · bluetape4k-projects · 2.0.0 · coroutines Flow
6개 family의 reactive operator 66개를 살펴봅니다. family별 operator를 선택하고 input, rule, output mapping, terminal contract를 같은 시간축에서 재생합니다.
transform
Flow의 시간축 계약을 유지하면서 runtime type, payload, projection, 누적 상태를 바꿉니다.
Operator 계약
mapIndexed { i, v → "$i:$v" }collection마다 0부터 증가하는 index를 같은 위치의 값에 결합합니다.
input → operator → output
admission
값이나 inner Flow가 언제 들어올 수 있는지, 재진입을 버릴지, 언제 수집을 전환하거나 끝낼지 결정합니다.
Operator 계약
skipUntil(ready)notifier가 열리기 전 A·B는 버리고, 이후 C·D만 통과시킵니다.
input → operator → output
time
시간, 개수 경계, rolling state, key를 사용해 burst를 간격 있는 값, batch, window, group으로 재구성합니다.
Operator 계약
bufferTimeout(maxSize=3, timeout=1.s)첫 batch는 size=3에서 닫히고, 두 번째 partial batch는 timeout 또는 완료에서 flush됩니다.
input → operator → output
combine
여러 Flow를 sample, race, concat, merge, repeat하거나 outer 순서를 보존하는 방식으로 조정합니다.
Operator 계약
withLatestFrom(other)other가 아직 없을 때 primary 1은 누락되고, 2와 3이 최신 A·B를 sample합니다.
input → operator → output
async
제한된 동시 작업을 실행하고 결과 순서를 유지하거나 완화하며, 독립 rail을 변환한 뒤 다시 Flow로 합칩니다.
Operator 계약
asyncFlow.map(::enrich)추가 transform도 Deferred chain 안에서 실행되며 최종 await 순서는 유지됩니다.
input → operator → output
error
deadline과 failure를 terminal error, fallback, 값, 검사 가능한 signal object로 바꾸고 다시 복원합니다.
Operator 계약
catchAndResume(fallback)실패 시점부터 fallback Flow를 새 경로로 구독해 이벤트 스트림을 계속합니다.
input → operator → output