|
| 1 | +from __future__ import annotations |
| 2 | + |
| 3 | +from typing import Optional, List, Dict, Callable, Awaitable, Any, AsyncIterator |
| 4 | +import datetime as _dt |
| 5 | + |
| 6 | + |
| 7 | +class KeyValueGroup: |
| 8 | + key_value: Dict[str, bytes] |
| 9 | + |
| 10 | + def __init__(self, key_value: Optional[Dict[str, bytes]] = ...) -> None: ... |
| 11 | + |
| 12 | + @staticmethod |
| 13 | + def from_dict(key_value: Dict[str, bytes]) -> KeyValueGroup: ... |
| 14 | + |
| 15 | + |
| 16 | +class Message: |
| 17 | + keys: Optional[List[str]] |
| 18 | + value: bytes |
| 19 | + user_metadata: Optional[Dict[str, KeyValueGroup]] |
| 20 | + |
| 21 | + def __init__( |
| 22 | + self, |
| 23 | + value: bytes, |
| 24 | + keys: Optional[List[str]] = ..., |
| 25 | + user_metadata: Optional[Dict[str, KeyValueGroup]] = ..., |
| 26 | + ) -> None: ... |
| 27 | + |
| 28 | + |
| 29 | +class Response: |
| 30 | + id: str |
| 31 | + |
| 32 | + @staticmethod |
| 33 | + def as_success(id: str) -> Response: ... |
| 34 | + |
| 35 | + @staticmethod |
| 36 | + def as_failure(id: str, err_msg: str) -> Response: ... |
| 37 | + |
| 38 | + @staticmethod |
| 39 | + def as_fallback(id: str) -> Response: ... |
| 40 | + |
| 41 | + @staticmethod |
| 42 | + def as_serve(id: str, payload: bytes) -> Response: ... |
| 43 | + |
| 44 | + @staticmethod |
| 45 | + def as_on_success(id: str, message: Optional[Message] = ...) -> Response: ... |
| 46 | + |
| 47 | + |
| 48 | +class Responses: |
| 49 | + def __init__(self) -> None: ... |
| 50 | + |
| 51 | + def append(self, response: Response) -> None: ... |
| 52 | + |
| 53 | + |
| 54 | +class Datum: |
| 55 | + keys: List[str] |
| 56 | + value: bytes |
| 57 | + watermark: _dt.datetime |
| 58 | + eventtime: _dt.datetime |
| 59 | + id: str |
| 60 | + headers: Dict[str, str] |
| 61 | + |
| 62 | + def __repr__(self) -> str: ... |
| 63 | + |
| 64 | + def __str__(self) -> str: ... |
| 65 | + |
| 66 | + |
| 67 | +class SinkAsyncServer: |
| 68 | + def __init__( |
| 69 | + self, |
| 70 | + sock_file: str | None = ..., |
| 71 | + info_file: str | None = ..., |
| 72 | + ) -> None: ... |
| 73 | + |
| 74 | + def start(self, py_func: Callable[..., Any]) -> Awaitable[None]: ... |
| 75 | + |
| 76 | + def stop(self) -> None: ... |
| 77 | + |
| 78 | + |
| 79 | +class Sinker: |
| 80 | + async def handler(self, datums: AsyncIterator[Datum]) -> Responses: ... |
| 81 | + |
| 82 | + |
| 83 | +__all__ = [ |
| 84 | + "KeyValueGroup", |
| 85 | + "Message", |
| 86 | + "Response", |
| 87 | + "Responses", |
| 88 | + "Datum", |
| 89 | + "SinkAsyncServer", |
| 90 | + "Sinker", |
| 91 | +] |
| 92 | + |
0 commit comments