1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// SPDX-License-Identifier: BUSL-1.1
//! Submit a gate-rejected write through the deterministic Calvin scheduler.
//!
//! When [`admit`](super::admit) returns [`WriteAdmission::RouteToCalvin`](super::WriteAdmission),
//! the caller hands the single write here. Two shapes reach this path, each
//! routed through the existing Calvin entry point that builds a VALID write set
//! for it:
//!
//! - A **point write** whose key a pending commit holds (Document / KV / Vector /
//! single-home edge): submitted as a single-vshard
//! [`build_single_vshard_tx_class`] + [`submit_calvin_routed`]. Because it
//! targets one vshard, it uses the single-vshard opt-in rather than the strict
//! multi-vshard builder. The scheduler acquires its key on the SAME lock
//! table the gate probed, queues FIFO behind the holder, and applies it once
//! released.
//! - A **predicate write** (`BulkUpdate` / `BulkDelete` on a SINGLE
//! collection): its write set is not statically known, so it goes through
//! [`dispatch_dependent_edge_recon`] with the single-vshard opt-in, which
//! runs the pre-exec reconnaissance scan to discover the affected
//! surrogates and commits the dependent Calvin transaction. A single
//! collection resolves to one vshard, so — exactly like the point-write
//! case above — the strict multi-vshard dependent builder would reject it;
//! the opt-in lets it sequence through the scheduler instead.
//!
//! Either way the applied [`Response`] (carrying any RETURNING rows) is returned
//! so the caller surfaces it in place of a fast dispatch.
//!
//! # Boxed future — breaks the async-recursion cycle
//!
//! The Calvin path this reaches (recon / routed submit) can, in turn, dispatch
//! writes back through the same autocommit funnel that called here — an async
//! recursion cycle whose future would otherwise be infinitely sized. Returning a
//! `Pin<Box<dyn Future>>` heap-boxes exactly one edge of that cycle, giving every
//! future in the strongly-connected group a finite size. The box is paid ONLY on
//! this cold routed path; the uncontended fast path never calls this function.
use Future;
use Pin;
use crateResponse;
use crate;
use crateSharedState;
use crate;
use PhysicalPlan;
use ;
/// Synthesize the bare `Ok` command-tag response for a Calvin-routed write
/// that carried no RETURNING rows (i.e. [`route_write_to_calvin`] resolved to
/// `None`). Every caller of `route_write_to_calvin` needs this same fallback,
/// so it lives here once instead of being reconstructed at each call site.
/// Route one write to the deterministic scheduler and return the applied
/// `Response`. `None` for a plain write with no RETURNING rows — the caller then
/// synthesizes its normal command-tag response.
///
/// Returns a boxed future (rather than an `async fn`) to break the async
/// recursion cycle described in the module docs.