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.value is the last completed batch number (0 after a successful full load).

  • pagination.value is 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

CheckpointIncremental

Store the persisted incremental watermark.

CheckpointPagination

Store the persisted pagination continuation token.

Checkpoint

Store checkpoint state for resumable reads.

Functions

encode_pagination_cursor(→ str)

Encode a pagination cursor for the current batch and page.

decode_pagination_cursor(→ tuple[int, int])

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.Serializable

Store the persisted incremental watermark.

value

Last completed batch number, or None when 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.Serializable

Store 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.Serializable

Store 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:page pair.