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
/// A set of uniform storage units.
/// Single storage unit can be thought of as a reserved part of a RAID.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StorageUnits {
    /// Required. Kind of the storage unit. Determine guarantees
    /// for all main unit parameters: used hard disk type, capacity
    /// throughput, IOPS etc.
    #[prost(string, tag = "1")]
    pub unit_kind: ::prost::alloc::string::String,
    /// Required. The number of units in this set.
    #[prost(uint64, tag = "2")]
    pub count: u64,
}
/// A set of uniform computational units.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputationalUnits {
    /// Required. Kind of the computational unit. Determine main
    /// unit parameters like available memory, CPU, etc.
    #[prost(string, tag = "1")]
    pub unit_kind: ::prost::alloc::string::String,
    /// The availability zone all unit should be located in.
    /// By default any availability zone can be used.
    #[prost(string, tag = "2")]
    pub availability_zone: ::prost::alloc::string::String,
    /// Required. The number of units in this set.
    #[prost(uint64, tag = "3")]
    pub count: u64,
}
/// Computational unit allocated for database. Used to register
/// externally allocated computational resources in CMS.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AllocatedComputationalUnit {
    /// Required. Computational unit host name.
    #[prost(string, tag = "1")]
    pub host: ::prost::alloc::string::String,
    /// Required. Computational unit port.
    #[prost(uint32, tag = "2")]
    pub port: u32,
    /// Required. Computational unit kind.
    #[prost(string, tag = "3")]
    pub unit_kind: ::prost::alloc::string::String,
}
/// A set of computational and storage resources.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Resources {
    /// Storage resources.
    #[prost(message, repeated, tag = "1")]
    pub storage_units: ::prost::alloc::vec::Vec<StorageUnits>,
    /// Computational resources.
    #[prost(message, repeated, tag = "2")]
    pub computational_units: ::prost::alloc::vec::Vec<ComputationalUnits>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ServerlessResources {
    /// Full path to shared database's home dir whose resources will be used.
    #[prost(string, tag = "1")]
    pub shared_database_path: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DatabaseOptions {
    /// Do not initialize services required for transactions processing.
    #[prost(bool, tag = "1")]
    pub disable_tx_service: bool,
    /// Old-style database, do not create external schemeshard for database
    #[prost(bool, tag = "2")]
    pub disable_external_subdomain: bool,
    /// Transaction plan resolution in milliseconds
    #[prost(uint32, tag = "3")]
    pub plan_resolution: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Attribute {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(string, tag = "2")]
    pub value: ::prost::alloc::string::String,
}
/// A set of quotas for schema operations
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SchemaOperationQuotas {
    /// Leaky bucket based quotas
    #[prost(message, repeated, tag = "1")]
    pub leaky_bucket_quotas: ::prost::alloc::vec::Vec<schema_operation_quotas::LeakyBucket>,
}
/// Nested message and enum types in `SchemaOperationQuotas`.
pub mod schema_operation_quotas {
    /// A single quota based on leaky bucket
    #[derive(Clone, PartialEq, ::prost::Message)]
    pub struct LeakyBucket {
        /// Bucket size, e.g. <1000> per day
        #[prost(double, tag = "1")]
        pub bucket_size: f64,
        /// Bucket duration in seconds, e.g. 1000 per <day>
        #[prost(uint64, tag = "2")]
        pub bucket_seconds: u64,
    }
}
/// A set of quotas for the database
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DatabaseQuotas {
    /// A maximum data size in bytes, new data will be rejected when exceeded
    #[prost(uint64, tag = "1")]
    pub data_size_hard_quota: u64,
    /// An optional size in bytes (lower than data_size_hard_quota). When data
    /// size becomes lower than this value new data ingestion is re-enabled
    /// again. This is useful to help avoid database from rapidly entering and
    /// exiting from the overloaded state.
    #[prost(uint64, tag = "2")]
    pub data_size_soft_quota: u64,
    /// A maximum count of shards in all data streams.
    #[prost(uint64, tag = "3")]
    pub data_stream_shards_quota: u64,
}
/// Request to create a new database. For successfull creation
/// specified database shouldn't exist. At least one storage
/// unit should be requested for the database.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateDatabaseRequest {
    #[prost(message, optional, tag = "1")]
    pub operation_params: ::core::option::Option<super::operations::OperationParams>,
    /// Required. Full path to database's home dir. Used as database ID.
    #[prost(string, tag = "2")]
    pub path: ::prost::alloc::string::String,
    /// Additional database options.
    #[prost(message, optional, tag = "4")]
    pub options: ::core::option::Option<DatabaseOptions>,
    /// Attach attributes to database.
    #[prost(message, repeated, tag = "5")]
    pub attributes: ::prost::alloc::vec::Vec<Attribute>,
    /// Optional quotas for schema operations
    #[prost(message, optional, tag = "8")]
    pub schema_operation_quotas: ::core::option::Option<SchemaOperationQuotas>,
    /// Optional idempotency key
    #[prost(string, tag = "9")]
    pub idempotency_key: ::prost::alloc::string::String,
    /// Optional quotas for the database
    #[prost(message, optional, tag = "10")]
    pub database_quotas: ::core::option::Option<DatabaseQuotas>,
    #[prost(oneof = "create_database_request::ResourcesKind", tags = "3, 6, 7")]
    pub resources_kind: ::core::option::Option<create_database_request::ResourcesKind>,
}
/// Nested message and enum types in `CreateDatabaseRequest`.
pub mod create_database_request {
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum ResourcesKind {
        /// Resources to allocate for database by CMS.
        #[prost(message, tag = "3")]
        Resources(super::Resources),
        /// Shared resources can be used by serverless databases.
        #[prost(message, tag = "6")]
        SharedResources(super::Resources),
        /// If specified, the created database will be "serverless".
        #[prost(message, tag = "7")]
        ServerlessResources(super::ServerlessResources),
    }
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateDatabaseResponse {
    #[prost(message, optional, tag = "1")]
    pub operation: ::core::option::Option<super::operations::Operation>,
}
/// Get current database status.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDatabaseStatusRequest {
    /// Required. Full path to database's home dir.
    #[prost(string, tag = "1")]
    pub path: ::prost::alloc::string::String,
    /// Operation parameters
    #[prost(message, optional, tag = "2")]
    pub operation_params: ::core::option::Option<super::operations::OperationParams>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDatabaseStatusResponse {
    /// operation.result holds GetDatabaseStatusResult
    #[prost(message, optional, tag = "1")]
    pub operation: ::core::option::Option<super::operations::Operation>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetDatabaseStatusResult {
    /// Full path to database's home dir.
    #[prost(string, tag = "1")]
    pub path: ::prost::alloc::string::String,
    /// Current database state.
    #[prost(enumeration = "get_database_status_result::State", tag = "2")]
    pub state: i32,
    /// Database resources allocated by CMS.
    #[prost(message, optional, tag = "4")]
    pub allocated_resources: ::core::option::Option<Resources>,
    /// Externally allocated database resources registered in CMS.
    #[prost(message, repeated, tag = "5")]
    pub registered_resources: ::prost::alloc::vec::Vec<AllocatedComputationalUnit>,
    /// Current database generation. Incremented at each successful
    /// alter request.
    #[prost(uint64, tag = "6")]
    pub generation: u64,
    /// Current quotas for schema operations
    #[prost(message, optional, tag = "9")]
    pub schema_operation_quotas: ::core::option::Option<SchemaOperationQuotas>,
    /// Current quotas for the database
    #[prost(message, optional, tag = "10")]
    pub database_quotas: ::core::option::Option<DatabaseQuotas>,
    #[prost(oneof = "get_database_status_result::ResourcesKind", tags = "3, 7, 8")]
    pub resources_kind: ::core::option::Option<get_database_status_result::ResourcesKind>,
}
/// Nested message and enum types in `GetDatabaseStatusResult`.
pub mod get_database_status_result {
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
    #[repr(i32)]
    pub enum State {
        Unspecified = 0,
        Creating = 1,
        Running = 2,
        Removing = 3,
        PendingResources = 4,
        Configuring = 5,
    }
    #[derive(Clone, PartialEq, ::prost::Oneof)]
    pub enum ResourcesKind {
        /// Database resources requested for allocation.
        #[prost(message, tag = "3")]
        RequiredResources(super::Resources),
        #[prost(message, tag = "7")]
        RequiredSharedResources(super::Resources),
        #[prost(message, tag = "8")]
        ServerlessResources(super::ServerlessResources),
    }
}
/// Change resources allocated for database.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AlterDatabaseRequest {
    /// Required. Full path to database's home dir.
    #[prost(string, tag = "1")]
    pub path: ::prost::alloc::string::String,
    /// Additional computational units to allocate for database.
    #[prost(message, repeated, tag = "2")]
    pub computational_units_to_add: ::prost::alloc::vec::Vec<ComputationalUnits>,
    /// Computational units to deallocate.
    #[prost(message, repeated, tag = "3")]
    pub computational_units_to_remove: ::prost::alloc::vec::Vec<ComputationalUnits>,
    /// Additional storage units to allocate for database.
    #[prost(message, repeated, tag = "4")]
    pub storage_units_to_add: ::prost::alloc::vec::Vec<StorageUnits>,
    /// Externally allocated computational units to register for database.
    #[prost(message, repeated, tag = "5")]
    pub computational_units_to_register: ::prost::alloc::vec::Vec<AllocatedComputationalUnit>,
    /// Externally allocated computational units to deregister.
    #[prost(message, repeated, tag = "6")]
    pub computational_units_to_deregister: ::prost::alloc::vec::Vec<AllocatedComputationalUnit>,
    /// Operation parameters.
    #[prost(message, optional, tag = "7")]
    pub operation_params: ::core::option::Option<super::operations::OperationParams>,
    /// Current generation of altered database.
    #[prost(uint64, tag = "8")]
    pub generation: u64,
    /// Change quotas for schema operations
    #[prost(message, optional, tag = "9")]
    pub schema_operation_quotas: ::core::option::Option<SchemaOperationQuotas>,
    /// Optional idempotency key
    #[prost(string, tag = "10")]
    pub idempotency_key: ::prost::alloc::string::String,
    /// Change quotas for the database
    #[prost(message, optional, tag = "11")]
    pub database_quotas: ::core::option::Option<DatabaseQuotas>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AlterDatabaseResponse {
    #[prost(message, optional, tag = "1")]
    pub operation: ::core::option::Option<super::operations::Operation>,
}
/// List all databases known by CMS.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDatabasesRequest {
    /// Operation parameters
    #[prost(message, optional, tag = "1")]
    pub operation_params: ::core::option::Option<super::operations::OperationParams>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDatabasesResponse {
    /// operation.result holds ListDatabasesResult
    #[prost(message, optional, tag = "1")]
    pub operation: ::core::option::Option<super::operations::Operation>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListDatabasesResult {
    #[prost(string, repeated, tag = "1")]
    pub paths: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
/// Completely remove database and all his data.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveDatabaseRequest {
    /// Required. Full path to database's home dir.
    #[prost(string, tag = "1")]
    pub path: ::prost::alloc::string::String,
    #[prost(message, optional, tag = "2")]
    pub operation_params: ::core::option::Option<super::operations::OperationParams>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RemoveDatabaseResponse {
    #[prost(message, optional, tag = "1")]
    pub operation: ::core::option::Option<super::operations::Operation>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StorageUnitDescription {
    #[prost(string, tag = "1")]
    pub kind: ::prost::alloc::string::String,
    #[prost(map = "string, string", tag = "2")]
    pub labels:
        ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AvailabilityZoneDescription {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
    #[prost(map = "string, string", tag = "2")]
    pub labels:
        ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ComputationalUnitDescription {
    #[prost(string, tag = "1")]
    pub kind: ::prost::alloc::string::String,
    #[prost(map = "string, string", tag = "2")]
    pub labels:
        ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
    #[prost(string, repeated, tag = "3")]
    pub allowed_availability_zones: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DescribeDatabaseOptionsRequest {
    /// Operation parameters
    #[prost(message, optional, tag = "1")]
    pub operation_params: ::core::option::Option<super::operations::OperationParams>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DescribeDatabaseOptionsResponse {
    /// operation.result holds DescribeDatabaseOptionsResult
    #[prost(message, optional, tag = "1")]
    pub operation: ::core::option::Option<super::operations::Operation>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DescribeDatabaseOptionsResult {
    #[prost(message, repeated, tag = "1")]
    pub storage_units: ::prost::alloc::vec::Vec<StorageUnitDescription>,
    #[prost(message, repeated, tag = "2")]
    pub availability_zones: ::prost::alloc::vec::Vec<AvailabilityZoneDescription>,
    #[prost(message, repeated, tag = "3")]
    pub computational_units: ::prost::alloc::vec::Vec<ComputationalUnitDescription>,
}