ShallowRedisSaver - A Redis checkpoint saver that only keeps the latest checkpoint per thread.
This is a memory-optimized variant that:
class ShallowRedisSaverDelete all checkpoints and writes associated with a specific thread ID.
Walk the parent chain returning per-channel writes + seed, used to
reconstruct DeltaChannel state from checkpoint_writes.
For each requested channel, walks ancestors of the checkpoint identified
by config (following parentConfig) and accumulates the pending writes
for that channel. The walk terminates per-channel at the nearest ancestor
whose channel_values[ch] is populated; that value is returned as seed.
If the walk reaches the root without finding a stored value, seed is
omitted from that channel's entry โ the consumer treats the absence as
"start empty".
Walks the parent chain (not list({ before })): for forked threads, only
on-path ancestors contribute.
Within a single checkpoint, writes are ordered by writesSortKey โ
(task_path, task_id, idx) โ the order live execution applies a
superstep's task writes in. This default walk cannot sort by path itself
(CheckpointPendingWrite carries no path), so it relies on getTuple
returning pendingWrites already in writesSortKey order, which the
contract above requires of every saver. Writes stored without a
task_path (graph input, Command updates, rows predating the
column) sort first, by task_id.
The default implementation walks getTuple + parentConfig once for all
channels โ each ancestor visited once, not once per channel. Savers with
direct storage access (e.g. MemorySaver) override for performance; the
return contract is fixed here.
Generate the next version ID for a channel.
Default is to use integer versions, incrementing by 1. If you override, you can use str/int/float versions, as long as they are monotonically increasing.
Store intermediate writes linked to a checkpoint.
taskPath is the serialized path of the task creating the writes (see
writesSortKey). Implementations should persist it when they can, and
must return pendingWrites from getTuple/list in writesSortKey
order โ live execution applies a superstep's writes in that order, so
replaying in any other order can rebuild a different value for an
order-sensitive reducer. Writes stored without a path (rows predating it,
savers that don't persist one) sort first by taskId, which is also the
order live execution applies input in.
Prevent JSON.stringify from traversing backend clients (e.g. pg Pool
timers) when a checkpointer is present in runnable configurable.