From 99f556fdc2dbdcd8fd1984efa0e0f70bd08e2993 Mon Sep 17 00:00:00 2001 From: zzstoatzz Date: Sat, 8 Aug 2026 02:35:08 -0500 Subject: [PATCH] ArchiveBackfill.replaySegment: decode a sealed jss segment from memory offline counterpart of run() for segments already on disk or fetched out-of-band; same handler contract and options. gives local tooling and benchmarks a decode entry without the plan/fetch machinery. Co-Authored-By: Claude Fable 5 --- src/internal/streaming/archive_backfill.zig | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/internal/streaming/archive_backfill.zig b/src/internal/streaming/archive_backfill.zig index 6b0822b..f2a84d0 100644 --- a/src/internal/streaming/archive_backfill.zig +++ b/src/internal/streaming/archive_backfill.zig @@ -259,6 +259,22 @@ const FetchWindow = struct { } }; +/// decode every block of a sealed in-memory jss segment through `handler` — +/// the offline counterpart of `run` for a segment already on disk (local +/// archive copies, getSegment bodies fetched out-of-band). same delivery +/// contract; Options.host is unused. honors collections/dids/max_blocks/ +/// verify_checksums. +pub fn replaySegment(allocator: Allocator, body: []const u8, options: Options, handler: anytype) !Result { + var result: Result = .{ .planned_through_seq = 0, .sealed_tip_seq = 0 }; + try deliverSegment(allocator, body, options, .{ + .name = "", + .index = 0, + .checksum = null, + .blocks = null, + }, handler, &result); + return result; +} + /// resume skip: everything at or before start_after is already delivered fn skippedByResume(start_after: ?Position, segment_index: u32, block_index: u32) bool { const sa = start_after orelse return false; -- 2.51.2