ds_provider_mock_py_lib.dataset.engines._read_checkpoint¶
File: _read_checkpoint.py
Region: ds_provider_mock_py_lib/dataset/engines
Checkpoint models for mock read continuation.
The shape matches Xledger: incremental watermark plus optional pagination cursor. For the mock provider:
incremental.valueis the last completed batch number (0after a successful full load).pagination.valueis an opaque"{batch}:{page}"cursor used to resume an unfinished paginated traversal.
Example
>>> from ds_provider_mock_py_lib.dataset.engines._read_checkpoint import Checkpoint
>>> checkpoint = Checkpoint.deserialize({})
>>> checkpoint.incremental.value is None
True
>>> checkpoint.pagination.value is None
True
Classes¶
Store the persisted incremental watermark. |
|
Store the persisted pagination continuation token. |
|
Store checkpoint state for resumable reads. |
Functions¶
|
Encode a pagination cursor for the current batch and page. |
|
Decode a pagination cursor into batch and page. |
Module Contents¶
- class ds_provider_mock_py_lib.dataset.engines._read_checkpoint.CheckpointIncremental[source]¶
Bases:
ds_common_serde_py_lib.serializable.SerializableStore the persisted incremental watermark.
- value¶
Last completed batch number, or
Nonewhen no snapshot exists.
- value: Any = None¶
- class ds_provider_mock_py_lib.dataset.engines._read_checkpoint.CheckpointPagination[source]¶
Bases:
ds_common_serde_py_lib.serializable.SerializableStore the persisted pagination continuation token.
- value¶
Cursor used to resume an unfinished paginated traversal.
- value: str | None = None¶
- class ds_provider_mock_py_lib.dataset.engines._read_checkpoint.Checkpoint[source]¶
Bases:
ds_common_serde_py_lib.serializable.SerializableStore checkpoint state for resumable reads.
- incremental¶
Persisted incremental watermark state.
- pagination¶
Persisted pagination continuation state.
- incremental: CheckpointIncremental¶
- pagination: CheckpointPagination¶
- ds_provider_mock_py_lib.dataset.engines._read_checkpoint.encode_pagination_cursor(*, batch: int, page: int) str[source]¶
Encode a pagination cursor for the current batch and page.
- Parameters:
batch – Batch currently being read.
page – 1-based page to resume from.
- Returns:
Opaque
"{batch}:{page}"cursor string.
- ds_provider_mock_py_lib.dataset.engines._read_checkpoint.decode_pagination_cursor(value: str) tuple[int, int][source]¶
Decode a pagination cursor into batch and page.
- Parameters:
value – Cursor previously produced by
encode_pagination_cursor.- Returns:
Tuple of
(batch, page).- Raises:
ValueError – If the cursor is not a valid
batch:pagepair.