1#![allow(unused_imports)]
5#![allow(unused_extern_crates)]
6#![allow(clippy::too_many_arguments, clippy::type_complexity)]
7#![cfg_attr(rustfmt, rustfmt_skip)]
8
9use std::cell::RefCell;
10use std::collections::{BTreeMap, BTreeSet};
11use std::convert::{From, TryFrom};
12use std::default::Default;
13use std::error::Error;
14use std::fmt;
15use std::fmt::{Display, Formatter};
16use std::rc::Rc;
17
18use thrift::OrderedFloat;
19use thrift::{ApplicationError, ApplicationErrorKind, ProtocolError, ProtocolErrorKind, TThriftClient};
20use thrift::protocol::{TFieldIdentifier, TListIdentifier, TMapIdentifier, TMessageIdentifier, TMessageType, TInputProtocol, TOutputProtocol, TSetIdentifier, TStructIdentifier, TType};
21use thrift::protocol::field_id;
22use thrift::protocol::verify_expected_message_type;
23use thrift::protocol::verify_expected_sequence_number;
24use thrift::protocol::verify_expected_service_call;
25use thrift::protocol::verify_required_field_exists;
26use thrift::server::TProcessor;
27
28#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
29pub enum TConsensusGroupType {
30 ConfigRegion = 0,
31 DataRegion = 1,
32 SchemaRegion = 2,
33}
34
35impl TConsensusGroupType {
36 pub fn write_to_out_protocol(self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
37 o_prot.write_i32(self as i32)
38 }
39 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TConsensusGroupType> {
40 let enum_value = i_prot.read_i32()?;
41 TConsensusGroupType::try_from(enum_value) }
42}
43
44impl TryFrom<i32> for TConsensusGroupType {
45 type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
46 match i {
47 0 => Ok(TConsensusGroupType::ConfigRegion),
48 1 => Ok(TConsensusGroupType::DataRegion),
49 2 => Ok(TConsensusGroupType::SchemaRegion),
50 _ => {
51 Err(
52 thrift::Error::Protocol(
53 ProtocolError::new(
54 ProtocolErrorKind::InvalidData,
55 format!("cannot convert enum constant {} to TConsensusGroupType", i)
56 )
57 )
58 )
59 },
60 }
61 }
62}
63
64#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
65pub enum TRegionMigrateFailedType {
66 AddPeerFailed = 0,
67 RemovePeerFailed = 1,
68 RemoveConsensusGroupFailed = 2,
69 DeleteRegionFailed = 3,
70 CreateRegionFailed = 4,
71 Disconnect = 5,
72}
73
74impl TRegionMigrateFailedType {
75 pub fn write_to_out_protocol(self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
76 o_prot.write_i32(self as i32)
77 }
78 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TRegionMigrateFailedType> {
79 let enum_value = i_prot.read_i32()?;
80 TRegionMigrateFailedType::try_from(enum_value) }
81}
82
83impl TryFrom<i32> for TRegionMigrateFailedType {
84 type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
85 match i {
86 0 => Ok(TRegionMigrateFailedType::AddPeerFailed),
87 1 => Ok(TRegionMigrateFailedType::RemovePeerFailed),
88 2 => Ok(TRegionMigrateFailedType::RemoveConsensusGroupFailed),
89 3 => Ok(TRegionMigrateFailedType::DeleteRegionFailed),
90 4 => Ok(TRegionMigrateFailedType::CreateRegionFailed),
91 5 => Ok(TRegionMigrateFailedType::Disconnect),
92 _ => {
93 Err(
94 thrift::Error::Protocol(
95 ProtocolError::new(
96 ProtocolErrorKind::InvalidData,
97 format!("cannot convert enum constant {} to TRegionMigrateFailedType", i)
98 )
99 )
100 )
101 },
102 }
103 }
104}
105
106#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
107pub enum TRegionMaintainTaskStatus {
108 TaskNotExist = 0,
109 Processing = 1,
110 Success = 2,
111 Fail = 3,
112}
113
114impl TRegionMaintainTaskStatus {
115 pub fn write_to_out_protocol(self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
116 o_prot.write_i32(self as i32)
117 }
118 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TRegionMaintainTaskStatus> {
119 let enum_value = i_prot.read_i32()?;
120 TRegionMaintainTaskStatus::try_from(enum_value) }
121}
122
123impl TryFrom<i32> for TRegionMaintainTaskStatus {
124 type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
125 match i {
126 0 => Ok(TRegionMaintainTaskStatus::TaskNotExist),
127 1 => Ok(TRegionMaintainTaskStatus::Processing),
128 2 => Ok(TRegionMaintainTaskStatus::Success),
129 3 => Ok(TRegionMaintainTaskStatus::Fail),
130 _ => {
131 Err(
132 thrift::Error::Protocol(
133 ProtocolError::new(
134 ProtocolErrorKind::InvalidData,
135 format!("cannot convert enum constant {} to TRegionMaintainTaskStatus", i)
136 )
137 )
138 )
139 },
140 }
141 }
142}
143
144#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
145pub enum ThrottleType {
146 RequestNumber = 0,
147 RequestSize = 1,
148 WriteNumber = 2,
149 WriteSize = 3,
150 ReadNumber = 4,
151 ReadSize = 5,
152}
153
154impl ThrottleType {
155 pub fn write_to_out_protocol(self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
156 o_prot.write_i32(self as i32)
157 }
158 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<ThrottleType> {
159 let enum_value = i_prot.read_i32()?;
160 ThrottleType::try_from(enum_value) }
161}
162
163impl TryFrom<i32> for ThrottleType {
164 type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
165 match i {
166 0 => Ok(ThrottleType::RequestNumber),
167 1 => Ok(ThrottleType::RequestSize),
168 2 => Ok(ThrottleType::WriteNumber),
169 3 => Ok(ThrottleType::WriteSize),
170 4 => Ok(ThrottleType::ReadNumber),
171 5 => Ok(ThrottleType::ReadSize),
172 _ => {
173 Err(
174 thrift::Error::Protocol(
175 ProtocolError::new(
176 ProtocolErrorKind::InvalidData,
177 format!("cannot convert enum constant {} to ThrottleType", i)
178 )
179 )
180 )
181 },
182 }
183 }
184}
185
186#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
187pub enum TAggregationType {
188 Count = 0,
189 Avg = 1,
190 Sum = 2,
191 FirstValue = 3,
192 LastValue = 4,
193 MaxTime = 5,
194 MinTime = 6,
195 MaxValue = 7,
196 MinValue = 8,
197 Extreme = 9,
198 CountIf = 10,
199 TimeDuration = 11,
200 Mode = 12,
201 CountTime = 13,
202 Stddev = 14,
203 StddevPop = 15,
204 StddevSamp = 16,
205 Variance = 17,
206 VarPop = 18,
207 VarSamp = 19,
208 MaxBy = 20,
209 MinBy = 21,
210 Udaf = 22,
211}
212
213impl TAggregationType {
214 pub fn write_to_out_protocol(self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
215 o_prot.write_i32(self as i32)
216 }
217 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TAggregationType> {
218 let enum_value = i_prot.read_i32()?;
219 TAggregationType::try_from(enum_value) }
220}
221
222impl TryFrom<i32> for TAggregationType {
223 type Error = thrift::Error; fn try_from(i: i32) -> Result<Self, Self::Error> {
224 match i {
225 0 => Ok(TAggregationType::Count),
226 1 => Ok(TAggregationType::Avg),
227 2 => Ok(TAggregationType::Sum),
228 3 => Ok(TAggregationType::FirstValue),
229 4 => Ok(TAggregationType::LastValue),
230 5 => Ok(TAggregationType::MaxTime),
231 6 => Ok(TAggregationType::MinTime),
232 7 => Ok(TAggregationType::MaxValue),
233 8 => Ok(TAggregationType::MinValue),
234 9 => Ok(TAggregationType::Extreme),
235 10 => Ok(TAggregationType::CountIf),
236 11 => Ok(TAggregationType::TimeDuration),
237 12 => Ok(TAggregationType::Mode),
238 13 => Ok(TAggregationType::CountTime),
239 14 => Ok(TAggregationType::Stddev),
240 15 => Ok(TAggregationType::StddevPop),
241 16 => Ok(TAggregationType::StddevSamp),
242 17 => Ok(TAggregationType::Variance),
243 18 => Ok(TAggregationType::VarPop),
244 19 => Ok(TAggregationType::VarSamp),
245 20 => Ok(TAggregationType::MaxBy),
246 21 => Ok(TAggregationType::MinBy),
247 22 => Ok(TAggregationType::Udaf),
248 _ => {
249 Err(
250 thrift::Error::Protocol(
251 ProtocolError::new(
252 ProtocolErrorKind::InvalidData,
253 format!("cannot convert enum constant {} to TAggregationType", i)
254 )
255 )
256 )
257 },
258 }
259 }
260}
261
262#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
267pub struct TEndPoint {
268 pub ip: String,
269 pub port: i32,
270}
271
272impl TEndPoint {
273 pub fn new(ip: String, port: i32) -> TEndPoint {
274 TEndPoint {
275 ip,
276 port,
277 }
278 }
279 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TEndPoint> {
280 i_prot.read_struct_begin()?;
281 let mut f_1: Option<String> = None;
282 let mut f_2: Option<i32> = None;
283 loop {
284 let field_ident = i_prot.read_field_begin()?;
285 if field_ident.field_type == TType::Stop {
286 break;
287 }
288 let field_id = field_id(&field_ident)?;
289 match field_id {
290 1 => {
291 let val = i_prot.read_string()?;
292 f_1 = Some(val);
293 },
294 2 => {
295 let val = i_prot.read_i32()?;
296 f_2 = Some(val);
297 },
298 _ => {
299 i_prot.skip(field_ident.field_type)?;
300 },
301 };
302 i_prot.read_field_end()?;
303 }
304 i_prot.read_struct_end()?;
305 verify_required_field_exists("TEndPoint.ip", &f_1)?;
306 verify_required_field_exists("TEndPoint.port", &f_2)?;
307 let ret = TEndPoint {
308 ip: f_1.expect("auto-generated code should have checked for presence of required fields"),
309 port: f_2.expect("auto-generated code should have checked for presence of required fields"),
310 };
311 Ok(ret)
312 }
313 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
314 let struct_ident = TStructIdentifier::new("TEndPoint");
315 o_prot.write_struct_begin(&struct_ident)?;
316 o_prot.write_field_begin(&TFieldIdentifier::new("ip", TType::String, 1))?;
317 o_prot.write_string(&self.ip)?;
318 o_prot.write_field_end()?;
319 o_prot.write_field_begin(&TFieldIdentifier::new("port", TType::I32, 2))?;
320 o_prot.write_i32(self.port)?;
321 o_prot.write_field_end()?;
322 o_prot.write_field_stop()?;
323 o_prot.write_struct_end()
324 }
325}
326
327#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
332pub struct TSStatus {
333 pub code: i32,
334 pub message: Option<String>,
335 pub sub_status: Option<Vec<Box<TSStatus>>>,
336 pub redirect_node: Option<TEndPoint>,
337 pub need_retry: Option<bool>,
338}
339
340impl TSStatus {
341 pub fn new<F2, F3, F4, F5>(code: i32, message: F2, sub_status: F3, redirect_node: F4, need_retry: F5) -> TSStatus where F2: Into<Option<String>>, F3: Into<Option<Vec<Box<TSStatus>>>>, F4: Into<Option<TEndPoint>>, F5: Into<Option<bool>> {
342 TSStatus {
343 code,
344 message: message.into(),
345 sub_status: sub_status.into(),
346 redirect_node: redirect_node.into(),
347 need_retry: need_retry.into(),
348 }
349 }
350 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TSStatus> {
351 i_prot.read_struct_begin()?;
352 let mut f_1: Option<i32> = None;
353 let mut f_2: Option<String> = None;
354 let mut f_3: Option<Vec<Box<TSStatus>>> = None;
355 let mut f_4: Option<TEndPoint> = None;
356 let mut f_5: Option<bool> = None;
357 loop {
358 let field_ident = i_prot.read_field_begin()?;
359 if field_ident.field_type == TType::Stop {
360 break;
361 }
362 let field_id = field_id(&field_ident)?;
363 match field_id {
364 1 => {
365 let val = i_prot.read_i32()?;
366 f_1 = Some(val);
367 },
368 2 => {
369 let val = i_prot.read_string()?;
370 f_2 = Some(val);
371 },
372 3 => {
373 let list_ident = i_prot.read_list_begin()?;
374 let mut val: Vec<Box<TSStatus>> = Vec::with_capacity(list_ident.size as usize);
375 for _ in 0..list_ident.size {
376 let list_elem_0 = Box::new(TSStatus::read_from_in_protocol(i_prot)?);
377 val.push(list_elem_0);
378 }
379 i_prot.read_list_end()?;
380 f_3 = Some(val);
381 },
382 4 => {
383 let val = TEndPoint::read_from_in_protocol(i_prot)?;
384 f_4 = Some(val);
385 },
386 5 => {
387 let val = i_prot.read_bool()?;
388 f_5 = Some(val);
389 },
390 _ => {
391 i_prot.skip(field_ident.field_type)?;
392 },
393 };
394 i_prot.read_field_end()?;
395 }
396 i_prot.read_struct_end()?;
397 verify_required_field_exists("TSStatus.code", &f_1)?;
398 let ret = TSStatus {
399 code: f_1.expect("auto-generated code should have checked for presence of required fields"),
400 message: f_2,
401 sub_status: f_3,
402 redirect_node: f_4,
403 need_retry: f_5,
404 };
405 Ok(ret)
406 }
407 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
408 let struct_ident = TStructIdentifier::new("TSStatus");
409 o_prot.write_struct_begin(&struct_ident)?;
410 o_prot.write_field_begin(&TFieldIdentifier::new("code", TType::I32, 1))?;
411 o_prot.write_i32(self.code)?;
412 o_prot.write_field_end()?;
413 if let Some(ref fld_var) = self.message {
414 o_prot.write_field_begin(&TFieldIdentifier::new("message", TType::String, 2))?;
415 o_prot.write_string(fld_var)?;
416 o_prot.write_field_end()?
417 }
418 if let Some(ref fld_var) = self.sub_status {
419 o_prot.write_field_begin(&TFieldIdentifier::new("subStatus", TType::List, 3))?;
420 o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, fld_var.len() as i32))?;
421 for e in fld_var {
422 e.write_to_out_protocol(o_prot)?;
423 o_prot.write_list_end()?;
424 }
425 o_prot.write_field_end()?
426 }
427 if let Some(ref fld_var) = self.redirect_node {
428 o_prot.write_field_begin(&TFieldIdentifier::new("redirectNode", TType::Struct, 4))?;
429 fld_var.write_to_out_protocol(o_prot)?;
430 o_prot.write_field_end()?
431 }
432 if let Some(fld_var) = self.need_retry {
433 o_prot.write_field_begin(&TFieldIdentifier::new("needRetry", TType::Bool, 5))?;
434 o_prot.write_bool(fld_var)?;
435 o_prot.write_field_end()?
436 }
437 o_prot.write_field_stop()?;
438 o_prot.write_struct_end()
439 }
440}
441
442#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
447pub struct TConsensusGroupId {
448 pub type_: TConsensusGroupType,
449 pub id: i32,
450}
451
452impl TConsensusGroupId {
453 pub fn new(type_: TConsensusGroupType, id: i32) -> TConsensusGroupId {
454 TConsensusGroupId {
455 type_,
456 id,
457 }
458 }
459 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TConsensusGroupId> {
460 i_prot.read_struct_begin()?;
461 let mut f_1: Option<TConsensusGroupType> = None;
462 let mut f_2: Option<i32> = None;
463 loop {
464 let field_ident = i_prot.read_field_begin()?;
465 if field_ident.field_type == TType::Stop {
466 break;
467 }
468 let field_id = field_id(&field_ident)?;
469 match field_id {
470 1 => {
471 let val = TConsensusGroupType::read_from_in_protocol(i_prot)?;
472 f_1 = Some(val);
473 },
474 2 => {
475 let val = i_prot.read_i32()?;
476 f_2 = Some(val);
477 },
478 _ => {
479 i_prot.skip(field_ident.field_type)?;
480 },
481 };
482 i_prot.read_field_end()?;
483 }
484 i_prot.read_struct_end()?;
485 verify_required_field_exists("TConsensusGroupId.type_", &f_1)?;
486 verify_required_field_exists("TConsensusGroupId.id", &f_2)?;
487 let ret = TConsensusGroupId {
488 type_: f_1.expect("auto-generated code should have checked for presence of required fields"),
489 id: f_2.expect("auto-generated code should have checked for presence of required fields"),
490 };
491 Ok(ret)
492 }
493 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
494 let struct_ident = TStructIdentifier::new("TConsensusGroupId");
495 o_prot.write_struct_begin(&struct_ident)?;
496 o_prot.write_field_begin(&TFieldIdentifier::new("type", TType::I32, 1))?;
497 self.type_.write_to_out_protocol(o_prot)?;
498 o_prot.write_field_end()?;
499 o_prot.write_field_begin(&TFieldIdentifier::new("id", TType::I32, 2))?;
500 o_prot.write_i32(self.id)?;
501 o_prot.write_field_end()?;
502 o_prot.write_field_stop()?;
503 o_prot.write_struct_end()
504 }
505}
506
507#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
512pub struct TSeriesPartitionSlot {
513 pub slot_id: i32,
514}
515
516impl TSeriesPartitionSlot {
517 pub fn new(slot_id: i32) -> TSeriesPartitionSlot {
518 TSeriesPartitionSlot {
519 slot_id,
520 }
521 }
522 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TSeriesPartitionSlot> {
523 i_prot.read_struct_begin()?;
524 let mut f_1: Option<i32> = None;
525 loop {
526 let field_ident = i_prot.read_field_begin()?;
527 if field_ident.field_type == TType::Stop {
528 break;
529 }
530 let field_id = field_id(&field_ident)?;
531 match field_id {
532 1 => {
533 let val = i_prot.read_i32()?;
534 f_1 = Some(val);
535 },
536 _ => {
537 i_prot.skip(field_ident.field_type)?;
538 },
539 };
540 i_prot.read_field_end()?;
541 }
542 i_prot.read_struct_end()?;
543 verify_required_field_exists("TSeriesPartitionSlot.slot_id", &f_1)?;
544 let ret = TSeriesPartitionSlot {
545 slot_id: f_1.expect("auto-generated code should have checked for presence of required fields"),
546 };
547 Ok(ret)
548 }
549 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
550 let struct_ident = TStructIdentifier::new("TSeriesPartitionSlot");
551 o_prot.write_struct_begin(&struct_ident)?;
552 o_prot.write_field_begin(&TFieldIdentifier::new("slotId", TType::I32, 1))?;
553 o_prot.write_i32(self.slot_id)?;
554 o_prot.write_field_end()?;
555 o_prot.write_field_stop()?;
556 o_prot.write_struct_end()
557 }
558}
559
560#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
565pub struct TTimePartitionSlot {
566 pub start_time: i64,
567}
568
569impl TTimePartitionSlot {
570 pub fn new(start_time: i64) -> TTimePartitionSlot {
571 TTimePartitionSlot {
572 start_time,
573 }
574 }
575 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TTimePartitionSlot> {
576 i_prot.read_struct_begin()?;
577 let mut f_1: Option<i64> = None;
578 loop {
579 let field_ident = i_prot.read_field_begin()?;
580 if field_ident.field_type == TType::Stop {
581 break;
582 }
583 let field_id = field_id(&field_ident)?;
584 match field_id {
585 1 => {
586 let val = i_prot.read_i64()?;
587 f_1 = Some(val);
588 },
589 _ => {
590 i_prot.skip(field_ident.field_type)?;
591 },
592 };
593 i_prot.read_field_end()?;
594 }
595 i_prot.read_struct_end()?;
596 verify_required_field_exists("TTimePartitionSlot.start_time", &f_1)?;
597 let ret = TTimePartitionSlot {
598 start_time: f_1.expect("auto-generated code should have checked for presence of required fields"),
599 };
600 Ok(ret)
601 }
602 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
603 let struct_ident = TStructIdentifier::new("TTimePartitionSlot");
604 o_prot.write_struct_begin(&struct_ident)?;
605 o_prot.write_field_begin(&TFieldIdentifier::new("startTime", TType::I64, 1))?;
606 o_prot.write_i64(self.start_time)?;
607 o_prot.write_field_end()?;
608 o_prot.write_field_stop()?;
609 o_prot.write_struct_end()
610 }
611}
612
613#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
618pub struct TRegionReplicaSet {
619 pub region_id: TConsensusGroupId,
620 pub data_node_locations: Vec<Box<TDataNodeLocation>>,
621}
622
623impl TRegionReplicaSet {
624 pub fn new(region_id: TConsensusGroupId, data_node_locations: Vec<Box<TDataNodeLocation>>) -> TRegionReplicaSet {
625 TRegionReplicaSet {
626 region_id,
627 data_node_locations,
628 }
629 }
630 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TRegionReplicaSet> {
631 i_prot.read_struct_begin()?;
632 let mut f_1: Option<TConsensusGroupId> = None;
633 let mut f_2: Option<Vec<Box<TDataNodeLocation>>> = None;
634 loop {
635 let field_ident = i_prot.read_field_begin()?;
636 if field_ident.field_type == TType::Stop {
637 break;
638 }
639 let field_id = field_id(&field_ident)?;
640 match field_id {
641 1 => {
642 let val = TConsensusGroupId::read_from_in_protocol(i_prot)?;
643 f_1 = Some(val);
644 },
645 2 => {
646 let list_ident = i_prot.read_list_begin()?;
647 let mut val: Vec<Box<TDataNodeLocation>> = Vec::with_capacity(list_ident.size as usize);
648 for _ in 0..list_ident.size {
649 let list_elem_1 = Box::new(TDataNodeLocation::read_from_in_protocol(i_prot)?);
650 val.push(list_elem_1);
651 }
652 i_prot.read_list_end()?;
653 f_2 = Some(val);
654 },
655 _ => {
656 i_prot.skip(field_ident.field_type)?;
657 },
658 };
659 i_prot.read_field_end()?;
660 }
661 i_prot.read_struct_end()?;
662 verify_required_field_exists("TRegionReplicaSet.region_id", &f_1)?;
663 verify_required_field_exists("TRegionReplicaSet.data_node_locations", &f_2)?;
664 let ret = TRegionReplicaSet {
665 region_id: f_1.expect("auto-generated code should have checked for presence of required fields"),
666 data_node_locations: f_2.expect("auto-generated code should have checked for presence of required fields"),
667 };
668 Ok(ret)
669 }
670 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
671 let struct_ident = TStructIdentifier::new("TRegionReplicaSet");
672 o_prot.write_struct_begin(&struct_ident)?;
673 o_prot.write_field_begin(&TFieldIdentifier::new("regionId", TType::Struct, 1))?;
674 self.region_id.write_to_out_protocol(o_prot)?;
675 o_prot.write_field_end()?;
676 o_prot.write_field_begin(&TFieldIdentifier::new("dataNodeLocations", TType::List, 2))?;
677 o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.data_node_locations.len() as i32))?;
678 for e in &self.data_node_locations {
679 e.write_to_out_protocol(o_prot)?;
680 o_prot.write_list_end()?;
681 }
682 o_prot.write_field_end()?;
683 o_prot.write_field_stop()?;
684 o_prot.write_struct_end()
685 }
686}
687
688#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
693pub struct TNodeResource {
694 pub cpu_core_num: i32,
695 pub max_memory: i64,
696}
697
698impl TNodeResource {
699 pub fn new(cpu_core_num: i32, max_memory: i64) -> TNodeResource {
700 TNodeResource {
701 cpu_core_num,
702 max_memory,
703 }
704 }
705 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TNodeResource> {
706 i_prot.read_struct_begin()?;
707 let mut f_1: Option<i32> = None;
708 let mut f_2: Option<i64> = None;
709 loop {
710 let field_ident = i_prot.read_field_begin()?;
711 if field_ident.field_type == TType::Stop {
712 break;
713 }
714 let field_id = field_id(&field_ident)?;
715 match field_id {
716 1 => {
717 let val = i_prot.read_i32()?;
718 f_1 = Some(val);
719 },
720 2 => {
721 let val = i_prot.read_i64()?;
722 f_2 = Some(val);
723 },
724 _ => {
725 i_prot.skip(field_ident.field_type)?;
726 },
727 };
728 i_prot.read_field_end()?;
729 }
730 i_prot.read_struct_end()?;
731 verify_required_field_exists("TNodeResource.cpu_core_num", &f_1)?;
732 verify_required_field_exists("TNodeResource.max_memory", &f_2)?;
733 let ret = TNodeResource {
734 cpu_core_num: f_1.expect("auto-generated code should have checked for presence of required fields"),
735 max_memory: f_2.expect("auto-generated code should have checked for presence of required fields"),
736 };
737 Ok(ret)
738 }
739 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
740 let struct_ident = TStructIdentifier::new("TNodeResource");
741 o_prot.write_struct_begin(&struct_ident)?;
742 o_prot.write_field_begin(&TFieldIdentifier::new("cpuCoreNum", TType::I32, 1))?;
743 o_prot.write_i32(self.cpu_core_num)?;
744 o_prot.write_field_end()?;
745 o_prot.write_field_begin(&TFieldIdentifier::new("maxMemory", TType::I64, 2))?;
746 o_prot.write_i64(self.max_memory)?;
747 o_prot.write_field_end()?;
748 o_prot.write_field_stop()?;
749 o_prot.write_struct_end()
750 }
751}
752
753#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
758pub struct TConfigNodeLocation {
759 pub config_node_id: i32,
760 pub internal_end_point: TEndPoint,
761 pub consensus_end_point: TEndPoint,
762}
763
764impl TConfigNodeLocation {
765 pub fn new(config_node_id: i32, internal_end_point: TEndPoint, consensus_end_point: TEndPoint) -> TConfigNodeLocation {
766 TConfigNodeLocation {
767 config_node_id,
768 internal_end_point,
769 consensus_end_point,
770 }
771 }
772 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TConfigNodeLocation> {
773 i_prot.read_struct_begin()?;
774 let mut f_1: Option<i32> = None;
775 let mut f_2: Option<TEndPoint> = None;
776 let mut f_3: Option<TEndPoint> = None;
777 loop {
778 let field_ident = i_prot.read_field_begin()?;
779 if field_ident.field_type == TType::Stop {
780 break;
781 }
782 let field_id = field_id(&field_ident)?;
783 match field_id {
784 1 => {
785 let val = i_prot.read_i32()?;
786 f_1 = Some(val);
787 },
788 2 => {
789 let val = TEndPoint::read_from_in_protocol(i_prot)?;
790 f_2 = Some(val);
791 },
792 3 => {
793 let val = TEndPoint::read_from_in_protocol(i_prot)?;
794 f_3 = Some(val);
795 },
796 _ => {
797 i_prot.skip(field_ident.field_type)?;
798 },
799 };
800 i_prot.read_field_end()?;
801 }
802 i_prot.read_struct_end()?;
803 verify_required_field_exists("TConfigNodeLocation.config_node_id", &f_1)?;
804 verify_required_field_exists("TConfigNodeLocation.internal_end_point", &f_2)?;
805 verify_required_field_exists("TConfigNodeLocation.consensus_end_point", &f_3)?;
806 let ret = TConfigNodeLocation {
807 config_node_id: f_1.expect("auto-generated code should have checked for presence of required fields"),
808 internal_end_point: f_2.expect("auto-generated code should have checked for presence of required fields"),
809 consensus_end_point: f_3.expect("auto-generated code should have checked for presence of required fields"),
810 };
811 Ok(ret)
812 }
813 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
814 let struct_ident = TStructIdentifier::new("TConfigNodeLocation");
815 o_prot.write_struct_begin(&struct_ident)?;
816 o_prot.write_field_begin(&TFieldIdentifier::new("configNodeId", TType::I32, 1))?;
817 o_prot.write_i32(self.config_node_id)?;
818 o_prot.write_field_end()?;
819 o_prot.write_field_begin(&TFieldIdentifier::new("internalEndPoint", TType::Struct, 2))?;
820 self.internal_end_point.write_to_out_protocol(o_prot)?;
821 o_prot.write_field_end()?;
822 o_prot.write_field_begin(&TFieldIdentifier::new("consensusEndPoint", TType::Struct, 3))?;
823 self.consensus_end_point.write_to_out_protocol(o_prot)?;
824 o_prot.write_field_end()?;
825 o_prot.write_field_stop()?;
826 o_prot.write_struct_end()
827 }
828}
829
830#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
835pub struct TDataNodeLocation {
836 pub data_node_id: i32,
837 pub client_rpc_end_point: TEndPoint,
838 pub internal_end_point: TEndPoint,
839 pub m_p_p_data_exchange_end_point: TEndPoint,
840 pub data_region_consensus_end_point: TEndPoint,
841 pub schema_region_consensus_end_point: TEndPoint,
842}
843
844impl TDataNodeLocation {
845 pub fn new(data_node_id: i32, client_rpc_end_point: TEndPoint, internal_end_point: TEndPoint, m_p_p_data_exchange_end_point: TEndPoint, data_region_consensus_end_point: TEndPoint, schema_region_consensus_end_point: TEndPoint) -> TDataNodeLocation {
846 TDataNodeLocation {
847 data_node_id,
848 client_rpc_end_point,
849 internal_end_point,
850 m_p_p_data_exchange_end_point,
851 data_region_consensus_end_point,
852 schema_region_consensus_end_point,
853 }
854 }
855 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TDataNodeLocation> {
856 i_prot.read_struct_begin()?;
857 let mut f_1: Option<i32> = None;
858 let mut f_2: Option<TEndPoint> = None;
859 let mut f_3: Option<TEndPoint> = None;
860 let mut f_4: Option<TEndPoint> = None;
861 let mut f_5: Option<TEndPoint> = None;
862 let mut f_6: Option<TEndPoint> = None;
863 loop {
864 let field_ident = i_prot.read_field_begin()?;
865 if field_ident.field_type == TType::Stop {
866 break;
867 }
868 let field_id = field_id(&field_ident)?;
869 match field_id {
870 1 => {
871 let val = i_prot.read_i32()?;
872 f_1 = Some(val);
873 },
874 2 => {
875 let val = TEndPoint::read_from_in_protocol(i_prot)?;
876 f_2 = Some(val);
877 },
878 3 => {
879 let val = TEndPoint::read_from_in_protocol(i_prot)?;
880 f_3 = Some(val);
881 },
882 4 => {
883 let val = TEndPoint::read_from_in_protocol(i_prot)?;
884 f_4 = Some(val);
885 },
886 5 => {
887 let val = TEndPoint::read_from_in_protocol(i_prot)?;
888 f_5 = Some(val);
889 },
890 6 => {
891 let val = TEndPoint::read_from_in_protocol(i_prot)?;
892 f_6 = Some(val);
893 },
894 _ => {
895 i_prot.skip(field_ident.field_type)?;
896 },
897 };
898 i_prot.read_field_end()?;
899 }
900 i_prot.read_struct_end()?;
901 verify_required_field_exists("TDataNodeLocation.data_node_id", &f_1)?;
902 verify_required_field_exists("TDataNodeLocation.client_rpc_end_point", &f_2)?;
903 verify_required_field_exists("TDataNodeLocation.internal_end_point", &f_3)?;
904 verify_required_field_exists("TDataNodeLocation.m_p_p_data_exchange_end_point", &f_4)?;
905 verify_required_field_exists("TDataNodeLocation.data_region_consensus_end_point", &f_5)?;
906 verify_required_field_exists("TDataNodeLocation.schema_region_consensus_end_point", &f_6)?;
907 let ret = TDataNodeLocation {
908 data_node_id: f_1.expect("auto-generated code should have checked for presence of required fields"),
909 client_rpc_end_point: f_2.expect("auto-generated code should have checked for presence of required fields"),
910 internal_end_point: f_3.expect("auto-generated code should have checked for presence of required fields"),
911 m_p_p_data_exchange_end_point: f_4.expect("auto-generated code should have checked for presence of required fields"),
912 data_region_consensus_end_point: f_5.expect("auto-generated code should have checked for presence of required fields"),
913 schema_region_consensus_end_point: f_6.expect("auto-generated code should have checked for presence of required fields"),
914 };
915 Ok(ret)
916 }
917 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
918 let struct_ident = TStructIdentifier::new("TDataNodeLocation");
919 o_prot.write_struct_begin(&struct_ident)?;
920 o_prot.write_field_begin(&TFieldIdentifier::new("dataNodeId", TType::I32, 1))?;
921 o_prot.write_i32(self.data_node_id)?;
922 o_prot.write_field_end()?;
923 o_prot.write_field_begin(&TFieldIdentifier::new("clientRpcEndPoint", TType::Struct, 2))?;
924 self.client_rpc_end_point.write_to_out_protocol(o_prot)?;
925 o_prot.write_field_end()?;
926 o_prot.write_field_begin(&TFieldIdentifier::new("internalEndPoint", TType::Struct, 3))?;
927 self.internal_end_point.write_to_out_protocol(o_prot)?;
928 o_prot.write_field_end()?;
929 o_prot.write_field_begin(&TFieldIdentifier::new("mPPDataExchangeEndPoint", TType::Struct, 4))?;
930 self.m_p_p_data_exchange_end_point.write_to_out_protocol(o_prot)?;
931 o_prot.write_field_end()?;
932 o_prot.write_field_begin(&TFieldIdentifier::new("dataRegionConsensusEndPoint", TType::Struct, 5))?;
933 self.data_region_consensus_end_point.write_to_out_protocol(o_prot)?;
934 o_prot.write_field_end()?;
935 o_prot.write_field_begin(&TFieldIdentifier::new("schemaRegionConsensusEndPoint", TType::Struct, 6))?;
936 self.schema_region_consensus_end_point.write_to_out_protocol(o_prot)?;
937 o_prot.write_field_end()?;
938 o_prot.write_field_stop()?;
939 o_prot.write_struct_end()
940 }
941}
942
943#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
948pub struct TDataNodeConfiguration {
949 pub location: TDataNodeLocation,
950 pub resource: TNodeResource,
951}
952
953impl TDataNodeConfiguration {
954 pub fn new(location: TDataNodeLocation, resource: TNodeResource) -> TDataNodeConfiguration {
955 TDataNodeConfiguration {
956 location,
957 resource,
958 }
959 }
960 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TDataNodeConfiguration> {
961 i_prot.read_struct_begin()?;
962 let mut f_1: Option<TDataNodeLocation> = None;
963 let mut f_2: Option<TNodeResource> = None;
964 loop {
965 let field_ident = i_prot.read_field_begin()?;
966 if field_ident.field_type == TType::Stop {
967 break;
968 }
969 let field_id = field_id(&field_ident)?;
970 match field_id {
971 1 => {
972 let val = TDataNodeLocation::read_from_in_protocol(i_prot)?;
973 f_1 = Some(val);
974 },
975 2 => {
976 let val = TNodeResource::read_from_in_protocol(i_prot)?;
977 f_2 = Some(val);
978 },
979 _ => {
980 i_prot.skip(field_ident.field_type)?;
981 },
982 };
983 i_prot.read_field_end()?;
984 }
985 i_prot.read_struct_end()?;
986 verify_required_field_exists("TDataNodeConfiguration.location", &f_1)?;
987 verify_required_field_exists("TDataNodeConfiguration.resource", &f_2)?;
988 let ret = TDataNodeConfiguration {
989 location: f_1.expect("auto-generated code should have checked for presence of required fields"),
990 resource: f_2.expect("auto-generated code should have checked for presence of required fields"),
991 };
992 Ok(ret)
993 }
994 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
995 let struct_ident = TStructIdentifier::new("TDataNodeConfiguration");
996 o_prot.write_struct_begin(&struct_ident)?;
997 o_prot.write_field_begin(&TFieldIdentifier::new("location", TType::Struct, 1))?;
998 self.location.write_to_out_protocol(o_prot)?;
999 o_prot.write_field_end()?;
1000 o_prot.write_field_begin(&TFieldIdentifier::new("resource", TType::Struct, 2))?;
1001 self.resource.write_to_out_protocol(o_prot)?;
1002 o_prot.write_field_end()?;
1003 o_prot.write_field_stop()?;
1004 o_prot.write_struct_end()
1005 }
1006}
1007
1008#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1013pub struct TFlushReq {
1014 pub is_seq: Option<String>,
1015 pub storage_groups: Option<Vec<String>>,
1016}
1017
1018impl TFlushReq {
1019 pub fn new<F1, F2>(is_seq: F1, storage_groups: F2) -> TFlushReq where F1: Into<Option<String>>, F2: Into<Option<Vec<String>>> {
1020 TFlushReq {
1021 is_seq: is_seq.into(),
1022 storage_groups: storage_groups.into(),
1023 }
1024 }
1025 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TFlushReq> {
1026 i_prot.read_struct_begin()?;
1027 let mut f_1: Option<String> = None;
1028 let mut f_2: Option<Vec<String>> = None;
1029 loop {
1030 let field_ident = i_prot.read_field_begin()?;
1031 if field_ident.field_type == TType::Stop {
1032 break;
1033 }
1034 let field_id = field_id(&field_ident)?;
1035 match field_id {
1036 1 => {
1037 let val = i_prot.read_string()?;
1038 f_1 = Some(val);
1039 },
1040 2 => {
1041 let list_ident = i_prot.read_list_begin()?;
1042 let mut val: Vec<String> = Vec::with_capacity(list_ident.size as usize);
1043 for _ in 0..list_ident.size {
1044 let list_elem_2 = i_prot.read_string()?;
1045 val.push(list_elem_2);
1046 }
1047 i_prot.read_list_end()?;
1048 f_2 = Some(val);
1049 },
1050 _ => {
1051 i_prot.skip(field_ident.field_type)?;
1052 },
1053 };
1054 i_prot.read_field_end()?;
1055 }
1056 i_prot.read_struct_end()?;
1057 let ret = TFlushReq {
1058 is_seq: f_1,
1059 storage_groups: f_2,
1060 };
1061 Ok(ret)
1062 }
1063 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1064 let struct_ident = TStructIdentifier::new("TFlushReq");
1065 o_prot.write_struct_begin(&struct_ident)?;
1066 if let Some(ref fld_var) = self.is_seq {
1067 o_prot.write_field_begin(&TFieldIdentifier::new("isSeq", TType::String, 1))?;
1068 o_prot.write_string(fld_var)?;
1069 o_prot.write_field_end()?
1070 }
1071 if let Some(ref fld_var) = self.storage_groups {
1072 o_prot.write_field_begin(&TFieldIdentifier::new("storageGroups", TType::List, 2))?;
1073 o_prot.write_list_begin(&TListIdentifier::new(TType::String, fld_var.len() as i32))?;
1074 for e in fld_var {
1075 o_prot.write_string(e)?;
1076 o_prot.write_list_end()?;
1077 }
1078 o_prot.write_field_end()?
1079 }
1080 o_prot.write_field_stop()?;
1081 o_prot.write_struct_end()
1082 }
1083}
1084
1085impl Default for TFlushReq {
1086 fn default() -> Self {
1087 TFlushReq{
1088 is_seq: Some("".to_owned()),
1089 storage_groups: Some(Vec::new()),
1090 }
1091 }
1092}
1093
1094#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1099pub struct TSettleReq {
1100 pub paths: Vec<String>,
1101}
1102
1103impl TSettleReq {
1104 pub fn new(paths: Vec<String>) -> TSettleReq {
1105 TSettleReq {
1106 paths,
1107 }
1108 }
1109 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TSettleReq> {
1110 i_prot.read_struct_begin()?;
1111 let mut f_1: Option<Vec<String>> = None;
1112 loop {
1113 let field_ident = i_prot.read_field_begin()?;
1114 if field_ident.field_type == TType::Stop {
1115 break;
1116 }
1117 let field_id = field_id(&field_ident)?;
1118 match field_id {
1119 1 => {
1120 let list_ident = i_prot.read_list_begin()?;
1121 let mut val: Vec<String> = Vec::with_capacity(list_ident.size as usize);
1122 for _ in 0..list_ident.size {
1123 let list_elem_3 = i_prot.read_string()?;
1124 val.push(list_elem_3);
1125 }
1126 i_prot.read_list_end()?;
1127 f_1 = Some(val);
1128 },
1129 _ => {
1130 i_prot.skip(field_ident.field_type)?;
1131 },
1132 };
1133 i_prot.read_field_end()?;
1134 }
1135 i_prot.read_struct_end()?;
1136 verify_required_field_exists("TSettleReq.paths", &f_1)?;
1137 let ret = TSettleReq {
1138 paths: f_1.expect("auto-generated code should have checked for presence of required fields"),
1139 };
1140 Ok(ret)
1141 }
1142 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1143 let struct_ident = TStructIdentifier::new("TSettleReq");
1144 o_prot.write_struct_begin(&struct_ident)?;
1145 o_prot.write_field_begin(&TFieldIdentifier::new("paths", TType::List, 1))?;
1146 o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.paths.len() as i32))?;
1147 for e in &self.paths {
1148 o_prot.write_string(e)?;
1149 o_prot.write_list_end()?;
1150 }
1151 o_prot.write_field_end()?;
1152 o_prot.write_field_stop()?;
1153 o_prot.write_struct_end()
1154 }
1155}
1156
1157#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1162pub struct TSchemaNode {
1163 pub node_name: String,
1164 pub node_type: i8,
1165}
1166
1167impl TSchemaNode {
1168 pub fn new(node_name: String, node_type: i8) -> TSchemaNode {
1169 TSchemaNode {
1170 node_name,
1171 node_type,
1172 }
1173 }
1174 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TSchemaNode> {
1175 i_prot.read_struct_begin()?;
1176 let mut f_1: Option<String> = None;
1177 let mut f_2: Option<i8> = None;
1178 loop {
1179 let field_ident = i_prot.read_field_begin()?;
1180 if field_ident.field_type == TType::Stop {
1181 break;
1182 }
1183 let field_id = field_id(&field_ident)?;
1184 match field_id {
1185 1 => {
1186 let val = i_prot.read_string()?;
1187 f_1 = Some(val);
1188 },
1189 2 => {
1190 let val = i_prot.read_i8()?;
1191 f_2 = Some(val);
1192 },
1193 _ => {
1194 i_prot.skip(field_ident.field_type)?;
1195 },
1196 };
1197 i_prot.read_field_end()?;
1198 }
1199 i_prot.read_struct_end()?;
1200 verify_required_field_exists("TSchemaNode.node_name", &f_1)?;
1201 verify_required_field_exists("TSchemaNode.node_type", &f_2)?;
1202 let ret = TSchemaNode {
1203 node_name: f_1.expect("auto-generated code should have checked for presence of required fields"),
1204 node_type: f_2.expect("auto-generated code should have checked for presence of required fields"),
1205 };
1206 Ok(ret)
1207 }
1208 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1209 let struct_ident = TStructIdentifier::new("TSchemaNode");
1210 o_prot.write_struct_begin(&struct_ident)?;
1211 o_prot.write_field_begin(&TFieldIdentifier::new("nodeName", TType::String, 1))?;
1212 o_prot.write_string(&self.node_name)?;
1213 o_prot.write_field_end()?;
1214 o_prot.write_field_begin(&TFieldIdentifier::new("nodeType", TType::I08, 2))?;
1215 o_prot.write_i8(self.node_type)?;
1216 o_prot.write_field_end()?;
1217 o_prot.write_field_stop()?;
1218 o_prot.write_struct_end()
1219 }
1220}
1221
1222#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1227pub struct TSetTTLReq {
1228 pub storage_group_path_pattern: Vec<String>,
1229 pub t_t_l: i64,
1230}
1231
1232impl TSetTTLReq {
1233 pub fn new(storage_group_path_pattern: Vec<String>, t_t_l: i64) -> TSetTTLReq {
1234 TSetTTLReq {
1235 storage_group_path_pattern,
1236 t_t_l,
1237 }
1238 }
1239 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TSetTTLReq> {
1240 i_prot.read_struct_begin()?;
1241 let mut f_1: Option<Vec<String>> = None;
1242 let mut f_2: Option<i64> = None;
1243 loop {
1244 let field_ident = i_prot.read_field_begin()?;
1245 if field_ident.field_type == TType::Stop {
1246 break;
1247 }
1248 let field_id = field_id(&field_ident)?;
1249 match field_id {
1250 1 => {
1251 let list_ident = i_prot.read_list_begin()?;
1252 let mut val: Vec<String> = Vec::with_capacity(list_ident.size as usize);
1253 for _ in 0..list_ident.size {
1254 let list_elem_4 = i_prot.read_string()?;
1255 val.push(list_elem_4);
1256 }
1257 i_prot.read_list_end()?;
1258 f_1 = Some(val);
1259 },
1260 2 => {
1261 let val = i_prot.read_i64()?;
1262 f_2 = Some(val);
1263 },
1264 _ => {
1265 i_prot.skip(field_ident.field_type)?;
1266 },
1267 };
1268 i_prot.read_field_end()?;
1269 }
1270 i_prot.read_struct_end()?;
1271 verify_required_field_exists("TSetTTLReq.storage_group_path_pattern", &f_1)?;
1272 verify_required_field_exists("TSetTTLReq.t_t_l", &f_2)?;
1273 let ret = TSetTTLReq {
1274 storage_group_path_pattern: f_1.expect("auto-generated code should have checked for presence of required fields"),
1275 t_t_l: f_2.expect("auto-generated code should have checked for presence of required fields"),
1276 };
1277 Ok(ret)
1278 }
1279 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1280 let struct_ident = TStructIdentifier::new("TSetTTLReq");
1281 o_prot.write_struct_begin(&struct_ident)?;
1282 o_prot.write_field_begin(&TFieldIdentifier::new("storageGroupPathPattern", TType::List, 1))?;
1283 o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.storage_group_path_pattern.len() as i32))?;
1284 for e in &self.storage_group_path_pattern {
1285 o_prot.write_string(e)?;
1286 o_prot.write_list_end()?;
1287 }
1288 o_prot.write_field_end()?;
1289 o_prot.write_field_begin(&TFieldIdentifier::new("TTL", TType::I64, 2))?;
1290 o_prot.write_i64(self.t_t_l)?;
1291 o_prot.write_field_end()?;
1292 o_prot.write_field_stop()?;
1293 o_prot.write_struct_end()
1294 }
1295}
1296
1297#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1302pub struct TFile {
1303 pub file_name: String,
1304 pub file: Vec<u8>,
1305}
1306
1307impl TFile {
1308 pub fn new(file_name: String, file: Vec<u8>) -> TFile {
1309 TFile {
1310 file_name,
1311 file,
1312 }
1313 }
1314 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TFile> {
1315 i_prot.read_struct_begin()?;
1316 let mut f_1: Option<String> = None;
1317 let mut f_2: Option<Vec<u8>> = None;
1318 loop {
1319 let field_ident = i_prot.read_field_begin()?;
1320 if field_ident.field_type == TType::Stop {
1321 break;
1322 }
1323 let field_id = field_id(&field_ident)?;
1324 match field_id {
1325 1 => {
1326 let val = i_prot.read_string()?;
1327 f_1 = Some(val);
1328 },
1329 2 => {
1330 let val = i_prot.read_bytes()?;
1331 f_2 = Some(val);
1332 },
1333 _ => {
1334 i_prot.skip(field_ident.field_type)?;
1335 },
1336 };
1337 i_prot.read_field_end()?;
1338 }
1339 i_prot.read_struct_end()?;
1340 verify_required_field_exists("TFile.file_name", &f_1)?;
1341 verify_required_field_exists("TFile.file", &f_2)?;
1342 let ret = TFile {
1343 file_name: f_1.expect("auto-generated code should have checked for presence of required fields"),
1344 file: f_2.expect("auto-generated code should have checked for presence of required fields"),
1345 };
1346 Ok(ret)
1347 }
1348 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1349 let struct_ident = TStructIdentifier::new("TFile");
1350 o_prot.write_struct_begin(&struct_ident)?;
1351 o_prot.write_field_begin(&TFieldIdentifier::new("fileName", TType::String, 1))?;
1352 o_prot.write_string(&self.file_name)?;
1353 o_prot.write_field_end()?;
1354 o_prot.write_field_begin(&TFieldIdentifier::new("file", TType::String, 2))?;
1355 o_prot.write_bytes(&self.file)?;
1356 o_prot.write_field_end()?;
1357 o_prot.write_field_stop()?;
1358 o_prot.write_struct_end()
1359 }
1360}
1361
1362#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1367pub struct TFilesResp {
1368 pub status: TSStatus,
1369 pub files: Vec<TFile>,
1370}
1371
1372impl TFilesResp {
1373 pub fn new(status: TSStatus, files: Vec<TFile>) -> TFilesResp {
1374 TFilesResp {
1375 status,
1376 files,
1377 }
1378 }
1379 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TFilesResp> {
1380 i_prot.read_struct_begin()?;
1381 let mut f_1: Option<TSStatus> = None;
1382 let mut f_2: Option<Vec<TFile>> = None;
1383 loop {
1384 let field_ident = i_prot.read_field_begin()?;
1385 if field_ident.field_type == TType::Stop {
1386 break;
1387 }
1388 let field_id = field_id(&field_ident)?;
1389 match field_id {
1390 1 => {
1391 let val = TSStatus::read_from_in_protocol(i_prot)?;
1392 f_1 = Some(val);
1393 },
1394 2 => {
1395 let list_ident = i_prot.read_list_begin()?;
1396 let mut val: Vec<TFile> = Vec::with_capacity(list_ident.size as usize);
1397 for _ in 0..list_ident.size {
1398 let list_elem_5 = TFile::read_from_in_protocol(i_prot)?;
1399 val.push(list_elem_5);
1400 }
1401 i_prot.read_list_end()?;
1402 f_2 = Some(val);
1403 },
1404 _ => {
1405 i_prot.skip(field_ident.field_type)?;
1406 },
1407 };
1408 i_prot.read_field_end()?;
1409 }
1410 i_prot.read_struct_end()?;
1411 verify_required_field_exists("TFilesResp.status", &f_1)?;
1412 verify_required_field_exists("TFilesResp.files", &f_2)?;
1413 let ret = TFilesResp {
1414 status: f_1.expect("auto-generated code should have checked for presence of required fields"),
1415 files: f_2.expect("auto-generated code should have checked for presence of required fields"),
1416 };
1417 Ok(ret)
1418 }
1419 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1420 let struct_ident = TStructIdentifier::new("TFilesResp");
1421 o_prot.write_struct_begin(&struct_ident)?;
1422 o_prot.write_field_begin(&TFieldIdentifier::new("status", TType::Struct, 1))?;
1423 self.status.write_to_out_protocol(o_prot)?;
1424 o_prot.write_field_end()?;
1425 o_prot.write_field_begin(&TFieldIdentifier::new("files", TType::List, 2))?;
1426 o_prot.write_list_begin(&TListIdentifier::new(TType::Struct, self.files.len() as i32))?;
1427 for e in &self.files {
1428 e.write_to_out_protocol(o_prot)?;
1429 o_prot.write_list_end()?;
1430 }
1431 o_prot.write_field_end()?;
1432 o_prot.write_field_stop()?;
1433 o_prot.write_struct_end()
1434 }
1435}
1436
1437#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1442pub struct TSpaceQuota {
1443 pub disk_size: Option<i64>,
1444 pub device_num: Option<i64>,
1445 pub timeserie_num: Option<i64>,
1446}
1447
1448impl TSpaceQuota {
1449 pub fn new<F1, F2, F3>(disk_size: F1, device_num: F2, timeserie_num: F3) -> TSpaceQuota where F1: Into<Option<i64>>, F2: Into<Option<i64>>, F3: Into<Option<i64>> {
1450 TSpaceQuota {
1451 disk_size: disk_size.into(),
1452 device_num: device_num.into(),
1453 timeserie_num: timeserie_num.into(),
1454 }
1455 }
1456 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TSpaceQuota> {
1457 i_prot.read_struct_begin()?;
1458 let mut f_1: Option<i64> = None;
1459 let mut f_2: Option<i64> = None;
1460 let mut f_3: Option<i64> = None;
1461 loop {
1462 let field_ident = i_prot.read_field_begin()?;
1463 if field_ident.field_type == TType::Stop {
1464 break;
1465 }
1466 let field_id = field_id(&field_ident)?;
1467 match field_id {
1468 1 => {
1469 let val = i_prot.read_i64()?;
1470 f_1 = Some(val);
1471 },
1472 2 => {
1473 let val = i_prot.read_i64()?;
1474 f_2 = Some(val);
1475 },
1476 3 => {
1477 let val = i_prot.read_i64()?;
1478 f_3 = Some(val);
1479 },
1480 _ => {
1481 i_prot.skip(field_ident.field_type)?;
1482 },
1483 };
1484 i_prot.read_field_end()?;
1485 }
1486 i_prot.read_struct_end()?;
1487 let ret = TSpaceQuota {
1488 disk_size: f_1,
1489 device_num: f_2,
1490 timeserie_num: f_3,
1491 };
1492 Ok(ret)
1493 }
1494 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1495 let struct_ident = TStructIdentifier::new("TSpaceQuota");
1496 o_prot.write_struct_begin(&struct_ident)?;
1497 if let Some(fld_var) = self.disk_size {
1498 o_prot.write_field_begin(&TFieldIdentifier::new("diskSize", TType::I64, 1))?;
1499 o_prot.write_i64(fld_var)?;
1500 o_prot.write_field_end()?
1501 }
1502 if let Some(fld_var) = self.device_num {
1503 o_prot.write_field_begin(&TFieldIdentifier::new("deviceNum", TType::I64, 2))?;
1504 o_prot.write_i64(fld_var)?;
1505 o_prot.write_field_end()?
1506 }
1507 if let Some(fld_var) = self.timeserie_num {
1508 o_prot.write_field_begin(&TFieldIdentifier::new("timeserieNum", TType::I64, 3))?;
1509 o_prot.write_i64(fld_var)?;
1510 o_prot.write_field_end()?
1511 }
1512 o_prot.write_field_stop()?;
1513 o_prot.write_struct_end()
1514 }
1515}
1516
1517impl Default for TSpaceQuota {
1518 fn default() -> Self {
1519 TSpaceQuota{
1520 disk_size: Some(0),
1521 device_num: Some(0),
1522 timeserie_num: Some(0),
1523 }
1524 }
1525}
1526
1527#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1532pub struct TTimedQuota {
1533 pub time_unit: i64,
1534 pub soft_limit: i64,
1535}
1536
1537impl TTimedQuota {
1538 pub fn new(time_unit: i64, soft_limit: i64) -> TTimedQuota {
1539 TTimedQuota {
1540 time_unit,
1541 soft_limit,
1542 }
1543 }
1544 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TTimedQuota> {
1545 i_prot.read_struct_begin()?;
1546 let mut f_1: Option<i64> = None;
1547 let mut f_2: Option<i64> = None;
1548 loop {
1549 let field_ident = i_prot.read_field_begin()?;
1550 if field_ident.field_type == TType::Stop {
1551 break;
1552 }
1553 let field_id = field_id(&field_ident)?;
1554 match field_id {
1555 1 => {
1556 let val = i_prot.read_i64()?;
1557 f_1 = Some(val);
1558 },
1559 2 => {
1560 let val = i_prot.read_i64()?;
1561 f_2 = Some(val);
1562 },
1563 _ => {
1564 i_prot.skip(field_ident.field_type)?;
1565 },
1566 };
1567 i_prot.read_field_end()?;
1568 }
1569 i_prot.read_struct_end()?;
1570 verify_required_field_exists("TTimedQuota.time_unit", &f_1)?;
1571 verify_required_field_exists("TTimedQuota.soft_limit", &f_2)?;
1572 let ret = TTimedQuota {
1573 time_unit: f_1.expect("auto-generated code should have checked for presence of required fields"),
1574 soft_limit: f_2.expect("auto-generated code should have checked for presence of required fields"),
1575 };
1576 Ok(ret)
1577 }
1578 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1579 let struct_ident = TStructIdentifier::new("TTimedQuota");
1580 o_prot.write_struct_begin(&struct_ident)?;
1581 o_prot.write_field_begin(&TFieldIdentifier::new("timeUnit", TType::I64, 1))?;
1582 o_prot.write_i64(self.time_unit)?;
1583 o_prot.write_field_end()?;
1584 o_prot.write_field_begin(&TFieldIdentifier::new("softLimit", TType::I64, 2))?;
1585 o_prot.write_i64(self.soft_limit)?;
1586 o_prot.write_field_end()?;
1587 o_prot.write_field_stop()?;
1588 o_prot.write_struct_end()
1589 }
1590}
1591
1592#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1597pub struct TThrottleQuota {
1598 pub throttle_limit: Option<BTreeMap<ThrottleType, TTimedQuota>>,
1599 pub mem_limit: Option<i64>,
1600 pub cpu_limit: Option<i32>,
1601}
1602
1603impl TThrottleQuota {
1604 pub fn new<F1, F2, F3>(throttle_limit: F1, mem_limit: F2, cpu_limit: F3) -> TThrottleQuota where F1: Into<Option<BTreeMap<ThrottleType, TTimedQuota>>>, F2: Into<Option<i64>>, F3: Into<Option<i32>> {
1605 TThrottleQuota {
1606 throttle_limit: throttle_limit.into(),
1607 mem_limit: mem_limit.into(),
1608 cpu_limit: cpu_limit.into(),
1609 }
1610 }
1611 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TThrottleQuota> {
1612 i_prot.read_struct_begin()?;
1613 let mut f_1: Option<BTreeMap<ThrottleType, TTimedQuota>> = None;
1614 let mut f_2: Option<i64> = None;
1615 let mut f_3: Option<i32> = None;
1616 loop {
1617 let field_ident = i_prot.read_field_begin()?;
1618 if field_ident.field_type == TType::Stop {
1619 break;
1620 }
1621 let field_id = field_id(&field_ident)?;
1622 match field_id {
1623 1 => {
1624 let map_ident = i_prot.read_map_begin()?;
1625 let mut val: BTreeMap<ThrottleType, TTimedQuota> = BTreeMap::new();
1626 for _ in 0..map_ident.size {
1627 let map_key_6 = ThrottleType::read_from_in_protocol(i_prot)?;
1628 let map_val_7 = TTimedQuota::read_from_in_protocol(i_prot)?;
1629 val.insert(map_key_6, map_val_7);
1630 }
1631 i_prot.read_map_end()?;
1632 f_1 = Some(val);
1633 },
1634 2 => {
1635 let val = i_prot.read_i64()?;
1636 f_2 = Some(val);
1637 },
1638 3 => {
1639 let val = i_prot.read_i32()?;
1640 f_3 = Some(val);
1641 },
1642 _ => {
1643 i_prot.skip(field_ident.field_type)?;
1644 },
1645 };
1646 i_prot.read_field_end()?;
1647 }
1648 i_prot.read_struct_end()?;
1649 let ret = TThrottleQuota {
1650 throttle_limit: f_1,
1651 mem_limit: f_2,
1652 cpu_limit: f_3,
1653 };
1654 Ok(ret)
1655 }
1656 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1657 let struct_ident = TStructIdentifier::new("TThrottleQuota");
1658 o_prot.write_struct_begin(&struct_ident)?;
1659 if let Some(ref fld_var) = self.throttle_limit {
1660 o_prot.write_field_begin(&TFieldIdentifier::new("throttleLimit", TType::Map, 1))?;
1661 o_prot.write_map_begin(&TMapIdentifier::new(TType::I32, TType::Struct, fld_var.len() as i32))?;
1662 for (k, v) in fld_var {
1663 k.write_to_out_protocol(o_prot)?;
1664 v.write_to_out_protocol(o_prot)?;
1665 o_prot.write_map_end()?;
1666 }
1667 o_prot.write_field_end()?
1668 }
1669 if let Some(fld_var) = self.mem_limit {
1670 o_prot.write_field_begin(&TFieldIdentifier::new("memLimit", TType::I64, 2))?;
1671 o_prot.write_i64(fld_var)?;
1672 o_prot.write_field_end()?
1673 }
1674 if let Some(fld_var) = self.cpu_limit {
1675 o_prot.write_field_begin(&TFieldIdentifier::new("cpuLimit", TType::I32, 3))?;
1676 o_prot.write_i32(fld_var)?;
1677 o_prot.write_field_end()?
1678 }
1679 o_prot.write_field_stop()?;
1680 o_prot.write_struct_end()
1681 }
1682}
1683
1684impl Default for TThrottleQuota {
1685 fn default() -> Self {
1686 TThrottleQuota{
1687 throttle_limit: Some(BTreeMap::new()),
1688 mem_limit: Some(0),
1689 cpu_limit: Some(0),
1690 }
1691 }
1692}
1693
1694#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1699pub struct TSetSpaceQuotaReq {
1700 pub database: Vec<String>,
1701 pub space_limit: TSpaceQuota,
1702}
1703
1704impl TSetSpaceQuotaReq {
1705 pub fn new(database: Vec<String>, space_limit: TSpaceQuota) -> TSetSpaceQuotaReq {
1706 TSetSpaceQuotaReq {
1707 database,
1708 space_limit,
1709 }
1710 }
1711 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TSetSpaceQuotaReq> {
1712 i_prot.read_struct_begin()?;
1713 let mut f_1: Option<Vec<String>> = None;
1714 let mut f_2: Option<TSpaceQuota> = None;
1715 loop {
1716 let field_ident = i_prot.read_field_begin()?;
1717 if field_ident.field_type == TType::Stop {
1718 break;
1719 }
1720 let field_id = field_id(&field_ident)?;
1721 match field_id {
1722 1 => {
1723 let list_ident = i_prot.read_list_begin()?;
1724 let mut val: Vec<String> = Vec::with_capacity(list_ident.size as usize);
1725 for _ in 0..list_ident.size {
1726 let list_elem_8 = i_prot.read_string()?;
1727 val.push(list_elem_8);
1728 }
1729 i_prot.read_list_end()?;
1730 f_1 = Some(val);
1731 },
1732 2 => {
1733 let val = TSpaceQuota::read_from_in_protocol(i_prot)?;
1734 f_2 = Some(val);
1735 },
1736 _ => {
1737 i_prot.skip(field_ident.field_type)?;
1738 },
1739 };
1740 i_prot.read_field_end()?;
1741 }
1742 i_prot.read_struct_end()?;
1743 verify_required_field_exists("TSetSpaceQuotaReq.database", &f_1)?;
1744 verify_required_field_exists("TSetSpaceQuotaReq.space_limit", &f_2)?;
1745 let ret = TSetSpaceQuotaReq {
1746 database: f_1.expect("auto-generated code should have checked for presence of required fields"),
1747 space_limit: f_2.expect("auto-generated code should have checked for presence of required fields"),
1748 };
1749 Ok(ret)
1750 }
1751 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1752 let struct_ident = TStructIdentifier::new("TSetSpaceQuotaReq");
1753 o_prot.write_struct_begin(&struct_ident)?;
1754 o_prot.write_field_begin(&TFieldIdentifier::new("database", TType::List, 1))?;
1755 o_prot.write_list_begin(&TListIdentifier::new(TType::String, self.database.len() as i32))?;
1756 for e in &self.database {
1757 o_prot.write_string(e)?;
1758 o_prot.write_list_end()?;
1759 }
1760 o_prot.write_field_end()?;
1761 o_prot.write_field_begin(&TFieldIdentifier::new("spaceLimit", TType::Struct, 2))?;
1762 self.space_limit.write_to_out_protocol(o_prot)?;
1763 o_prot.write_field_end()?;
1764 o_prot.write_field_stop()?;
1765 o_prot.write_struct_end()
1766 }
1767}
1768
1769#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1774pub struct TSetThrottleQuotaReq {
1775 pub user_name: String,
1776 pub throttle_quota: TThrottleQuota,
1777}
1778
1779impl TSetThrottleQuotaReq {
1780 pub fn new(user_name: String, throttle_quota: TThrottleQuota) -> TSetThrottleQuotaReq {
1781 TSetThrottleQuotaReq {
1782 user_name,
1783 throttle_quota,
1784 }
1785 }
1786 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TSetThrottleQuotaReq> {
1787 i_prot.read_struct_begin()?;
1788 let mut f_1: Option<String> = None;
1789 let mut f_2: Option<TThrottleQuota> = None;
1790 loop {
1791 let field_ident = i_prot.read_field_begin()?;
1792 if field_ident.field_type == TType::Stop {
1793 break;
1794 }
1795 let field_id = field_id(&field_ident)?;
1796 match field_id {
1797 1 => {
1798 let val = i_prot.read_string()?;
1799 f_1 = Some(val);
1800 },
1801 2 => {
1802 let val = TThrottleQuota::read_from_in_protocol(i_prot)?;
1803 f_2 = Some(val);
1804 },
1805 _ => {
1806 i_prot.skip(field_ident.field_type)?;
1807 },
1808 };
1809 i_prot.read_field_end()?;
1810 }
1811 i_prot.read_struct_end()?;
1812 verify_required_field_exists("TSetThrottleQuotaReq.user_name", &f_1)?;
1813 verify_required_field_exists("TSetThrottleQuotaReq.throttle_quota", &f_2)?;
1814 let ret = TSetThrottleQuotaReq {
1815 user_name: f_1.expect("auto-generated code should have checked for presence of required fields"),
1816 throttle_quota: f_2.expect("auto-generated code should have checked for presence of required fields"),
1817 };
1818 Ok(ret)
1819 }
1820 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1821 let struct_ident = TStructIdentifier::new("TSetThrottleQuotaReq");
1822 o_prot.write_struct_begin(&struct_ident)?;
1823 o_prot.write_field_begin(&TFieldIdentifier::new("userName", TType::String, 1))?;
1824 o_prot.write_string(&self.user_name)?;
1825 o_prot.write_field_end()?;
1826 o_prot.write_field_begin(&TFieldIdentifier::new("throttleQuota", TType::Struct, 2))?;
1827 self.throttle_quota.write_to_out_protocol(o_prot)?;
1828 o_prot.write_field_end()?;
1829 o_prot.write_field_stop()?;
1830 o_prot.write_struct_end()
1831 }
1832}
1833
1834#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1839pub struct TLicense {
1840 pub license_issue_timestamp: i64,
1841 pub expire_timestamp: i64,
1842 pub data_node_num_limit: i16,
1843 pub cpu_core_num_limit: i32,
1844 pub device_num_limit: i64,
1845 pub sensor_num_limit: i64,
1846 pub disconnection_from_active_node_time_limit: i64,
1847 pub ml_node_num_limit: i16,
1848}
1849
1850impl TLicense {
1851 pub fn new(license_issue_timestamp: i64, expire_timestamp: i64, data_node_num_limit: i16, cpu_core_num_limit: i32, device_num_limit: i64, sensor_num_limit: i64, disconnection_from_active_node_time_limit: i64, ml_node_num_limit: i16) -> TLicense {
1852 TLicense {
1853 license_issue_timestamp,
1854 expire_timestamp,
1855 data_node_num_limit,
1856 cpu_core_num_limit,
1857 device_num_limit,
1858 sensor_num_limit,
1859 disconnection_from_active_node_time_limit,
1860 ml_node_num_limit,
1861 }
1862 }
1863 pub fn read_from_in_protocol(i_prot: &mut dyn TInputProtocol) -> thrift::Result<TLicense> {
1864 i_prot.read_struct_begin()?;
1865 let mut f_1: Option<i64> = None;
1866 let mut f_2: Option<i64> = None;
1867 let mut f_4: Option<i16> = None;
1868 let mut f_5: Option<i32> = None;
1869 let mut f_6: Option<i64> = None;
1870 let mut f_7: Option<i64> = None;
1871 let mut f_8: Option<i64> = None;
1872 let mut f_9: Option<i16> = None;
1873 loop {
1874 let field_ident = i_prot.read_field_begin()?;
1875 if field_ident.field_type == TType::Stop {
1876 break;
1877 }
1878 let field_id = field_id(&field_ident)?;
1879 match field_id {
1880 1 => {
1881 let val = i_prot.read_i64()?;
1882 f_1 = Some(val);
1883 },
1884 2 => {
1885 let val = i_prot.read_i64()?;
1886 f_2 = Some(val);
1887 },
1888 4 => {
1889 let val = i_prot.read_i16()?;
1890 f_4 = Some(val);
1891 },
1892 5 => {
1893 let val = i_prot.read_i32()?;
1894 f_5 = Some(val);
1895 },
1896 6 => {
1897 let val = i_prot.read_i64()?;
1898 f_6 = Some(val);
1899 },
1900 7 => {
1901 let val = i_prot.read_i64()?;
1902 f_7 = Some(val);
1903 },
1904 8 => {
1905 let val = i_prot.read_i64()?;
1906 f_8 = Some(val);
1907 },
1908 9 => {
1909 let val = i_prot.read_i16()?;
1910 f_9 = Some(val);
1911 },
1912 _ => {
1913 i_prot.skip(field_ident.field_type)?;
1914 },
1915 };
1916 i_prot.read_field_end()?;
1917 }
1918 i_prot.read_struct_end()?;
1919 verify_required_field_exists("TLicense.license_issue_timestamp", &f_1)?;
1920 verify_required_field_exists("TLicense.expire_timestamp", &f_2)?;
1921 verify_required_field_exists("TLicense.data_node_num_limit", &f_4)?;
1922 verify_required_field_exists("TLicense.cpu_core_num_limit", &f_5)?;
1923 verify_required_field_exists("TLicense.device_num_limit", &f_6)?;
1924 verify_required_field_exists("TLicense.sensor_num_limit", &f_7)?;
1925 verify_required_field_exists("TLicense.disconnection_from_active_node_time_limit", &f_8)?;
1926 verify_required_field_exists("TLicense.ml_node_num_limit", &f_9)?;
1927 let ret = TLicense {
1928 license_issue_timestamp: f_1.expect("auto-generated code should have checked for presence of required fields"),
1929 expire_timestamp: f_2.expect("auto-generated code should have checked for presence of required fields"),
1930 data_node_num_limit: f_4.expect("auto-generated code should have checked for presence of required fields"),
1931 cpu_core_num_limit: f_5.expect("auto-generated code should have checked for presence of required fields"),
1932 device_num_limit: f_6.expect("auto-generated code should have checked for presence of required fields"),
1933 sensor_num_limit: f_7.expect("auto-generated code should have checked for presence of required fields"),
1934 disconnection_from_active_node_time_limit: f_8.expect("auto-generated code should have checked for presence of required fields"),
1935 ml_node_num_limit: f_9.expect("auto-generated code should have checked for presence of required fields"),
1936 };
1937 Ok(ret)
1938 }
1939 pub fn write_to_out_protocol(&self, o_prot: &mut dyn TOutputProtocol) -> thrift::Result<()> {
1940 let struct_ident = TStructIdentifier::new("TLicense");
1941 o_prot.write_struct_begin(&struct_ident)?;
1942 o_prot.write_field_begin(&TFieldIdentifier::new("licenseIssueTimestamp", TType::I64, 1))?;
1943 o_prot.write_i64(self.license_issue_timestamp)?;
1944 o_prot.write_field_end()?;
1945 o_prot.write_field_begin(&TFieldIdentifier::new("expireTimestamp", TType::I64, 2))?;
1946 o_prot.write_i64(self.expire_timestamp)?;
1947 o_prot.write_field_end()?;
1948 o_prot.write_field_begin(&TFieldIdentifier::new("dataNodeNumLimit", TType::I16, 4))?;
1949 o_prot.write_i16(self.data_node_num_limit)?;
1950 o_prot.write_field_end()?;
1951 o_prot.write_field_begin(&TFieldIdentifier::new("cpuCoreNumLimit", TType::I32, 5))?;
1952 o_prot.write_i32(self.cpu_core_num_limit)?;
1953 o_prot.write_field_end()?;
1954 o_prot.write_field_begin(&TFieldIdentifier::new("deviceNumLimit", TType::I64, 6))?;
1955 o_prot.write_i64(self.device_num_limit)?;
1956 o_prot.write_field_end()?;
1957 o_prot.write_field_begin(&TFieldIdentifier::new("sensorNumLimit", TType::I64, 7))?;
1958 o_prot.write_i64(self.sensor_num_limit)?;
1959 o_prot.write_field_end()?;
1960 o_prot.write_field_begin(&TFieldIdentifier::new("disconnectionFromActiveNodeTimeLimit", TType::I64, 8))?;
1961 o_prot.write_i64(self.disconnection_from_active_node_time_limit)?;
1962 o_prot.write_field_end()?;
1963 o_prot.write_field_begin(&TFieldIdentifier::new("mlNodeNumLimit", TType::I16, 9))?;
1964 o_prot.write_i16(self.ml_node_num_limit)?;
1965 o_prot.write_field_end()?;
1966 o_prot.write_field_stop()?;
1967 o_prot.write_struct_end()
1968 }
1969}
1970