ds_protocol_http_py_lib.dataset.pagination.strategies.base¶
File: base.py
Region: ds_protocol_http_py_lib/dataset/pagination/strategies/base
Base ABC for registered pagination strategies (page-variation hooks only).
Concrete strategies (offset, page-number, cursor, …) inherit this. The HTTP
drain loop lives on Paginate, which
uses a strategy — strategies do not own run.
Attributes¶
Classes¶
Strategy-owned traversal state for one paginated read. |
|
Page-variation contract parameterized by the strategy settings nest. |
Functions¶
|
True when the page is empty or shorter than the requested page size. |
Module Contents¶
- ds_protocol_http_py_lib.dataset.pagination.strategies.base.ConfigT¶
- class ds_protocol_http_py_lib.dataset.pagination.strategies.base.PageState[source]¶
Strategy-owned traversal state for one paginated read.
- values: dict[str, Any]¶
Opaque strategy values (offset, page, cursor, …).
- page_index: int = 0¶
Zero-based count of pages fetched so far.
- class ds_protocol_http_py_lib.dataset.pagination.strategies.base.PaginationStrategyHandler[source]¶
Bases:
abc.ABC,Generic[ConfigT]Page-variation contract parameterized by the strategy settings nest.
Each concrete strategy binds
ConfigTto its nest type (e.g.CursorPaginationSettings) so hook signatures stay precise.- abstractmethod initial_state(cfg: ConfigT, checkpoint_slice: dict[str, Any] | None) PageState[source]¶
Build the starting page state, optionally restoring from checkpoint.
- abstractmethod inject(request: ds_protocol_http_py_lib.utils.http.request.RequestSnapshot, state: PageState, cfg: ConfigT) ds_protocol_http_py_lib.utils.http.request.RequestSnapshot[source]¶
Return a request snapshot with pagination values applied.
- abstractmethod advance(*, body: Any, headers: Any, items: list[Any], state: PageState, cfg: ConfigT) PageState[source]¶
Advance state after a successful page response.
- abstractmethod should_stop(*, body: Any, headers: Any, items: list[Any], state: PageState, cfg: ConfigT) bool[source]¶
Return True when traversal should terminate after this page.