diff --git a/examples/slice_sync.zig b/examples/slice_sync.zig index 8a2a1f3..4e984b4 100644 --- a/examples/slice_sync.zig +++ b/examples/slice_sync.zig @@ -45,8 +45,11 @@ pub fn main(init: std.process.Init) !void { return error.MissingActor; } + // "-" as the actor means no DID filter: a network-wide collection slice var did: []const u8 = args[1]; - if (!std.mem.startsWith(u8, did, "did:")) { + if (std.mem.eql(u8, did, "-")) { + did = ""; + } else if (!std.mem.startsWith(u8, did, "did:")) { var resolver = zat.HandleResolver.init(init.io, allocator); defer resolver.deinit(); const resolved = try resolver.resolve(zat.Handle.parse(args[1]) orelse return error.InvalidHandle); @@ -63,14 +66,14 @@ pub fn main(init: std.process.Init) !void { while (it.next()) |c| try collections.append(init.arena.allocator(), c); } - std.debug.print("slicing the archive for {s} ({d} collection filters)\n", .{ did, collections.items.len }); + std.debug.print("slicing the archive for {s} ({d} collection filters)\n", .{ if (did.len > 0) did else "the whole network", collections.items.len }); const started = std.Io.Timestamp.now(init.io, .awake).nanoseconds; var stats = SliceStats{ .arena = init.arena.allocator() }; const result = try jetstream_sdk.ArchiveBackfill.run(init.io, allocator, .{ .host = "https://stream.waow.tech", .after_seq = 0, - .dids = &.{did}, + .dids = if (did.len > 0) &.{did} else &.{}, .collections = collections.items, // jim's sparse-backfill recipe: kind=commit changes the PLAN, not // just client filtering — without it, marker/sentinel rows admit