Skip to main content

uqa_execution/mutation/
candidate.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! Typed physical identities and committed-chain lock outcomes shared by every DML command.
8
9use uqa_core::DocId;
10use uqa_storage::document_store::Document;
11
12#[derive(Debug, Clone, PartialEq)]
13pub struct MutationCandidate<C = ()> {
14    pub identity: PhysicalDocumentIdentity,
15    pub document: Document,
16    pub context: C,
17}
18
19#[derive(Debug, Clone, PartialEq)]
20pub struct MutationRewriteCandidate<C = ()> {
21    pub identity: PhysicalDocumentIdentity,
22    pub old_document: Document,
23    pub proposed_document: Document,
24    pub context: C,
25}
26
27/// Outcome of following a logical DML target through its committed update chain.
28pub enum MutationLockTarget {
29    Present { doc_id: DocId, recheck: bool },
30    Deleted,
31}
32
33/// Outcome of following a physical DML target across primary-key rewrites and partition moves.
34pub enum PhysicalMutationLockTarget {
35    Present {
36        identity: PhysicalDocumentIdentity,
37        recheck: bool,
38    },
39    Deleted,
40}
41
42#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
43pub struct PhysicalDocumentIdentity {
44    pub table: String,
45    pub doc_id: DocId,
46}