| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,5 +1,5 @@ | |||
| 1 | 1 | import abc | |
| 2 | - from typing import Any | ||
| 2 | + from typing import Any, Iterable | ||
| 3 | 3 | ||
| 4 | 4 | class _BaseResumptionStrategy(abc.ABC): | |
| 5 | 5 | """Abstract base class defining the interface for a bidi stream strategy. | |
@@ -12,7 +12,7 @@ class _BaseResumptionStrategy(abc.ABC): | |||
| 12 | 12 | """ | |
| 13 | 13 | ||
| 14 | 14 | @abc.abstractmethod | |
| 15 | - def generate_requests(self, state: Any): | ||
| 15 | + def generate_requests(self, state: Any) -> Iterable[Any]: | ||
| 16 | 16 | """Generates the next batch of requests based on the current state. | |
| 17 | 17 | ||
| 18 | 18 | This method is called at the beginning of each retry attempt. It should | |
@@ -29,25 +29,21 @@ def generate_requests(self, state: Any): | |||
| 29 | 29 | pass | |
| 30 | 30 | ||
| 31 | 31 | @abc.abstractmethod | |
| 32 | - def update_state_from_response(self, state: Any): | ||
| 32 | + def update_state_from_response(self, state: Any) -> None: | ||
| 33 | 33 | """Updates the state based on a successful server response. | |
| 34 | 34 | ||
| 35 | 35 | This method is called for every message received from the server. It is | |
| 36 | 36 | responsible for processing the response and updating the shared state | |
| 37 | - object. For bidi reads, this is where data integrity checks should be | ||
| 38 | - performed and the `bytes_written` for the corresponding range should be | ||
| 39 | - updated. | ||
| 37 | + object. | ||
| 40 | 38 | ||
| 41 | 39 | :type state: Any | |
| 42 | 40 | :param state: The shared state object for the operation, which will be | |
| 43 | 41 | mutated by this method. | |
| 44 | - | ||
| 45 | - :rtype: None | ||
| 46 | 42 | """ | |
| 47 | 43 | pass | |
| 48 | 44 | ||
| 49 | 45 | @abc.abstractmethod | |
| 50 | - async def recover_state_on_failure(self, error: Exception, state: Any): | ||
| 46 | + async def recover_state_on_failure(self, error: Exception, state: Any) -> None: | ||
| 51 | 47 | """Prepares the state for the next retry attempt after a failure. | |
| 52 | 48 | ||
| 53 | 49 | This method is called when a retriable gRPC error occurs. It is | |
@@ -61,7 +57,5 @@ async def recover_state_on_failure(self, error: Exception, state: Any): | |||
| 61 | 57 | ||
| 62 | 58 | :type state: Any | |
| 63 | 59 | :param state: The shared state object for the operation. | |
| 64 | - | ||
| 65 | - :rtype: None | ||
| 66 | 60 | """ | |
| 67 | 61 | pass | |
| Back | FazBrowse Home | New Git URL |
0 commit comments