vitess_grpc/generated/
vschema.rs

1/// RoutingRules specify the high level routing rules for the VSchema.
2#[allow(clippy::derive_partial_eq_without_eq)]
3#[derive(Clone, PartialEq, ::prost::Message)]
4pub struct RoutingRules {
5    /// rules should ideally be a map. However protos dont't allow
6    /// repeated fields as elements of a map. So, we use a list
7    /// instead.
8    #[prost(message, repeated, tag = "1")]
9    pub rules: ::prost::alloc::vec::Vec<RoutingRule>,
10}
11/// RoutingRule specifies a routing rule.
12#[allow(clippy::derive_partial_eq_without_eq)]
13#[derive(Clone, PartialEq, ::prost::Message)]
14pub struct RoutingRule {
15    #[prost(string, tag = "1")]
16    pub from_table: ::prost::alloc::string::String,
17    #[prost(string, repeated, tag = "2")]
18    pub to_tables: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
19}
20/// Keyspace is the vschema for a keyspace.
21#[allow(clippy::derive_partial_eq_without_eq)]
22#[derive(Clone, PartialEq, ::prost::Message)]
23pub struct Keyspace {
24    /// If sharded is false, vindexes and tables are ignored.
25    #[prost(bool, tag = "1")]
26    pub sharded: bool,
27    #[prost(map = "string, message", tag = "2")]
28    pub vindexes: ::std::collections::HashMap<::prost::alloc::string::String, Vindex>,
29    #[prost(map = "string, message", tag = "3")]
30    pub tables: ::std::collections::HashMap<::prost::alloc::string::String, Table>,
31    /// If require_explicit_routing is true, vindexes and tables are not added to global routing
32    #[prost(bool, tag = "4")]
33    pub require_explicit_routing: bool,
34    /// foreign_key_mode dictates how Vitess should handle foreign keys for this keyspace.
35    #[prost(enumeration = "keyspace::ForeignKeyMode", tag = "5")]
36    pub foreign_key_mode: i32,
37}
38/// Nested message and enum types in `Keyspace`.
39pub mod keyspace {
40    #[derive(
41        Clone,
42        Copy,
43        Debug,
44        PartialEq,
45        Eq,
46        Hash,
47        PartialOrd,
48        Ord,
49        ::prost::Enumeration
50    )]
51    #[repr(i32)]
52    pub enum ForeignKeyMode {
53        Unspecified = 0,
54        Disallow = 1,
55        Unmanaged = 2,
56        Managed = 3,
57    }
58    impl ForeignKeyMode {
59        /// String value of the enum field names used in the ProtoBuf definition.
60        ///
61        /// The values are not transformed in any way and thus are considered stable
62        /// (if the ProtoBuf definition does not change) and safe for programmatic use.
63        pub fn as_str_name(&self) -> &'static str {
64            match self {
65                ForeignKeyMode::Unspecified => "unspecified",
66                ForeignKeyMode::Disallow => "disallow",
67                ForeignKeyMode::Unmanaged => "unmanaged",
68                ForeignKeyMode::Managed => "managed",
69            }
70        }
71        /// Creates an enum from field names used in the ProtoBuf definition.
72        pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
73            match value {
74                "unspecified" => Some(Self::Unspecified),
75                "disallow" => Some(Self::Disallow),
76                "unmanaged" => Some(Self::Unmanaged),
77                "managed" => Some(Self::Managed),
78                _ => None,
79            }
80        }
81    }
82}
83/// Vindex is the vindex info for a Keyspace.
84#[allow(clippy::derive_partial_eq_without_eq)]
85#[derive(Clone, PartialEq, ::prost::Message)]
86pub struct Vindex {
87    /// The type must match one of the predefined
88    /// (or plugged in) vindex names.
89    #[prost(string, tag = "1")]
90    pub r#type: ::prost::alloc::string::String,
91    /// params is a map of attribute value pairs
92    /// that must be defined as required by the
93    /// vindex constructors. The values can only
94    /// be strings.
95    #[prost(map = "string, string", tag = "2")]
96    pub params: ::std::collections::HashMap<
97        ::prost::alloc::string::String,
98        ::prost::alloc::string::String,
99    >,
100    /// A lookup vindex can have an owner table defined.
101    /// If so, rows in the lookup table are created or
102    /// deleted in sync with corresponding rows in the
103    /// owner table.
104    #[prost(string, tag = "3")]
105    pub owner: ::prost::alloc::string::String,
106}
107/// Table is the table info for a Keyspace.
108#[allow(clippy::derive_partial_eq_without_eq)]
109#[derive(Clone, PartialEq, ::prost::Message)]
110pub struct Table {
111    /// If the table is a sequence, type must be
112    /// "sequence".
113    ///
114    /// If the table is a reference, type must be
115    /// "reference".
116    /// See <https://vitess.io/docs/reference/features/vschema/#reference-tables.>
117    ///
118    /// Otherwise, it should be empty.
119    #[prost(string, tag = "1")]
120    pub r#type: ::prost::alloc::string::String,
121    /// column_vindexes associates columns to vindexes.
122    #[prost(message, repeated, tag = "2")]
123    pub column_vindexes: ::prost::alloc::vec::Vec<ColumnVindex>,
124    /// auto_increment is specified if a column needs
125    /// to be associated with a sequence.
126    #[prost(message, optional, tag = "3")]
127    pub auto_increment: ::core::option::Option<AutoIncrement>,
128    /// columns lists the columns for the table.
129    #[prost(message, repeated, tag = "4")]
130    pub columns: ::prost::alloc::vec::Vec<Column>,
131    /// pinned pins an unsharded table to a specific
132    /// shard, as dictated by the keyspace id.
133    /// The keyspace id is represented in hex form
134    /// like in keyranges.
135    #[prost(string, tag = "5")]
136    pub pinned: ::prost::alloc::string::String,
137    /// column_list_authoritative is set to true if columns is
138    /// an authoritative list for the table. This allows
139    /// us to expand 'select *' expressions.
140    #[prost(bool, tag = "6")]
141    pub column_list_authoritative: bool,
142    /// reference tables may optionally indicate their source table.
143    #[prost(string, tag = "7")]
144    pub source: ::prost::alloc::string::String,
145}
146/// ColumnVindex is used to associate a column to a vindex.
147#[allow(clippy::derive_partial_eq_without_eq)]
148#[derive(Clone, PartialEq, ::prost::Message)]
149pub struct ColumnVindex {
150    /// Legacy implementation, moving forward all vindexes should define a list of columns.
151    #[prost(string, tag = "1")]
152    pub column: ::prost::alloc::string::String,
153    /// The name must match a vindex defined in Keyspace.
154    #[prost(string, tag = "2")]
155    pub name: ::prost::alloc::string::String,
156    /// List of columns that define this Vindex
157    #[prost(string, repeated, tag = "3")]
158    pub columns: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
159}
160/// Autoincrement is used to designate a column as auto-inc.
161#[allow(clippy::derive_partial_eq_without_eq)]
162#[derive(Clone, PartialEq, ::prost::Message)]
163pub struct AutoIncrement {
164    #[prost(string, tag = "1")]
165    pub column: ::prost::alloc::string::String,
166    /// The sequence must match a table of type SEQUENCE.
167    #[prost(string, tag = "2")]
168    pub sequence: ::prost::alloc::string::String,
169}
170/// Column describes a column.
171#[allow(clippy::derive_partial_eq_without_eq)]
172#[derive(Clone, PartialEq, ::prost::Message)]
173pub struct Column {
174    #[prost(string, tag = "1")]
175    pub name: ::prost::alloc::string::String,
176    #[prost(enumeration = "super::query::Type", tag = "2")]
177    pub r#type: i32,
178}
179/// SrvVSchema is the roll-up of all the Keyspace schema for a cell.
180#[allow(clippy::derive_partial_eq_without_eq)]
181#[derive(Clone, PartialEq, ::prost::Message)]
182pub struct SrvVSchema {
183    /// keyspaces is a map of keyspace name -> Keyspace object.
184    #[prost(map = "string, message", tag = "1")]
185    pub keyspaces: ::std::collections::HashMap<::prost::alloc::string::String, Keyspace>,
186    /// table routing rules
187    #[prost(message, optional, tag = "2")]
188    pub routing_rules: ::core::option::Option<RoutingRules>,
189    #[prost(message, optional, tag = "3")]
190    pub shard_routing_rules: ::core::option::Option<ShardRoutingRules>,
191}
192/// ShardRoutingRules specify the shard routing rules for the VSchema.
193#[allow(clippy::derive_partial_eq_without_eq)]
194#[derive(Clone, PartialEq, ::prost::Message)]
195pub struct ShardRoutingRules {
196    #[prost(message, repeated, tag = "1")]
197    pub rules: ::prost::alloc::vec::Vec<ShardRoutingRule>,
198}
199/// RoutingRule specifies a routing rule.
200#[allow(clippy::derive_partial_eq_without_eq)]
201#[derive(Clone, PartialEq, ::prost::Message)]
202pub struct ShardRoutingRule {
203    #[prost(string, tag = "1")]
204    pub from_keyspace: ::prost::alloc::string::String,
205    #[prost(string, tag = "2")]
206    pub to_keyspace: ::prost::alloc::string::String,
207    #[prost(string, tag = "3")]
208    pub shard: ::prost::alloc::string::String,
209}