[Pandora] Utilities for bidirectional streaming APIs
The OnPair interface (as well as potential others in the future) are bidirectional streaming rpcs. This CL adds a utility in Kotlin to emulate the native-Kotlin gRPC interface on top of the Java interface provided (Flow -> Flow rather than callback-based). In Python, the native interface consumes an iterator and supplies a new one. So to interleave rx and tx messages, we need multiple threads. This CL also adds a client-side utility to simplify usage, by making it mimic channels (which are the grpc.aio interface, as well as what Go gRPC does). It means we consume one thread for every active streaming gRPC call, but this is unavoidable unless we use asyncio channels, which would require replacing all the mmi2grpc calls with async calls. Bug: 242326310 Test: next CL Tag: #feature Ignore-AOSP-First: Cherry-picked from AOSP Merged-In: I526982d3163120689797919382a7dff8ff33378f Change-Id: I526982d3163120689797919382a7dff8ff33378f
Loading
Please register or sign in to comment