The table whose chain owns the asynchronous work.
The asynchronous extension operation to queue.
The asynchronous work to run at the barrier's position in the chain.
The public method name used for diagnostics.
A snapshot of the public method parameters used for diagnostics.
Nothing. The public builder should return its target table.
import type { SimpleTable } from "@nshiab/simple-data-analysis-core";
import { queueAsyncBarrier } from "@nshiab/simple-data-analysis-core/helpers";
function loadRemote(table: SimpleTable, url: string): SimpleTable {
queueAsyncBarrier(table, {
method: "loadRemote()",
parameters: { url },
execute: async () => {
const rows = await fetch(url).then((response) => response.json()) as
{ [key: string]: unknown }[];
table.loadArray(rows);
},
});
return table;
}
Queues asynchronous extension work as one ordered table-builder step. Builder operations queued by
executeare scoped to the barrier and drain before its observer queries and before later chained operations.executemust await all asynchronous work that can queue table operations. Detached work is outside the barrier's program-order scope.If
executerejects, captured builder operations that have not already drained are discarded. Operations drained by an observer insideexecuteremain applied; an asynchronous barrier does not provide database rollback.This differs from a failure while executing queued builders: during replay, the failing table's remaining chain is aborted, but unexecuted work for other tables is requeued for their next observation.