MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / dispatch_task

Method dispatch_task

nodedb/src/control/server/pgwire/handler/dispatch.rs:23–41  ·  view source on GitHub ↗

Dispatch a single physical task and wait for the response. In cluster mode, write operations are proposed to Raft first and only executed on the Data Plane after quorum commit. Reads bypass Raft. `user_id` is forwarded to the `Request` for DML audit attribution. Pass `None` for system-generated tasks (triggers, maintenance, etc.).

(
        &self,
        task: PhysicalTask,
        user_id: Option<Arc<str>>,
    )

Source from the content-addressed store, hash-verified

21 /// `user_id` is forwarded to the `Request` for DML audit attribution.
22 /// Pass `None` for system-generated tasks (triggers, maintenance, etc.).
23 pub(super) async fn dispatch_task(
24 &self,
25 task: PhysicalTask,
26 user_id: Option<Arc<str>>,
27 ) -> crate::Result<Response> {
28 let tenant_id = task.tenant_id;
29 let result = self.dispatch_task_inner(task, user_id).await;
30 // Advance per-tenant observed write-HLC high-water on any
31 // successful dispatch (local, raft-replicated, or broadcast).
32 // Used by RESTORE's staleness gate. Backup captures envelope
33 // watermark AFTER its own fan-out, so envelope.wm dominates
34 // tenant_wm on a fresh backup.
35 if let Ok(ref resp) = result
36 && resp.status == crate::bridge::envelope::Status::Ok
37 {
38 self.state.advance_tenant_write_hlc(tenant_id.as_u64());
39 }
40 result
41 }
42
43 async fn dispatch_task_inner(
44 &self,

Callers 6

dispatch_task_innerMethod · 0.80
execute_facet_counts_sqlFunction · 0.80
dispatch_task_loopMethod · 0.80

Calls 3

dispatch_task_innerMethod · 0.80
as_u64Method · 0.45

Tested by

no test coverage detected