relate-engine-api 1.0.2

Shared contracts for swappable query and write engines
Documentation
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
//! Physical redo ops for the WAL (ADR-0012). Not Cypher text.
//!
//! Catalog-DDL ops (`CatalogIndexDetail`, `PutGraphType`,
//! `SetCurrentGraphType`) carry typed, serde-serializable payload models
//! captured once at DDL-execution time. `Graph::apply_redo` stores them
//! verbatim; it never re-parses Cypher text and never swallows a decode
//! failure.

use serde::{Deserialize, Serialize};

use relate_catalog::ConstraintDef;
use relate_core::{NodeId, RelId, Result, Value};

use crate::graph_type::GraphTypeSpec;

// Redo ops carry typed values; the tagged-JSON encoding is canonical on
// `Value` in relate-core (shared with the Parquet codec). The one cold
// path that still carries a raw `serde_json::Value` (`CatalogIndexDetail.options`)
// uses the helpers in `wal_format_json`. Re-exported so callers stay unchanged.
mod index;
pub use index::*;
pub mod wal_format_json;
pub use wal_format_json::{props_from_json, props_json};

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(tag = "op")]
pub enum RedoOp {
    CreateNode {
        id: NodeId,
        labels: std::sync::Arc<Vec<String>>,
        properties: std::sync::Arc<relate_core::PropertyMap>,
    },
    CreateRel {
        id: RelId,
        start: NodeId,
        end: NodeId,
        rel_type: String,
        properties: std::sync::Arc<relate_core::PropertyMap>,
    },
    DeleteNode {
        id: NodeId,
    },
    DeleteRel {
        id: RelId,
    },
    SetNodeProp {
        id: NodeId,
        key: String,
        value: Value,
    },
    RemoveNodeProp {
        id: NodeId,
        key: String,
    },
    SetRelProp {
        id: RelId,
        key: String,
        value: Value,
    },
    RemoveRelProp {
        id: RelId,
        key: String,
    },
    AddLabels {
        id: NodeId,
        labels: Vec<String>,
    },
    RemoveLabels {
        id: NodeId,
        labels: Vec<String>,
    },
    CreateIndex {
        name: String,
        label: String,
        property: String,
    },
    DropIndex {
        name: String,
    },
    CreateConstraint {
        name: String,
        #[serde(default)]
        relationship: bool,
        label: String,
        properties: Vec<String>,
        kind: String,
        #[serde(default)]
        property_type: Option<String>,
        /// The label a `labelExistence`/`sourceLabel`/`targetLabel`
        /// constraint requires to be present (CIP-177, CIP-266), part of the
        /// constraint's schema identity. `None` for every other kind and for
        /// rows written before the field existed.
        #[serde(default, skip_serializing_if = "Option::is_none")]
        enforced_label: Option<String>,
    },
    DropConstraint {
        name: String,
    },
    CatalogIndexDetail {
        name: String,
        detail: IndexDetailSpec,
        /// The evaluated `OPTIONS` map (tagged JSON values, see
        /// [`props_json`]). Decoded strictly by [`props_from_json`].
        options: serde_json::Value,
    },
    /// SHOW metadata for an explicitly enforced constraint.
    CatalogDerivedConstraint {
        constraint: relate_model::Constraint,
    },
    PutDatabase {
        name: String,
        language: u32,
        composite: bool,
    },
    /// Legacy, decode-only: `DROP DATABASE` was executable before the
    /// parser failed closed on unsupported administration commands
    /// (ADR-0116), so WALs and snapshots written by those versions may
    /// carry this op. New code never constructs it; replay is the
    /// ADR-0116 ยง8 no-op (only fixed namespaces exist, and a fixed
    /// namespace can never be dropped). Removing the variant would make
    /// serde reject the old record and hard-fail store open (ADR-0114).
    DropDatabase {
        name: String,
    },
    PutGraphType {
        name: String,
        body: GraphTypeSpec,
    },
    SetCurrentGraphType {
        body: GraphTypeSpec,
    },
    /// Source-scoped pull identity (ADR-0080). Not a graph CDC event.
    PullIdentityPut {
        source: String,
        kind: PullKind,
        remote_id: String,
        local_id: i64,
    },
    /// Store-level ontology document ops (ADR-0120 ยง3). Not graph ops:
    /// they carry the validated ontology document verbatim (at most one
    /// per store, for `neo4j`) and mutate no graph or catalog state; the
    /// derived `system_ontologies` graph is rebuilt from the document.
    /// The document is bounded by [`MAX_ONTOLOGY_SPEC_BYTES`], checked
    /// before the commit is written.
    OntologySet {
        database: String,
        spec: String,
    },
    OntologyDrop {
        database: String,
    },
}

/// The ADR-0086 object envelope bounding one ontology document
/// (ADR-0120 ยง3): 16 MiB, checked before the commit is written.
pub const MAX_ONTOLOGY_SPEC_BYTES: usize = 16 * 1024 * 1024;

/// Typed view of a store-level ontology document op (ADR-0120 ยง3), the
/// classification [`RedoOp::ontology_op`] returns: `Set` borrows the
/// verbatim document, `Drop` carries nothing. Consumers match this once
/// instead of re-matching the redo variants.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum OntologyOp<'a> {
    /// `OntologySet`: the verbatim ontology document.
    Set(&'a str),
    /// `OntologyDrop`.
    Drop,
}

impl RedoOp {
    /// The [`RedoOp::CreateConstraint`] row for one catalog definition โ€” the
    /// one crossing from the catalog shape to the durable op shape, so the
    /// field copies live once ([`RedoOp::constraint_def`] is its reader).
    pub fn create_constraint(def: ConstraintDef) -> Self {
        Self::CreateConstraint {
            name: def.name,
            relationship: def.relationship,
            label: def.label,
            properties: def.properties,
            kind: def.kind,
            property_type: def.property_type,
            enforced_label: def.enforced_label,
        }
    }

    /// The catalog definition a `CreateConstraint` row carries, `None` for
    /// every other op โ€” the reader twin of [`RedoOp::create_constraint`].
    pub fn constraint_def(&self) -> Option<ConstraintDef> {
        match self {
            Self::CreateConstraint {
                name,
                relationship,
                label,
                properties,
                kind,
                property_type,
                enforced_label,
            } => Some(ConstraintDef {
                name: name.clone(),
                relationship: *relationship,
                label: label.clone(),
                properties: properties.clone(),
                kind: kind.clone(),
                property_type: property_type.clone(),
                enforced_label: enforced_label.clone(),
            }),
            _ => None,
        }
    }

    pub fn create_node(
        id: NodeId,
        labels: impl Into<std::sync::Arc<Vec<String>>>,
        properties: impl Into<relate_core::PropertyMap>,
    ) -> Self {
        Self::CreateNode {
            id,
            labels: labels.into(),
            properties: std::sync::Arc::new(properties.into()),
        }
    }

    pub fn create_rel(
        id: RelId,
        start: NodeId,
        end: NodeId,
        rel_type: String,
        properties: impl Into<relate_core::PropertyMap>,
    ) -> Self {
        Self::CreateRel {
            id,
            start,
            end,
            rel_type,
            properties: std::sync::Arc::new(properties.into()),
        }
    }

    pub fn delete_node(id: NodeId) -> Self {
        Self::DeleteNode { id }
    }

    pub fn delete_rel(id: RelId) -> Self {
        Self::DeleteRel { id }
    }

    pub fn add_labels(id: NodeId, labels: Vec<String>) -> Self {
        Self::AddLabels { id, labels }
    }

    pub fn remove_labels(id: NodeId, labels: Vec<String>) -> Self {
        Self::RemoveLabels { id, labels }
    }

    pub fn set_node_prop(id: NodeId, key: String, value: Value) -> Self {
        Self::SetNodeProp { id, key, value }
    }

    pub fn remove_node_prop(id: NodeId, key: String) -> Self {
        Self::RemoveNodeProp { id, key }
    }

    pub fn set_rel_prop(id: RelId, key: String, value: Value) -> Self {
        Self::SetRelProp { id, key, value }
    }

    pub fn remove_rel_prop(id: RelId, key: String) -> Self {
        Self::RemoveRelProp { id, key }
    }

    /// The typed ontology classification of this op (ADR-0120 ยง3); `None`
    /// for every non-ontology op. One match โ€” [`Self::is_ontology_op`],
    /// the WAL's `MDBWAL02` segment-magic rule (ADR-0120 ยง4), the
    /// scanner's corruption check and the facade's commit scan all derive
    /// from it.
    pub fn ontology_op(&self) -> Option<OntologyOp<'_>> {
        match self {
            Self::OntologySet { spec, .. } => Some(OntologyOp::Set(spec)),
            Self::OntologyDrop { .. } => Some(OntologyOp::Drop),
            _ => None,
        }
    }

    /// Whether this is a store-level ontology document op (ADR-0120 ยง3).
    /// The WAL uses it for the `MDBWAL02` segment-magic rule (ADR-0120 ยง4)
    /// and the scanner for the corruption check; the commit-preflight seam
    /// uses it for the document-size gate.
    pub fn is_ontology_op(&self) -> bool {
        self.ontology_op().is_some()
    }

    /// The one pre-persist validation entry point, run before writing or
    /// applying redo: every persisted local ID is in range (the upper
    /// bound is reserved because installation advances the ID allocator),
    /// and an `OntologySet` document is within the 16 MiB ADR-0086 object
    /// envelope (ADR-0120 ยง3). Non-ontology ops always pass the size arm.
    pub fn validate_ids(&self) -> Result<()> {
        fn check(id: i64, what: &str) -> Result<()> {
            relate_core::validate_persisted_id(id, what)
        }
        match self {
            Self::CreateNode { id, .. }
            | Self::DeleteNode { id }
            | Self::SetNodeProp { id, .. }
            | Self::RemoveNodeProp { id, .. }
            | Self::AddLabels { id, .. }
            | Self::RemoveLabels { id, .. } => check(*id, "WAL node"),
            Self::CreateRel { id, start, end, .. } => {
                check(*id, "WAL relationship")?;
                check(*start, "WAL relationship start")?;
                check(*end, "WAL relationship end")
            }
            Self::DeleteRel { id }
            | Self::SetRelProp { id, .. }
            | Self::RemoveRelProp { id, .. } => check(*id, "WAL relationship"),
            Self::PullIdentityPut { local_id, .. } => check(*local_id, "WAL pull identity local"),
            // ADR-0120 ยง3: the ontology document is limited to 16 MiB
            // (the ADR-0086 object envelope), checked before the commit is
            // written.
            Self::OntologySet { spec, .. } => {
                if spec.len() > MAX_ONTOLOGY_SPEC_BYTES {
                    return Err(relate_core::Error::storage(format!(
                        "ontology document of {} bytes exceeds the 16 MiB limit",
                        spec.len()
                    )));
                }
                Ok(())
            }
            Self::CreateIndex { .. }
            | Self::DropIndex { .. }
            | Self::CreateConstraint { .. }
            | Self::DropConstraint { .. }
            | Self::CatalogIndexDetail { .. }
            | Self::CatalogDerivedConstraint { .. }
            | Self::PutDatabase { .. }
            | Self::DropDatabase { .. }
            | Self::PutGraphType { .. }
            | Self::SetCurrentGraphType { .. }
            | Self::OntologyDrop { .. } => Ok(()),
        }
    }

    /// Whether this is a catalog op: anything but the ten entity ops,
    /// `PullIdentityPut` and the store-level ontology ops (ADR-0120 ยง3).
    /// The write overlay replays only these when it resolves its
    /// speculative schema (ADR-0172 ยง8). Classified once, by
    /// [`Self::write_target`] (ADR-0173).
    pub fn is_catalog(&self) -> bool {
        self.write_target().is_catalog()
    }

    /// What this op writes, for ADR-0015 conflict classification. Total:
    /// every variant classifies, so a future op is a compile error here,
    /// not a silently missed conflict rule; consumers bind every payload
    /// from the one classification. Crate-internal: the consumer set is
    /// `graph::conflict`; re-export if a cross-crate consumer appears.
    pub fn write_target(&self) -> WriteTarget<'_> {
        match self {
            Self::CreateNode { id, .. } => WriteTarget::CreatedNode(*id),
            Self::CreateRel { id, start, end, .. } => WriteTarget::CreatedRel {
                id: *id,
                start: *start,
                end: *end,
            },
            Self::DeleteNode { id } => WriteTarget::DeletedNode(*id),
            Self::DeleteRel { id } => WriteTarget::DeletedRel(*id),
            Self::SetNodeProp { id, .. }
            | Self::RemoveNodeProp { id, .. }
            | Self::AddLabels { id, .. }
            | Self::RemoveLabels { id, .. } => WriteTarget::MutatedNode(*id),
            Self::SetRelProp { id, .. } | Self::RemoveRelProp { id, .. } => {
                WriteTarget::MutatedRel(*id)
            }
            Self::CreateIndex {
                name,
                label,
                property,
            } => WriteTarget::CreateIndex {
                name,
                label,
                property,
            },
            Self::DropIndex { name } => WriteTarget::DropIndex { name },
            Self::CreateConstraint { name, .. } => WriteTarget::CreateConstraint { name },
            Self::DropConstraint { name } => WriteTarget::DropConstraint { name },
            Self::CatalogIndexDetail { .. }
            | Self::CatalogDerivedConstraint { .. }
            | Self::PutDatabase { .. }
            | Self::DropDatabase { .. }
            | Self::PutGraphType { .. }
            | Self::SetCurrentGraphType { .. } => WriteTarget::CatalogMeta,
            Self::PullIdentityPut { .. } => WriteTarget::PullIdentity,
            Self::OntologySet { .. } | Self::OntologyDrop { .. } => WriteTarget::Ontology,
        }
    }

    /// Every catalog name this op mentions โ€” a label, a relationship type or
    /// a property key โ€” for the write overlay's catalog facts (ADR-0363
    /// decision 5): the redo log is the scratch's one write record, so a name
    /// a transaction has mentioned is known before the commit publishes it.
    ///
    /// Total over the enum: every variant classifies, and a new variant is a
    /// compile error here, never a silently skipped name. Monotone, like the
    /// committed catalog: an op that removes a name still mentions it โ€” a
    /// `RemoveLabels` reads exactly like an `AddLabels`, a property `REMOVE`
    /// like a `SET` โ€” because a name outlives its last write. A drop names
    /// only its schema object (an index or constraint name), never the label
    /// or key it was built on, so it cannot un-name one either.
    ///
    /// The names are the graph catalog's. Two DDL families name them without
    /// writing data: an index or constraint create names its subject label
    /// (or relationship type) and its property keys, and the typed index
    /// detail names every indexed property plus a vector index's `WITH`
    /// keys. `CreateIndex.property` carries the legacy `{props}#{KIND}#{name}`
    /// encoding on the constraint-backed rows (and a bare name on the IR
    /// path), so its head is the key
    /// ([`split_legacy_property_encoding`]). Store metadata โ€” index,
    /// constraint, database, graph-type and ontology names โ€” is not a graph
    /// catalog name and contributes nothing.
    pub fn catalog_names(&self) -> Vec<CatalogName<'_>> {
        /// Append `names` as mentions built by `mention`.
        fn push<'a>(
            out: &mut Vec<CatalogName<'a>>,
            names: impl IntoIterator<Item = &'a String>,
            mention: fn(&'a str) -> CatalogName<'a>,
        ) {
            out.extend(names.into_iter().map(|name| mention(name)));
        }

        match self {
            Self::CreateNode {
                labels, properties, ..
            } => {
                let mut names = Vec::with_capacity(labels.len() + properties.len());
                push(&mut names, labels.iter(), CatalogName::Label);
                push(&mut names, properties.keys(), CatalogName::PropertyKey);
                names
            }
            Self::CreateRel {
                rel_type,
                properties,
                ..
            } => {
                let mut names = Vec::with_capacity(1 + properties.len());
                names.push(CatalogName::RelType(rel_type));
                push(&mut names, properties.keys(), CatalogName::PropertyKey);
                names
            }
            Self::SetNodeProp { key, .. }
            | Self::RemoveNodeProp { key, .. }
            | Self::SetRelProp { key, .. }
            | Self::RemoveRelProp { key, .. } => vec![CatalogName::PropertyKey(key)],
            Self::AddLabels { labels, .. } | Self::RemoveLabels { labels, .. } => {
                let mut names = Vec::with_capacity(labels.len());
                push(&mut names, labels.iter(), CatalogName::Label);
                names
            }
            Self::CreateIndex {
                label, property, ..
            } => vec![
                CatalogName::Label(label),
                CatalogName::PropertyKey(split_legacy_property_encoding(property).0),
            ],
            Self::CreateConstraint {
                relationship,
                label,
                properties,
                ..
            } => {
                let mut names = Vec::with_capacity(1 + properties.len());
                names.push(if *relationship {
                    CatalogName::RelType(label)
                } else {
                    CatalogName::Label(label)
                });
                push(&mut names, properties.iter(), CatalogName::PropertyKey);
                names
            }
            Self::CatalogIndexDetail { detail, .. } => {
                let mut names = Vec::with_capacity(
                    detail.labels.len() + detail.properties.len() + detail.with_properties.len(),
                );
                if detail.relationship {
                    push(&mut names, detail.labels.iter(), CatalogName::RelType);
                } else {
                    push(&mut names, detail.labels.iter(), CatalogName::Label);
                }
                push(
                    &mut names,
                    detail.properties.iter(),
                    CatalogName::PropertyKey,
                );
                push(
                    &mut names,
                    detail.with_properties.iter(),
                    CatalogName::PropertyKey,
                );
                names
            }
            Self::CatalogDerivedConstraint { constraint } => {
                // The op is only constructed from a `Constraint` whose
                // `entity_type` is `EntityKind::display_name()`, and replay
                // rejects any other spelling (the same classification
                // `graph_type::validate` applies to a stored constraint).
                let relationship =
                    relate_model::EntityKind::from_display_name(&constraint.entity_type)
                        == Some(relate_model::EntityKind::Relationship);
                let mut names = Vec::with_capacity(2 + constraint.properties.len());
                names.push(if relationship {
                    CatalogName::RelType(&constraint.label)
                } else {
                    CatalogName::Label(&constraint.label)
                });
                // An enforced label is always a node label, including on a
                // relationship constraint (`sourceLabel`/`targetLabel` name
                // the endpoint's label).
                if let Some(enforced) = &constraint.enforced_label {
                    names.push(CatalogName::Label(enforced));
                }
                push(
                    &mut names,
                    constraint.properties.iter(),
                    CatalogName::PropertyKey,
                );
                names
            }
            // A delete names no catalog name, and a drop names only its own
            // schema object โ€” never the label or key it was built on.
            Self::DeleteNode { .. }
            | Self::DeleteRel { .. }
            | Self::DropIndex { .. }
            | Self::DropConstraint { .. } => Vec::new(),
            // Store metadata, not graph catalog names: database names, the
            // graph-type schema, a pull identity, an ontology document.
            Self::PutDatabase { .. }
            | Self::DropDatabase { .. }
            | Self::PutGraphType { .. }
            | Self::SetCurrentGraphType { .. }
            | Self::PullIdentityPut { .. }
            | Self::OntologySet { .. }
            | Self::OntologyDrop { .. } => Vec::new(),
        }
    }
}

/// What an op writes (ADR-0015 conflict classification). Total over
/// [`RedoOp`]: a delete is also a mutation of the same element,
/// `CreatedRel` carries the endpoints, and catalog ops carry their
/// (borrowed) identity โ€” consumers match once and bind everything from the
/// classification.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum WriteTarget<'a> {
    CreatedNode(NodeId),
    CreatedRel {
        id: RelId,
        start: NodeId,
        end: NodeId,
    },
    DeletedNode(NodeId),
    DeletedRel(RelId),
    MutatedNode(NodeId),
    MutatedRel(RelId),
    CreateIndex {
        name: &'a str,
        label: &'a str,
        property: &'a str,
    },
    DropIndex {
        name: &'a str,
    },
    CreateConstraint {
        name: &'a str,
    },
    DropConstraint {
        name: &'a str,
    },
    /// Store/catalog metadata mutation (index details, derived
    /// constraints, databases, graph type).
    CatalogMeta,
    /// Source-scoped pull identity (ADR-0080); not a graph CDC event.
    PullIdentity,
    /// Store-level ontology document (ADR-0120 ยง3): not a graph op and not
    /// catalog metadata, so it conflicts with nothing at the graph layer.
    Ontology,
}

impl WriteTarget<'_> {
    /// Whether the classified op changes the catalog (indexes, constraints,
    /// store metadata) rather than an entity or a pull identity. Total, so
    /// a new target must be placed on one side.
    pub fn is_catalog(&self) -> bool {
        match self {
            WriteTarget::CreatedNode(_)
            | WriteTarget::CreatedRel { .. }
            | WriteTarget::DeletedNode(_)
            | WriteTarget::DeletedRel(_)
            | WriteTarget::MutatedNode(_)
            | WriteTarget::MutatedRel(_)
            | WriteTarget::PullIdentity
            | WriteTarget::Ontology => false,
            WriteTarget::CreateIndex { .. }
            | WriteTarget::DropIndex { .. }
            | WriteTarget::CreateConstraint { .. }
            | WriteTarget::DropConstraint { .. }
            | WriteTarget::CatalogMeta => true,
        }
    }
}

/// One catalog name a [`RedoOp`] mentions ([`RedoOp::catalog_names`]), in
/// the namespace it belongs to. Borrowed from the op โ€” the derivation never
/// copies a name.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum CatalogName<'a> {
    Label(&'a str),
    RelType(&'a str),
    PropertyKey(&'a str),
}

/// Node vs relationship for [`RedoOp::PullIdentityPut`].
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "lowercase")]
pub enum PullKind {
    Node,
    Rel,
}

#[cfg(test)]
mod tests;