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

Function to_replicated_entry

nodedb/src/control/wal_replication/encode.rs:10–262  ·  view source on GitHub ↗
(
    tenant_id: TenantId,
    vshard_id: VShardId,
    plan: &PhysicalPlan,
)

Source from the content-addressed store, hash-verified

8use nodedb_physical::physical_plan::{CrdtOp, DocumentOp, GraphOp, KvOp, VectorOp};
9
10pub fn to_replicated_entry(
11 tenant_id: TenantId,
12 vshard_id: VShardId,
13 plan: &PhysicalPlan,
14) -> Option<ReplicatedEntry> {
15 let write = match plan {
16 PhysicalPlan::Document(DocumentOp::PointPut {
17 collection,
18 document_id,
19 value,
20 surrogate: _,
21 pk_bytes: _,
22 }) => ReplicatedWrite::PointPut {
23 collection: collection.clone(),
24 document_id: document_id.clone(),
25 value: value.clone(),
26 },
27 PhysicalPlan::Document(DocumentOp::PointInsert {
28 collection,
29 document_id,
30 value,
31 if_absent,
32 surrogate: _,
33 }) => ReplicatedWrite::PointInsert {
34 collection: collection.clone(),
35 document_id: document_id.clone(),
36 value: value.clone(),
37 if_absent: *if_absent,
38 },
39 PhysicalPlan::Document(DocumentOp::PointDelete {
40 collection,
41 document_id,
42 ..
43 }) => ReplicatedWrite::PointDelete {
44 collection: collection.clone(),
45 document_id: document_id.clone(),
46 },
47 PhysicalPlan::Document(DocumentOp::PointUpdate {
48 collection,
49 document_id,
50 updates,
51 ..
52 }) => ReplicatedWrite::PointUpdate {
53 collection: collection.clone(),
54 document_id: document_id.clone(),
55 updates: updates.clone(),
56 },
57 PhysicalPlan::Vector(VectorOp::Insert {
58 collection,
59 vector,
60 dim,
61 field_name,
62 surrogate: _,
63 }) => ReplicatedWrite::VectorInsert {
64 collection: collection.clone(),
65 vector: vector.clone(),
66 dim: *dim,
67 field_name: field_name.clone(),

Callers 11

read_ops_not_replicatedFunction · 0.85
handle_commitMethod · 0.85
dispatch_task_innerMethod · 0.85
dispatch_task_loopMethod · 0.85
consistency_for_tasksFunction · 0.85
execute_plannedFunction · 0.85
handle_commitFunction · 0.85

Calls 3

cloneMethod · 0.45
as_u64Method · 0.45
as_u32Method · 0.45