Skip to main content

linkrs_query/executor/streaming/operators/spec/
sink.rs

1//! Immutable configuration for sink (data modification) operators.
2
3use linkrs_core::types::expr::Expression;
4
5/// Copy target type for COPY FROM
6#[derive(Debug, Clone, PartialEq, Eq)]
7pub enum CopyTarget {
8    Vertex(String),
9    Edge(String),
10}
11
12/// Immutable config for sink (data modification) operators.
13#[derive(Debug, Clone)]
14pub enum SinkSpec {
15    InsertVertices {
16        space_name: String,
17        vertex_properties: Vec<(String, Expression)>,
18        tag: String,
19        /// Property column names for the single tag.
20        tag_property_names: Vec<String>,
21        if_not_exists: bool,
22    },
23    InsertEdges {
24        space_name: String,
25        src_col: String,
26        dst_col: String,
27        rank_col: String,
28        edge_type: String,
29        edge_properties: Vec<(String, Expression)>,
30        if_not_exists: bool,
31    },
32    UpdateVertices {
33        space_name: String,
34        tag_name: String,
35        updates: Vec<(String, Expression)>,
36        condition: Option<Expression>,
37        is_upsert: bool,
38        replace_properties: bool,
39    },
40    UpdateEdges {
41        space_name: String,
42        src_col: String,
43        dst_col: String,
44        rank_col: String,
45        edge_type: String,
46        updates: Vec<(String, Expression)>,
47        condition: Option<Expression>,
48        is_upsert: bool,
49        replace_properties: bool,
50    },
51    DeleteVertices {
52        space_name: String,
53        tag: String,
54        vertex_id_col: String,
55        cascade: bool,
56    },
57    DeleteEdges {
58        space_name: String,
59        src_col: String,
60        dst_col: String,
61        rank_col: String,
62        edge_type: String,
63    },
64    PipeDeleteVertices {
65        space_name: String,
66        vertex_id_col: String,
67        cascade: bool,
68        vertex_id_is_literal: bool,
69    },
70    PipeDeleteEdges {
71        space_name: String,
72        src_col: String,
73        dst_col: String,
74        rank_col: String,
75        edge_type: String,
76    },
77    CopyFrom {
78        space_name: String,
79        target: CopyTarget,
80        file_paths: Vec<String>,
81        by_column: bool,
82        header: bool,
83        delimiter: u8,
84        batch_size: usize,
85    },
86    CopyTo {
87        space_name: String,
88        target: CopyTarget,
89        file_path: String,
90        header: bool,
91        delimiter: u8,
92    },
93}