#![recursion_limit = "100000000"]
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals, unused_crate_dependencies)]
#![allow(clippy::all)]
pub use self::errors::*;
pub use self::types::*;
pub mod types {
#![allow(clippy::redundant_closure)]
#[derive(Clone, Debug, PartialEq)]
pub struct ProfilingStats {
pub rows: ::std::primitive::i64,
pub exec_duration_in_us: ::std::primitive::i64,
pub total_duration_in_us: ::std::primitive::i64,
pub other_stats: ::std::option::Option<::std::collections::BTreeMap<::std::vec::Vec<::std::primitive::u8>, ::std::vec::Vec<::std::primitive::u8>>>,
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct PlanNodeBranchInfo {
pub is_do_branch: ::std::primitive::bool,
pub condition_node_id: ::std::primitive::i64,
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct Pair {
pub key: ::std::vec::Vec<::std::primitive::u8>,
pub value: ::std::vec::Vec<::std::primitive::u8>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct PlanNodeDescription {
pub name: ::std::vec::Vec<::std::primitive::u8>,
pub id: ::std::primitive::i64,
pub output_var: ::std::vec::Vec<::std::primitive::u8>,
pub description: ::std::option::Option<::std::vec::Vec<crate::types::Pair>>,
pub profiles: ::std::option::Option<::std::vec::Vec<crate::types::ProfilingStats>>,
pub branch_info: ::std::option::Option<crate::types::PlanNodeBranchInfo>,
pub dependencies: ::std::option::Option<::std::vec::Vec<::std::primitive::i64>>,
}
#[derive(Clone, Debug, PartialEq)]
pub struct PlanDescription {
pub plan_node_descs: ::std::vec::Vec<crate::types::PlanNodeDescription>,
pub node_index_map: ::std::collections::BTreeMap<::std::primitive::i64, ::std::primitive::i64>,
pub format: ::std::vec::Vec<::std::primitive::u8>,
pub optimize_time_in_us: ::std::primitive::i32,
}
#[derive(Clone, Debug, PartialEq)]
pub struct ExecutionResponse {
pub error_code: crate::types::ErrorCode,
pub latency_in_us: ::std::primitive::i32,
pub data: ::std::option::Option<common::types::DataSet>,
pub space_name: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>,
pub error_msg: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>,
pub plan_desc: ::std::option::Option<crate::types::PlanDescription>,
pub comment: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>,
}
#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct AuthResponse {
pub error_code: crate::types::ErrorCode,
pub error_msg: ::std::option::Option<::std::vec::Vec<::std::primitive::u8>>,
pub session_id: ::std::option::Option<::std::primitive::i64>,
}
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ErrorCode(pub ::std::primitive::i32);
impl ErrorCode {
pub const SUCCEEDED: Self = ErrorCode(0i32);
pub const E_DISCONNECTED: Self = ErrorCode(-1i32);
pub const E_FAIL_TO_CONNECT: Self = ErrorCode(-2i32);
pub const E_RPC_FAILURE: Self = ErrorCode(-3i32);
pub const E_BAD_USERNAME_PASSWORD: Self = ErrorCode(-4i32);
pub const E_SESSION_INVALID: Self = ErrorCode(-5i32);
pub const E_SESSION_TIMEOUT: Self = ErrorCode(-6i32);
pub const E_SYNTAX_ERROR: Self = ErrorCode(-7i32);
pub const E_EXECUTION_ERROR: Self = ErrorCode(-8i32);
pub const E_STATEMENT_EMPTY: Self = ErrorCode(-9i32);
pub const E_USER_NOT_FOUND: Self = ErrorCode(-10i32);
pub const E_BAD_PERMISSION: Self = ErrorCode(-11i32);
pub const E_SEMANTIC_ERROR: Self = ErrorCode(-12i32);
pub const E_TOO_MANY_CONNECTIONS: Self = ErrorCode(-13i32);
pub const E_PARTIAL_SUCCEEDED: Self = ErrorCode(-14i32);
}
impl ::fbthrift::ThriftEnum for ErrorCode {
fn enumerate() -> &'static [(ErrorCode, &'static str)] {
&[
(ErrorCode::SUCCEEDED, "SUCCEEDED"),
(ErrorCode::E_DISCONNECTED, "E_DISCONNECTED"),
(ErrorCode::E_FAIL_TO_CONNECT, "E_FAIL_TO_CONNECT"),
(ErrorCode::E_RPC_FAILURE, "E_RPC_FAILURE"),
(ErrorCode::E_BAD_USERNAME_PASSWORD, "E_BAD_USERNAME_PASSWORD"),
(ErrorCode::E_SESSION_INVALID, "E_SESSION_INVALID"),
(ErrorCode::E_SESSION_TIMEOUT, "E_SESSION_TIMEOUT"),
(ErrorCode::E_SYNTAX_ERROR, "E_SYNTAX_ERROR"),
(ErrorCode::E_EXECUTION_ERROR, "E_EXECUTION_ERROR"),
(ErrorCode::E_STATEMENT_EMPTY, "E_STATEMENT_EMPTY"),
(ErrorCode::E_USER_NOT_FOUND, "E_USER_NOT_FOUND"),
(ErrorCode::E_BAD_PERMISSION, "E_BAD_PERMISSION"),
(ErrorCode::E_SEMANTIC_ERROR, "E_SEMANTIC_ERROR"),
(ErrorCode::E_TOO_MANY_CONNECTIONS, "E_TOO_MANY_CONNECTIONS"),
(ErrorCode::E_PARTIAL_SUCCEEDED, "E_PARTIAL_SUCCEEDED"),
]
}
fn variants() -> &'static [&'static str] {
&[
"SUCCEEDED",
"E_DISCONNECTED",
"E_FAIL_TO_CONNECT",
"E_RPC_FAILURE",
"E_BAD_USERNAME_PASSWORD",
"E_SESSION_INVALID",
"E_SESSION_TIMEOUT",
"E_SYNTAX_ERROR",
"E_EXECUTION_ERROR",
"E_STATEMENT_EMPTY",
"E_USER_NOT_FOUND",
"E_BAD_PERMISSION",
"E_SEMANTIC_ERROR",
"E_TOO_MANY_CONNECTIONS",
"E_PARTIAL_SUCCEEDED",
]
}
fn variant_values() -> &'static [ErrorCode] {
&[
ErrorCode::SUCCEEDED,
ErrorCode::E_DISCONNECTED,
ErrorCode::E_FAIL_TO_CONNECT,
ErrorCode::E_RPC_FAILURE,
ErrorCode::E_BAD_USERNAME_PASSWORD,
ErrorCode::E_SESSION_INVALID,
ErrorCode::E_SESSION_TIMEOUT,
ErrorCode::E_SYNTAX_ERROR,
ErrorCode::E_EXECUTION_ERROR,
ErrorCode::E_STATEMENT_EMPTY,
ErrorCode::E_USER_NOT_FOUND,
ErrorCode::E_BAD_PERMISSION,
ErrorCode::E_SEMANTIC_ERROR,
ErrorCode::E_TOO_MANY_CONNECTIONS,
ErrorCode::E_PARTIAL_SUCCEEDED,
]
}
}
impl ::std::default::Default for ErrorCode {
fn default() -> Self {
ErrorCode(::fbthrift::__UNKNOWN_ID)
}
}
impl<'a> ::std::convert::From<&'a ErrorCode> for ::std::primitive::i32 {
#[inline]
fn from(x: &'a ErrorCode) -> Self {
x.0
}
}
impl ::std::convert::From<ErrorCode> for ::std::primitive::i32 {
#[inline]
fn from(x: ErrorCode) -> Self {
x.0
}
}
impl ::std::convert::From<::std::primitive::i32> for ErrorCode {
#[inline]
fn from(x: ::std::primitive::i32) -> Self {
Self(x)
}
}
impl ::std::fmt::Display for ErrorCode {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
static VARIANTS_BY_NUMBER: &[(&::std::primitive::str, ::std::primitive::i32)] = &[
("E_PARTIAL_SUCCEEDED", -14),
("E_TOO_MANY_CONNECTIONS", -13),
("E_SEMANTIC_ERROR", -12),
("E_BAD_PERMISSION", -11),
("E_USER_NOT_FOUND", -10),
("E_STATEMENT_EMPTY", -9),
("E_EXECUTION_ERROR", -8),
("E_SYNTAX_ERROR", -7),
("E_SESSION_TIMEOUT", -6),
("E_SESSION_INVALID", -5),
("E_BAD_USERNAME_PASSWORD", -4),
("E_RPC_FAILURE", -3),
("E_FAIL_TO_CONNECT", -2),
("E_DISCONNECTED", -1),
("SUCCEEDED", 0),
];
::fbthrift::help::enum_display(VARIANTS_BY_NUMBER, fmt, self.0)
}
}
impl ::std::fmt::Debug for ErrorCode {
fn fmt(&self, fmt: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
write!(fmt, "ErrorCode::{}", self)
}
}
impl ::std::str::FromStr for ErrorCode {
type Err = ::anyhow::Error;
fn from_str(string: &::std::primitive::str) -> ::std::result::Result<Self, Self::Err> {
static VARIANTS_BY_NAME: &[(&::std::primitive::str, ::std::primitive::i32)] = &[
("E_BAD_PERMISSION", -11),
("E_BAD_USERNAME_PASSWORD", -4),
("E_DISCONNECTED", -1),
("E_EXECUTION_ERROR", -8),
("E_FAIL_TO_CONNECT", -2),
("E_PARTIAL_SUCCEEDED", -14),
("E_RPC_FAILURE", -3),
("E_SEMANTIC_ERROR", -12),
("E_SESSION_INVALID", -5),
("E_SESSION_TIMEOUT", -6),
("E_STATEMENT_EMPTY", -9),
("E_SYNTAX_ERROR", -7),
("E_TOO_MANY_CONNECTIONS", -13),
("E_USER_NOT_FOUND", -10),
("SUCCEEDED", 0),
];
::fbthrift::help::enum_from_str(VARIANTS_BY_NAME, string, "ErrorCode").map(ErrorCode)
}
}
impl ::fbthrift::GetTType for ErrorCode {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::I32;
}
impl<P> ::fbthrift::Serialize<P> for ErrorCode
where
P: ::fbthrift::ProtocolWriter,
{
#[inline]
fn write(&self, p: &mut P) {
p.write_i32(self.into())
}
}
impl<P> ::fbthrift::Deserialize<P> for ErrorCode
where
P: ::fbthrift::ProtocolReader,
{
#[inline]
fn read(p: &mut P) -> ::anyhow::Result<Self> {
::std::result::Result::Ok(ErrorCode::from(p.read_i32()?))
}
}
impl ::std::default::Default for self::ProfilingStats {
fn default() -> Self {
Self {
rows: ::std::default::Default::default(),
exec_duration_in_us: ::std::default::Default::default(),
total_duration_in_us: ::std::default::Default::default(),
other_stats: ::std::option::Option::None,
}
}
}
unsafe impl ::std::marker::Send for self::ProfilingStats {}
unsafe impl ::std::marker::Sync for self::ProfilingStats {}
impl ::fbthrift::GetTType for self::ProfilingStats {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::ProfilingStats
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("ProfilingStats");
p.write_field_begin("rows", ::fbthrift::TType::I64, 1);
::fbthrift::Serialize::write(&self.rows, p);
p.write_field_end();
p.write_field_begin("exec_duration_in_us", ::fbthrift::TType::I64, 2);
::fbthrift::Serialize::write(&self.exec_duration_in_us, p);
p.write_field_end();
p.write_field_begin("total_duration_in_us", ::fbthrift::TType::I64, 3);
::fbthrift::Serialize::write(&self.total_duration_in_us, p);
p.write_field_end();
if let ::std::option::Option::Some(some) = &self.other_stats {
p.write_field_begin("other_stats", ::fbthrift::TType::Map, 4);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::ProfilingStats
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static FIELDS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("exec_duration_in_us", ::fbthrift::TType::I64, 2),
::fbthrift::Field::new("other_stats", ::fbthrift::TType::Map, 4),
::fbthrift::Field::new("rows", ::fbthrift::TType::I64, 1),
::fbthrift::Field::new("total_duration_in_us", ::fbthrift::TType::I64, 3),
];
let mut field_rows = ::std::option::Option::None;
let mut field_exec_duration_in_us = ::std::option::Option::None;
let mut field_total_duration_in_us = ::std::option::Option::None;
let mut field_other_stats = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I64, 1) => field_rows = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I64, 2) => field_exec_duration_in_us = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I64, 3) => field_total_duration_in_us = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Map, 4) => field_other_stats = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
rows: field_rows.unwrap_or_default(),
exec_duration_in_us: field_exec_duration_in_us.unwrap_or_default(),
total_duration_in_us: field_total_duration_in_us.unwrap_or_default(),
other_stats: field_other_stats,
})
}
}
impl ::std::default::Default for self::PlanNodeBranchInfo {
fn default() -> Self {
Self {
is_do_branch: ::std::default::Default::default(),
condition_node_id: ::std::default::Default::default(),
}
}
}
unsafe impl ::std::marker::Send for self::PlanNodeBranchInfo {}
unsafe impl ::std::marker::Sync for self::PlanNodeBranchInfo {}
impl ::fbthrift::GetTType for self::PlanNodeBranchInfo {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::PlanNodeBranchInfo
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("PlanNodeBranchInfo");
p.write_field_begin("is_do_branch", ::fbthrift::TType::Bool, 1);
::fbthrift::Serialize::write(&self.is_do_branch, p);
p.write_field_end();
p.write_field_begin("condition_node_id", ::fbthrift::TType::I64, 2);
::fbthrift::Serialize::write(&self.condition_node_id, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::PlanNodeBranchInfo
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static FIELDS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("condition_node_id", ::fbthrift::TType::I64, 2),
::fbthrift::Field::new("is_do_branch", ::fbthrift::TType::Bool, 1),
];
let mut field_is_do_branch = ::std::option::Option::None;
let mut field_condition_node_id = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::Bool, 1) => field_is_do_branch = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I64, 2) => field_condition_node_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
is_do_branch: field_is_do_branch.unwrap_or_default(),
condition_node_id: field_condition_node_id.unwrap_or_default(),
})
}
}
impl ::std::default::Default for self::Pair {
fn default() -> Self {
Self {
key: ::std::default::Default::default(),
value: ::std::default::Default::default(),
}
}
}
unsafe impl ::std::marker::Send for self::Pair {}
unsafe impl ::std::marker::Sync for self::Pair {}
impl ::fbthrift::GetTType for self::Pair {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::Pair
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("Pair");
p.write_field_begin("key", ::fbthrift::TType::String, 1);
::fbthrift::Serialize::write(&self.key, p);
p.write_field_end();
p.write_field_begin("value", ::fbthrift::TType::String, 2);
::fbthrift::Serialize::write(&self.value, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::Pair
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static FIELDS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("key", ::fbthrift::TType::String, 1),
::fbthrift::Field::new("value", ::fbthrift::TType::String, 2),
];
let mut field_key = ::std::option::Option::None;
let mut field_value = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::String, 1) => field_key = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 2) => field_value = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
key: field_key.unwrap_or_default(),
value: field_value.unwrap_or_default(),
})
}
}
impl ::std::default::Default for self::PlanNodeDescription {
fn default() -> Self {
Self {
name: ::std::default::Default::default(),
id: ::std::default::Default::default(),
output_var: ::std::default::Default::default(),
description: ::std::option::Option::None,
profiles: ::std::option::Option::None,
branch_info: ::std::option::Option::None,
dependencies: ::std::option::Option::None,
}
}
}
unsafe impl ::std::marker::Send for self::PlanNodeDescription {}
unsafe impl ::std::marker::Sync for self::PlanNodeDescription {}
impl ::fbthrift::GetTType for self::PlanNodeDescription {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::PlanNodeDescription
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("PlanNodeDescription");
p.write_field_begin("name", ::fbthrift::TType::String, 1);
::fbthrift::Serialize::write(&self.name, p);
p.write_field_end();
p.write_field_begin("id", ::fbthrift::TType::I64, 2);
::fbthrift::Serialize::write(&self.id, p);
p.write_field_end();
p.write_field_begin("output_var", ::fbthrift::TType::String, 3);
::fbthrift::Serialize::write(&self.output_var, p);
p.write_field_end();
if let ::std::option::Option::Some(some) = &self.description {
p.write_field_begin("description", ::fbthrift::TType::List, 4);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.profiles {
p.write_field_begin("profiles", ::fbthrift::TType::List, 5);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.branch_info {
p.write_field_begin("branch_info", ::fbthrift::TType::Struct, 6);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.dependencies {
p.write_field_begin("dependencies", ::fbthrift::TType::List, 7);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::PlanNodeDescription
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static FIELDS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("branch_info", ::fbthrift::TType::Struct, 6),
::fbthrift::Field::new("dependencies", ::fbthrift::TType::List, 7),
::fbthrift::Field::new("description", ::fbthrift::TType::List, 4),
::fbthrift::Field::new("id", ::fbthrift::TType::I64, 2),
::fbthrift::Field::new("name", ::fbthrift::TType::String, 1),
::fbthrift::Field::new("output_var", ::fbthrift::TType::String, 3),
::fbthrift::Field::new("profiles", ::fbthrift::TType::List, 5),
];
let mut field_name = ::std::option::Option::None;
let mut field_id = ::std::option::Option::None;
let mut field_output_var = ::std::option::Option::None;
let mut field_description = ::std::option::Option::None;
let mut field_profiles = ::std::option::Option::None;
let mut field_branch_info = ::std::option::Option::None;
let mut field_dependencies = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::String, 1) => field_name = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I64, 2) => field_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 3) => field_output_var = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::List, 4) => field_description = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::List, 5) => field_profiles = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Struct, 6) => field_branch_info = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::List, 7) => field_dependencies = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
name: field_name.unwrap_or_default(),
id: field_id.unwrap_or_default(),
output_var: field_output_var.unwrap_or_default(),
description: field_description,
profiles: field_profiles,
branch_info: field_branch_info,
dependencies: field_dependencies,
})
}
}
impl ::std::default::Default for self::PlanDescription {
fn default() -> Self {
Self {
plan_node_descs: ::std::default::Default::default(),
node_index_map: ::std::default::Default::default(),
format: ::std::default::Default::default(),
optimize_time_in_us: ::std::default::Default::default(),
}
}
}
unsafe impl ::std::marker::Send for self::PlanDescription {}
unsafe impl ::std::marker::Sync for self::PlanDescription {}
impl ::fbthrift::GetTType for self::PlanDescription {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::PlanDescription
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("PlanDescription");
p.write_field_begin("plan_node_descs", ::fbthrift::TType::List, 1);
::fbthrift::Serialize::write(&self.plan_node_descs, p);
p.write_field_end();
p.write_field_begin("node_index_map", ::fbthrift::TType::Map, 2);
::fbthrift::Serialize::write(&self.node_index_map, p);
p.write_field_end();
p.write_field_begin("format", ::fbthrift::TType::String, 3);
::fbthrift::Serialize::write(&self.format, p);
p.write_field_end();
p.write_field_begin("optimize_time_in_us", ::fbthrift::TType::I32, 4);
::fbthrift::Serialize::write(&self.optimize_time_in_us, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::PlanDescription
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static FIELDS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("format", ::fbthrift::TType::String, 3),
::fbthrift::Field::new("node_index_map", ::fbthrift::TType::Map, 2),
::fbthrift::Field::new("optimize_time_in_us", ::fbthrift::TType::I32, 4),
::fbthrift::Field::new("plan_node_descs", ::fbthrift::TType::List, 1),
];
let mut field_plan_node_descs = ::std::option::Option::None;
let mut field_node_index_map = ::std::option::Option::None;
let mut field_format = ::std::option::Option::None;
let mut field_optimize_time_in_us = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::List, 1) => field_plan_node_descs = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Map, 2) => field_node_index_map = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 3) => field_format = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I32, 4) => field_optimize_time_in_us = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
plan_node_descs: field_plan_node_descs.unwrap_or_default(),
node_index_map: field_node_index_map.unwrap_or_default(),
format: field_format.unwrap_or_default(),
optimize_time_in_us: field_optimize_time_in_us.unwrap_or_default(),
})
}
}
impl ::std::default::Default for self::ExecutionResponse {
fn default() -> Self {
Self {
error_code: ::std::default::Default::default(),
latency_in_us: ::std::default::Default::default(),
data: ::std::option::Option::None,
space_name: ::std::option::Option::None,
error_msg: ::std::option::Option::None,
plan_desc: ::std::option::Option::None,
comment: ::std::option::Option::None,
}
}
}
unsafe impl ::std::marker::Send for self::ExecutionResponse {}
unsafe impl ::std::marker::Sync for self::ExecutionResponse {}
impl ::fbthrift::GetTType for self::ExecutionResponse {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::ExecutionResponse
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("ExecutionResponse");
p.write_field_begin("error_code", ::fbthrift::TType::I32, 1);
::fbthrift::Serialize::write(&self.error_code, p);
p.write_field_end();
p.write_field_begin("latency_in_us", ::fbthrift::TType::I32, 2);
::fbthrift::Serialize::write(&self.latency_in_us, p);
p.write_field_end();
if let ::std::option::Option::Some(some) = &self.data {
p.write_field_begin("data", ::fbthrift::TType::Struct, 3);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.space_name {
p.write_field_begin("space_name", ::fbthrift::TType::String, 4);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.error_msg {
p.write_field_begin("error_msg", ::fbthrift::TType::String, 5);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.plan_desc {
p.write_field_begin("plan_desc", ::fbthrift::TType::Struct, 6);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.comment {
p.write_field_begin("comment", ::fbthrift::TType::String, 7);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::ExecutionResponse
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static FIELDS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("comment", ::fbthrift::TType::String, 7),
::fbthrift::Field::new("data", ::fbthrift::TType::Struct, 3),
::fbthrift::Field::new("error_code", ::fbthrift::TType::I32, 1),
::fbthrift::Field::new("error_msg", ::fbthrift::TType::String, 5),
::fbthrift::Field::new("latency_in_us", ::fbthrift::TType::I32, 2),
::fbthrift::Field::new("plan_desc", ::fbthrift::TType::Struct, 6),
::fbthrift::Field::new("space_name", ::fbthrift::TType::String, 4),
];
let mut field_error_code = ::std::option::Option::None;
let mut field_latency_in_us = ::std::option::Option::None;
let mut field_data = ::std::option::Option::None;
let mut field_space_name = ::std::option::Option::None;
let mut field_error_msg = ::std::option::Option::None;
let mut field_plan_desc = ::std::option::Option::None;
let mut field_comment = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I32, 1) => field_error_code = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I32, 2) => field_latency_in_us = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Struct, 3) => field_data = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 4) => field_space_name = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 5) => field_error_msg = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::Struct, 6) => field_plan_desc = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 7) => field_comment = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
error_code: field_error_code.unwrap_or_default(),
latency_in_us: field_latency_in_us.unwrap_or_default(),
data: field_data,
space_name: field_space_name,
error_msg: field_error_msg,
plan_desc: field_plan_desc,
comment: field_comment,
})
}
}
impl ::std::default::Default for self::AuthResponse {
fn default() -> Self {
Self {
error_code: ::std::default::Default::default(),
error_msg: ::std::option::Option::None,
session_id: ::std::option::Option::None,
}
}
}
unsafe impl ::std::marker::Send for self::AuthResponse {}
unsafe impl ::std::marker::Sync for self::AuthResponse {}
impl ::fbthrift::GetTType for self::AuthResponse {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for self::AuthResponse
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("AuthResponse");
p.write_field_begin("error_code", ::fbthrift::TType::I32, 1);
::fbthrift::Serialize::write(&self.error_code, p);
p.write_field_end();
if let ::std::option::Option::Some(some) = &self.error_msg {
p.write_field_begin("error_msg", ::fbthrift::TType::String, 2);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
if let ::std::option::Option::Some(some) = &self.session_id {
p.write_field_begin("session_id", ::fbthrift::TType::I64, 3);
::fbthrift::Serialize::write(some, p);
p.write_field_end();
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for self::AuthResponse
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static FIELDS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("error_code", ::fbthrift::TType::I32, 1),
::fbthrift::Field::new("error_msg", ::fbthrift::TType::String, 2),
::fbthrift::Field::new("session_id", ::fbthrift::TType::I64, 3),
];
let mut field_error_code = ::std::option::Option::None;
let mut field_error_msg = ::std::option::Option::None;
let mut field_session_id = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), FIELDS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I32, 1) => field_error_code = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 2) => field_error_msg = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::I64, 3) => field_session_id = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(Self {
error_code: field_error_code.unwrap_or_default(),
error_msg: field_error_msg,
session_id: field_session_id,
})
}
}
}
pub mod dependencies {
pub use common as common;
}
pub mod services {
pub mod graph_service {
#[derive(Clone, Debug)]
pub enum AuthenticateExn {
Success(crate::types::AuthResponse),
ApplicationException(::fbthrift::ApplicationException),
}
impl ::std::convert::From<::fbthrift::ApplicationException> for AuthenticateExn {
fn from(exn: ::fbthrift::ApplicationException) -> Self {
AuthenticateExn::ApplicationException(exn)
}
}
impl ::fbthrift::GetTType for AuthenticateExn {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for AuthenticateExn
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("Authenticate");
match self {
AuthenticateExn::Success(inner) => {
p.write_field_begin(
"Success",
::fbthrift::TType::Struct,
0i16,
);
inner.write(p);
p.write_field_end();
}
AuthenticateExn::ApplicationException(_) => panic!(
"Bad union Alt field {} id {}",
"ApplicationException",
-2147483648i32,
),
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for AuthenticateExn
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static RETURNS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("Success", ::fbthrift::TType::Struct, 0),
];
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = ::std::option::Option::None;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
match ((fty, fid as ::std::primitive::i32), once) {
((::fbthrift::TType::Stop, _), _) => {
p.read_field_end()?;
break;
}
((::fbthrift::TType::Struct, 0i32), false) => {
once = true;
alt = ::std::option::Option::Some(AuthenticateExn::Success(::fbthrift::Deserialize::read(p)?));
}
((ty, _id), false) => p.skip(ty)?,
((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
format!(
"unwanted extra union {} field ty {:?} id {}",
"AuthenticateExn",
badty,
badid,
),
)
)),
}
p.read_field_end()?;
}
p.read_struct_end()?;
alt.ok_or_else(||
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::MissingResult,
format!("Empty union {}", "AuthenticateExn"),
)
.into(),
)
}
}
#[derive(Clone, Debug)]
pub enum SignoutExn {
Success(()),
ApplicationException(::fbthrift::ApplicationException),
}
impl ::std::convert::From<::fbthrift::ApplicationException> for SignoutExn {
fn from(exn: ::fbthrift::ApplicationException) -> Self {
SignoutExn::ApplicationException(exn)
}
}
impl ::fbthrift::GetTType for SignoutExn {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for SignoutExn
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("Signout");
match self {
SignoutExn::Success(inner) => {
p.write_field_begin(
"Success",
::fbthrift::TType::Void,
0i16,
);
inner.write(p);
p.write_field_end();
}
SignoutExn::ApplicationException(_) => panic!(
"Bad union Alt field {} id {}",
"ApplicationException",
-2147483648i32,
),
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for SignoutExn
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static RETURNS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("Success", ::fbthrift::TType::Void, 0),
];
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = SignoutExn::Success(());
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
match ((fty, fid as ::std::primitive::i32), once) {
((::fbthrift::TType::Stop, _), _) => {
p.read_field_end()?;
break;
}
((::fbthrift::TType::Void, 0i32), false) => {
once = true;
alt = SignoutExn::Success(::fbthrift::Deserialize::read(p)?);
}
((ty, _id), false) => p.skip(ty)?,
((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
format!(
"unwanted extra union {} field ty {:?} id {}",
"SignoutExn",
badty,
badid,
),
)
)),
}
p.read_field_end()?;
}
p.read_struct_end()?;
::std::result::Result::Ok(alt)
}
}
#[derive(Clone, Debug)]
pub enum ExecuteExn {
Success(crate::types::ExecutionResponse),
ApplicationException(::fbthrift::ApplicationException),
}
impl ::std::convert::From<::fbthrift::ApplicationException> for ExecuteExn {
fn from(exn: ::fbthrift::ApplicationException) -> Self {
ExecuteExn::ApplicationException(exn)
}
}
impl ::fbthrift::GetTType for ExecuteExn {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for ExecuteExn
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("Execute");
match self {
ExecuteExn::Success(inner) => {
p.write_field_begin(
"Success",
::fbthrift::TType::Struct,
0i16,
);
inner.write(p);
p.write_field_end();
}
ExecuteExn::ApplicationException(_) => panic!(
"Bad union Alt field {} id {}",
"ApplicationException",
-2147483648i32,
),
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for ExecuteExn
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static RETURNS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("Success", ::fbthrift::TType::Struct, 0),
];
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = ::std::option::Option::None;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
match ((fty, fid as ::std::primitive::i32), once) {
((::fbthrift::TType::Stop, _), _) => {
p.read_field_end()?;
break;
}
((::fbthrift::TType::Struct, 0i32), false) => {
once = true;
alt = ::std::option::Option::Some(ExecuteExn::Success(::fbthrift::Deserialize::read(p)?));
}
((ty, _id), false) => p.skip(ty)?,
((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
format!(
"unwanted extra union {} field ty {:?} id {}",
"ExecuteExn",
badty,
badid,
),
)
)),
}
p.read_field_end()?;
}
p.read_struct_end()?;
alt.ok_or_else(||
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::MissingResult,
format!("Empty union {}", "ExecuteExn"),
)
.into(),
)
}
}
#[derive(Clone, Debug)]
pub enum ExecuteJsonExn {
Success(::std::vec::Vec<::std::primitive::u8>),
ApplicationException(::fbthrift::ApplicationException),
}
impl ::std::convert::From<::fbthrift::ApplicationException> for ExecuteJsonExn {
fn from(exn: ::fbthrift::ApplicationException) -> Self {
ExecuteJsonExn::ApplicationException(exn)
}
}
impl ::fbthrift::GetTType for ExecuteJsonExn {
const TTYPE: ::fbthrift::TType = ::fbthrift::TType::Struct;
}
impl<P> ::fbthrift::Serialize<P> for ExecuteJsonExn
where
P: ::fbthrift::ProtocolWriter,
{
fn write(&self, p: &mut P) {
p.write_struct_begin("ExecuteJson");
match self {
ExecuteJsonExn::Success(inner) => {
p.write_field_begin(
"Success",
::fbthrift::TType::String,
0i16,
);
inner.write(p);
p.write_field_end();
}
ExecuteJsonExn::ApplicationException(_) => panic!(
"Bad union Alt field {} id {}",
"ApplicationException",
-2147483648i32,
),
}
p.write_field_stop();
p.write_struct_end();
}
}
impl<P> ::fbthrift::Deserialize<P> for ExecuteJsonExn
where
P: ::fbthrift::ProtocolReader,
{
fn read(p: &mut P) -> ::anyhow::Result<Self> {
static RETURNS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("Success", ::fbthrift::TType::String, 0),
];
let _ = p.read_struct_begin(|_| ())?;
let mut once = false;
let mut alt = ::std::option::Option::None;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), RETURNS)?;
match ((fty, fid as ::std::primitive::i32), once) {
((::fbthrift::TType::Stop, _), _) => {
p.read_field_end()?;
break;
}
((::fbthrift::TType::String, 0i32), false) => {
once = true;
alt = ::std::option::Option::Some(ExecuteJsonExn::Success(::fbthrift::Deserialize::read(p)?));
}
((ty, _id), false) => p.skip(ty)?,
((badty, badid), true) => return ::std::result::Result::Err(::std::convert::From::from(
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::ProtocolError,
format!(
"unwanted extra union {} field ty {:?} id {}",
"ExecuteJsonExn",
badty,
badid,
),
)
)),
}
p.read_field_end()?;
}
p.read_struct_end()?;
alt.ok_or_else(||
::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::MissingResult,
format!("Empty union {}", "ExecuteJsonExn"),
)
.into(),
)
}
}
}
}
pub mod client {
pub struct GraphServiceImpl<P, T> {
transport: T,
_phantom: ::std::marker::PhantomData<fn() -> P>,
}
impl<P, T> GraphServiceImpl<P, T> {
pub fn new(
transport: T,
) -> Self {
Self {
transport,
_phantom: ::std::marker::PhantomData,
}
}
pub fn transport(&self) -> &T {
&self.transport
}
}
pub trait GraphService: ::std::marker::Send {
fn authenticate(
&self,
arg_username: &::std::vec::Vec<::std::primitive::u8>,
arg_password: &::std::vec::Vec<::std::primitive::u8>,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> + ::std::marker::Send + 'static>>;
fn signout(
&self,
arg_sessionId: ::std::primitive::i64,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::graph_service::SignoutError>> + ::std::marker::Send + 'static>>;
fn execute(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> + ::std::marker::Send + 'static>>;
fn executeJson(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError>> + ::std::marker::Send + 'static>>;
}
impl<P, T> GraphService for GraphServiceImpl<P, T>
where
P: ::fbthrift::Protocol,
T: ::fbthrift::Transport,
P::Frame: ::fbthrift::Framing<DecBuf = ::fbthrift::FramingDecoded<T>>,
::fbthrift::ProtocolEncoded<P>: ::fbthrift::BufMutExt<Final = ::fbthrift::FramingEncodedFinal<T>>,
{ fn authenticate(
&self,
arg_username: &::std::vec::Vec<::std::primitive::u8>,
arg_password: &::std::vec::Vec<::std::primitive::u8>,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> + ::std::marker::Send + 'static>> {
use ::const_cstr::const_cstr;
use ::fbthrift::{ProtocolWriter as _};
use ::futures::future::{FutureExt as _, TryFutureExt as _};
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.authenticate";
}
let request = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"authenticate",
::fbthrift::MessageType::Call,
0,
|p| {
p.write_struct_begin("args");
p.write_field_begin("arg_username", ::fbthrift::TType::String, 1i16);
::fbthrift::Serialize::write(&arg_username, p);
p.write_field_end();
p.write_field_begin("arg_password", ::fbthrift::TType::String, 2i16);
::fbthrift::Serialize::write(&arg_password, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
},
));
self.transport()
.call(&SERVICE_NAME, &METHOD_NAME, request)
.map_err(::std::convert::From::from)
.and_then(|reply| ::futures::future::ready({
let de = P::deserializer(reply);
move |mut p: P::Deserializer| -> ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError> {
use ::fbthrift::{ProtocolReader as _};
let p = &mut p;
let (_, message_type, _) = p.read_message_begin(|_| ())?;
let result = match message_type {
::fbthrift::MessageType::Reply => {
let exn: crate::services::graph_service::AuthenticateExn = ::fbthrift::Deserialize::read(p)?;
match exn {
crate::services::graph_service::AuthenticateExn::Success(x) => ::std::result::Result::Ok(x),
crate::services::graph_service::AuthenticateExn::ApplicationException(ae) => {
::std::result::Result::Err(crate::errors::graph_service::AuthenticateError::ApplicationException(ae))
}
}
}
::fbthrift::MessageType::Exception => {
let ae: ::fbthrift::ApplicationException = ::fbthrift::Deserialize::read(p)?;
::std::result::Result::Err(crate::errors::graph_service::AuthenticateError::ApplicationException(ae))
}
::fbthrift::MessageType::Call | ::fbthrift::MessageType::Oneway | ::fbthrift::MessageType::InvalidMessageType => {
let err = ::anyhow::anyhow!("Unexpected message type {:?}", message_type);
::std::result::Result::Err(crate::errors::graph_service::AuthenticateError::ThriftError(err))
}
};
p.read_message_end()?;
result
}(de)
}))
.boxed()
}
fn signout(
&self,
arg_sessionId: ::std::primitive::i64,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::graph_service::SignoutError>> + ::std::marker::Send + 'static>> {
use ::const_cstr::const_cstr;
use ::fbthrift::{ProtocolWriter as _};
use ::futures::future::{FutureExt as _, TryFutureExt as _};
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.signout";
}
let request = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"signout",
::fbthrift::MessageType::Call,
0,
|p| {
p.write_struct_begin("args");
p.write_field_begin("arg_sessionId", ::fbthrift::TType::I64, 1i16);
::fbthrift::Serialize::write(&arg_sessionId, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
},
));
self.transport()
.call(&SERVICE_NAME, &METHOD_NAME, request)
.map_err(::std::convert::From::from)
.and_then(|reply| ::futures::future::ready({
let de = P::deserializer(reply);
move |mut p: P::Deserializer| -> ::std::result::Result<(), crate::errors::graph_service::SignoutError> {
use ::fbthrift::{ProtocolReader as _};
let p = &mut p;
let (_, message_type, _) = p.read_message_begin(|_| ())?;
let result = match message_type {
::fbthrift::MessageType::Reply => {
let exn: crate::services::graph_service::SignoutExn = ::fbthrift::Deserialize::read(p)?;
match exn {
crate::services::graph_service::SignoutExn::Success(x) => ::std::result::Result::Ok(x),
crate::services::graph_service::SignoutExn::ApplicationException(ae) => {
::std::result::Result::Err(crate::errors::graph_service::SignoutError::ApplicationException(ae))
}
}
}
::fbthrift::MessageType::Exception => {
let ae: ::fbthrift::ApplicationException = ::fbthrift::Deserialize::read(p)?;
::std::result::Result::Err(crate::errors::graph_service::SignoutError::ApplicationException(ae))
}
::fbthrift::MessageType::Call | ::fbthrift::MessageType::Oneway | ::fbthrift::MessageType::InvalidMessageType => {
let err = ::anyhow::anyhow!("Unexpected message type {:?}", message_type);
::std::result::Result::Err(crate::errors::graph_service::SignoutError::ThriftError(err))
}
};
p.read_message_end()?;
result
}(de)
}))
.boxed()
}
fn execute(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> + ::std::marker::Send + 'static>> {
use ::const_cstr::const_cstr;
use ::fbthrift::{ProtocolWriter as _};
use ::futures::future::{FutureExt as _, TryFutureExt as _};
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.execute";
}
let request = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"execute",
::fbthrift::MessageType::Call,
0,
|p| {
p.write_struct_begin("args");
p.write_field_begin("arg_sessionId", ::fbthrift::TType::I64, 1i16);
::fbthrift::Serialize::write(&arg_sessionId, p);
p.write_field_end();
p.write_field_begin("arg_stmt", ::fbthrift::TType::String, 2i16);
::fbthrift::Serialize::write(&arg_stmt, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
},
));
self.transport()
.call(&SERVICE_NAME, &METHOD_NAME, request)
.map_err(::std::convert::From::from)
.and_then(|reply| ::futures::future::ready({
let de = P::deserializer(reply);
move |mut p: P::Deserializer| -> ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError> {
use ::fbthrift::{ProtocolReader as _};
let p = &mut p;
let (_, message_type, _) = p.read_message_begin(|_| ())?;
let result = match message_type {
::fbthrift::MessageType::Reply => {
let exn: crate::services::graph_service::ExecuteExn = ::fbthrift::Deserialize::read(p)?;
match exn {
crate::services::graph_service::ExecuteExn::Success(x) => ::std::result::Result::Ok(x),
crate::services::graph_service::ExecuteExn::ApplicationException(ae) => {
::std::result::Result::Err(crate::errors::graph_service::ExecuteError::ApplicationException(ae))
}
}
}
::fbthrift::MessageType::Exception => {
let ae: ::fbthrift::ApplicationException = ::fbthrift::Deserialize::read(p)?;
::std::result::Result::Err(crate::errors::graph_service::ExecuteError::ApplicationException(ae))
}
::fbthrift::MessageType::Call | ::fbthrift::MessageType::Oneway | ::fbthrift::MessageType::InvalidMessageType => {
let err = ::anyhow::anyhow!("Unexpected message type {:?}", message_type);
::std::result::Result::Err(crate::errors::graph_service::ExecuteError::ThriftError(err))
}
};
p.read_message_end()?;
result
}(de)
}))
.boxed()
}
fn executeJson(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError>> + ::std::marker::Send + 'static>> {
use ::const_cstr::const_cstr;
use ::fbthrift::{ProtocolWriter as _};
use ::futures::future::{FutureExt as _, TryFutureExt as _};
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.executeJson";
}
let request = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"executeJson",
::fbthrift::MessageType::Call,
0,
|p| {
p.write_struct_begin("args");
p.write_field_begin("arg_sessionId", ::fbthrift::TType::I64, 1i16);
::fbthrift::Serialize::write(&arg_sessionId, p);
p.write_field_end();
p.write_field_begin("arg_stmt", ::fbthrift::TType::String, 2i16);
::fbthrift::Serialize::write(&arg_stmt, p);
p.write_field_end();
p.write_field_stop();
p.write_struct_end();
},
));
self.transport()
.call(&SERVICE_NAME, &METHOD_NAME, request)
.map_err(::std::convert::From::from)
.and_then(|reply| ::futures::future::ready({
let de = P::deserializer(reply);
move |mut p: P::Deserializer| -> ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError> {
use ::fbthrift::{ProtocolReader as _};
let p = &mut p;
let (_, message_type, _) = p.read_message_begin(|_| ())?;
let result = match message_type {
::fbthrift::MessageType::Reply => {
let exn: crate::services::graph_service::ExecuteJsonExn = ::fbthrift::Deserialize::read(p)?;
match exn {
crate::services::graph_service::ExecuteJsonExn::Success(x) => ::std::result::Result::Ok(x),
crate::services::graph_service::ExecuteJsonExn::ApplicationException(ae) => {
::std::result::Result::Err(crate::errors::graph_service::ExecuteJsonError::ApplicationException(ae))
}
}
}
::fbthrift::MessageType::Exception => {
let ae: ::fbthrift::ApplicationException = ::fbthrift::Deserialize::read(p)?;
::std::result::Result::Err(crate::errors::graph_service::ExecuteJsonError::ApplicationException(ae))
}
::fbthrift::MessageType::Call | ::fbthrift::MessageType::Oneway | ::fbthrift::MessageType::InvalidMessageType => {
let err = ::anyhow::anyhow!("Unexpected message type {:?}", message_type);
::std::result::Result::Err(crate::errors::graph_service::ExecuteJsonError::ThriftError(err))
}
};
p.read_message_end()?;
result
}(de)
}))
.boxed()
}
}
impl<'a, T> GraphService for T
where
T: ::std::convert::AsRef<dyn GraphService + 'a>,
T: ::std::marker::Send,
{
fn authenticate(
&self,
arg_username: &::std::vec::Vec<::std::primitive::u8>,
arg_password: &::std::vec::Vec<::std::primitive::u8>,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> + ::std::marker::Send + 'static>> {
self.as_ref().authenticate(
arg_username,
arg_password,
)
}
fn signout(
&self,
arg_sessionId: ::std::primitive::i64,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::graph_service::SignoutError>> + ::std::marker::Send + 'static>> {
self.as_ref().signout(
arg_sessionId,
)
}
fn execute(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> + ::std::marker::Send + 'static>> {
self.as_ref().execute(
arg_sessionId,
arg_stmt,
)
}
fn executeJson(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError>> + ::std::marker::Send + 'static>> {
self.as_ref().executeJson(
arg_sessionId,
arg_stmt,
)
}
}
pub struct make_GraphService;
impl dyn GraphService {
pub fn new<P, T>(
protocol: P,
transport: T,
) -> ::std::sync::Arc<impl GraphService + ::std::marker::Send + 'static>
where
P: ::fbthrift::Protocol<Frame = T>,
T: ::fbthrift::Transport,
{
let _ = protocol;
::std::sync::Arc::new(GraphServiceImpl::<P, T>::new(transport))
}
}
impl ::fbthrift::ClientFactory for make_GraphService {
type Api = dyn GraphService + ::std::marker::Send + ::std::marker::Sync + 'static;
fn new<P, T>(protocol: P, transport: T) -> ::std::sync::Arc<Self::Api>
where
P: ::fbthrift::Protocol<Frame = T>,
T: ::fbthrift::Transport + ::std::marker::Sync,
{
GraphService::new(protocol, transport)
}
}
}
pub mod server {
#[::async_trait::async_trait]
pub trait GraphService: ::std::marker::Send + ::std::marker::Sync + 'static {
async fn authenticate(
&self,
_username: ::std::vec::Vec<::std::primitive::u8>,
_password: ::std::vec::Vec<::std::primitive::u8>,
) -> ::std::result::Result<crate::types::AuthResponse, crate::services::graph_service::AuthenticateExn> {
::std::result::Result::Err(crate::services::graph_service::AuthenticateExn::ApplicationException(
::fbthrift::ApplicationException::unimplemented_method(
"GraphService",
"authenticate",
),
))
}
async fn signout(
&self,
_sessionId: ::std::primitive::i64,
) -> ::std::result::Result<(), crate::services::graph_service::SignoutExn> {
::std::result::Result::Err(crate::services::graph_service::SignoutExn::ApplicationException(
::fbthrift::ApplicationException::unimplemented_method(
"GraphService",
"signout",
),
))
}
async fn execute(
&self,
_sessionId: ::std::primitive::i64,
_stmt: ::std::vec::Vec<::std::primitive::u8>,
) -> ::std::result::Result<crate::types::ExecutionResponse, crate::services::graph_service::ExecuteExn> {
::std::result::Result::Err(crate::services::graph_service::ExecuteExn::ApplicationException(
::fbthrift::ApplicationException::unimplemented_method(
"GraphService",
"execute",
),
))
}
async fn executeJson(
&self,
_sessionId: ::std::primitive::i64,
_stmt: ::std::vec::Vec<::std::primitive::u8>,
) -> ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::services::graph_service::ExecuteJsonExn> {
::std::result::Result::Err(crate::services::graph_service::ExecuteJsonExn::ApplicationException(
::fbthrift::ApplicationException::unimplemented_method(
"GraphService",
"executeJson",
),
))
}
}
#[derive(Clone, Debug)]
pub struct GraphServiceProcessor<P, H, R> {
service: H,
supa: ::fbthrift::NullServiceProcessor<P, R>,
_phantom: ::std::marker::PhantomData<(P, H, R)>,
}
impl<P, H, R> GraphServiceProcessor<P, H, R>
where
P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
P::Deserializer: ::std::marker::Send,
H: GraphService,
R: ::fbthrift::RequestContext<Name = ::const_cstr::ConstCStr> + ::std::marker::Sync,
<R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack + ::std::marker::Send + ::std::marker::Sync,
{
pub fn new(service: H) -> Self {
Self {
service,
supa: ::fbthrift::NullServiceProcessor::new(),
_phantom: ::std::marker::PhantomData,
}
}
pub fn into_inner(self) -> H {
self.service
}
async fn handle_authenticate<'a>(
&'a self,
p: &'a mut P::Deserializer,
req_ctxt: &R,
seqid: ::std::primitive::u32,
) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> {
use ::const_cstr::const_cstr;
use ::fbthrift::ProtocolReader as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.authenticate";
}
let mut ctx_stack = req_ctxt.get_context_stack(
&SERVICE_NAME,
&METHOD_NAME,
)?;
::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
static ARGS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("password", ::fbthrift::TType::String, 2),
::fbthrift::Field::new("username", ::fbthrift::TType::String, 1),
];
let mut field_username = ::std::option::Option::None;
let mut field_password = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::String, 1) => field_username = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 2) => field_password = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
let res = self.service.authenticate(
field_username.ok_or_else(|| {
::fbthrift::ApplicationException::missing_arg(
"authenticate",
"username",
)
})?,
field_password.ok_or_else(|| {
::fbthrift::ApplicationException::missing_arg(
"authenticate",
"password",
)
})?,
).await;
let res = match res {
::std::result::Result::Ok(res) => {
crate::services::graph_service::AuthenticateExn::Success(res)
}
::std::result::Result::Err(crate::services::graph_service::AuthenticateExn::ApplicationException(aexn)) => {
return ::std::result::Result::Err(aexn.into())
}
::std::result::Result::Err(crate::services::graph_service::AuthenticateExn::Success(_)) => {
panic!(
"{} attempted to return success via error",
"authenticate",
)
}
};
::fbthrift::ContextStack::pre_write(&mut ctx_stack)?;
let res = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"authenticate",
::fbthrift::MessageType::Reply,
seqid,
|p| ::fbthrift::Serialize::write(&res, p),
));
::fbthrift::ContextStack::post_write(&mut ctx_stack, 0)?;
::std::result::Result::Ok(res)
}
async fn handle_signout<'a>(
&'a self,
p: &'a mut P::Deserializer,
req_ctxt: &R,
seqid: ::std::primitive::u32,
) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> {
use ::const_cstr::const_cstr;
use ::fbthrift::ProtocolReader as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.signout";
}
let mut ctx_stack = req_ctxt.get_context_stack(
&SERVICE_NAME,
&METHOD_NAME,
)?;
::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
static ARGS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("sessionId", ::fbthrift::TType::I64, 1),
];
let mut field_sessionId = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I64, 1) => field_sessionId = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
let res = self.service.signout(
field_sessionId.ok_or_else(|| {
::fbthrift::ApplicationException::missing_arg(
"signout",
"sessionId",
)
})?,
).await;
let res = match res {
::std::result::Result::Ok(res) => {
crate::services::graph_service::SignoutExn::Success(res)
}
::std::result::Result::Err(crate::services::graph_service::SignoutExn::ApplicationException(aexn)) => {
return ::std::result::Result::Err(aexn.into())
}
::std::result::Result::Err(crate::services::graph_service::SignoutExn::Success(_)) => {
panic!(
"{} attempted to return success via error",
"signout",
)
}
};
::fbthrift::ContextStack::pre_write(&mut ctx_stack)?;
let res = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"signout",
::fbthrift::MessageType::Reply,
seqid,
|p| ::fbthrift::Serialize::write(&res, p),
));
::fbthrift::ContextStack::post_write(&mut ctx_stack, 0)?;
::std::result::Result::Ok(res)
}
async fn handle_execute<'a>(
&'a self,
p: &'a mut P::Deserializer,
req_ctxt: &R,
seqid: ::std::primitive::u32,
) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> {
use ::const_cstr::const_cstr;
use ::fbthrift::ProtocolReader as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.execute";
}
let mut ctx_stack = req_ctxt.get_context_stack(
&SERVICE_NAME,
&METHOD_NAME,
)?;
::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
static ARGS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("sessionId", ::fbthrift::TType::I64, 1),
::fbthrift::Field::new("stmt", ::fbthrift::TType::String, 2),
];
let mut field_sessionId = ::std::option::Option::None;
let mut field_stmt = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I64, 1) => field_sessionId = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 2) => field_stmt = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
let res = self.service.execute(
field_sessionId.ok_or_else(|| {
::fbthrift::ApplicationException::missing_arg(
"execute",
"sessionId",
)
})?,
field_stmt.ok_or_else(|| {
::fbthrift::ApplicationException::missing_arg(
"execute",
"stmt",
)
})?,
).await;
let res = match res {
::std::result::Result::Ok(res) => {
crate::services::graph_service::ExecuteExn::Success(res)
}
::std::result::Result::Err(crate::services::graph_service::ExecuteExn::ApplicationException(aexn)) => {
return ::std::result::Result::Err(aexn.into())
}
::std::result::Result::Err(crate::services::graph_service::ExecuteExn::Success(_)) => {
panic!(
"{} attempted to return success via error",
"execute",
)
}
};
::fbthrift::ContextStack::pre_write(&mut ctx_stack)?;
let res = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"execute",
::fbthrift::MessageType::Reply,
seqid,
|p| ::fbthrift::Serialize::write(&res, p),
));
::fbthrift::ContextStack::post_write(&mut ctx_stack, 0)?;
::std::result::Result::Ok(res)
}
async fn handle_executeJson<'a>(
&'a self,
p: &'a mut P::Deserializer,
req_ctxt: &R,
seqid: ::std::primitive::u32,
) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> {
use ::const_cstr::const_cstr;
use ::fbthrift::ProtocolReader as _;
const_cstr! {
SERVICE_NAME = "GraphService";
METHOD_NAME = "GraphService.executeJson";
}
let mut ctx_stack = req_ctxt.get_context_stack(
&SERVICE_NAME,
&METHOD_NAME,
)?;
::fbthrift::ContextStack::pre_read(&mut ctx_stack)?;
static ARGS: &[::fbthrift::Field] = &[
::fbthrift::Field::new("sessionId", ::fbthrift::TType::I64, 1),
::fbthrift::Field::new("stmt", ::fbthrift::TType::String, 2),
];
let mut field_sessionId = ::std::option::Option::None;
let mut field_stmt = ::std::option::Option::None;
let _ = p.read_struct_begin(|_| ())?;
loop {
let (_, fty, fid) = p.read_field_begin(|_| (), ARGS)?;
match (fty, fid as ::std::primitive::i32) {
(::fbthrift::TType::Stop, _) => break,
(::fbthrift::TType::I64, 1) => field_sessionId = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(::fbthrift::TType::String, 2) => field_stmt = ::std::option::Option::Some(::fbthrift::Deserialize::read(p)?),
(fty, _) => p.skip(fty)?,
}
p.read_field_end()?;
}
p.read_struct_end()?;
::fbthrift::ContextStack::post_read(&mut ctx_stack, 0)?;
let res = self.service.executeJson(
field_sessionId.ok_or_else(|| {
::fbthrift::ApplicationException::missing_arg(
"executeJson",
"sessionId",
)
})?,
field_stmt.ok_or_else(|| {
::fbthrift::ApplicationException::missing_arg(
"executeJson",
"stmt",
)
})?,
).await;
let res = match res {
::std::result::Result::Ok(res) => {
crate::services::graph_service::ExecuteJsonExn::Success(res)
}
::std::result::Result::Err(crate::services::graph_service::ExecuteJsonExn::ApplicationException(aexn)) => {
return ::std::result::Result::Err(aexn.into())
}
::std::result::Result::Err(crate::services::graph_service::ExecuteJsonExn::Success(_)) => {
panic!(
"{} attempted to return success via error",
"executeJson",
)
}
};
::fbthrift::ContextStack::pre_write(&mut ctx_stack)?;
let res = ::fbthrift::serialize!(P, |p| ::fbthrift::protocol::write_message(
p,
"executeJson",
::fbthrift::MessageType::Reply,
seqid,
|p| ::fbthrift::Serialize::write(&res, p),
));
::fbthrift::ContextStack::post_write(&mut ctx_stack, 0)?;
::std::result::Result::Ok(res)
}
}
#[::async_trait::async_trait]
impl<P, H, R> ::fbthrift::ServiceProcessor<P> for GraphServiceProcessor<P, H, R>
where
P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
P::Deserializer: ::std::marker::Send,
H: GraphService,
R: ::fbthrift::RequestContext<Name = ::const_cstr::ConstCStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
<R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack + ::std::marker::Send + ::std::marker::Sync + 'static
{
type RequestContext = R;
#[inline]
fn method_idx(&self, name: &[::std::primitive::u8]) -> ::std::result::Result<::std::primitive::usize, ::fbthrift::ApplicationException> {
match name {
b"authenticate" => ::std::result::Result::Ok(0usize),
b"signout" => ::std::result::Result::Ok(1usize),
b"execute" => ::std::result::Result::Ok(2usize),
b"executeJson" => ::std::result::Result::Ok(3usize),
_ => ::std::result::Result::Err(::fbthrift::ApplicationException::unknown_method()),
}
}
async fn handle_method(
&self,
idx: ::std::primitive::usize,
_p: &mut P::Deserializer,
_r: &R,
_seqid: ::std::primitive::u32,
) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> {
match idx {
0usize => self.handle_authenticate(_p, _r, _seqid).await,
1usize => self.handle_signout(_p, _r, _seqid).await,
2usize => self.handle_execute(_p, _r, _seqid).await,
3usize => self.handle_executeJson(_p, _r, _seqid).await,
bad => panic!(
"{}: unexpected method idx {}",
"GraphServiceProcessor",
bad
),
}
}
}
#[::async_trait::async_trait]
impl<P, H, R> ::fbthrift::ThriftService<P::Frame> for GraphServiceProcessor<P, H, R>
where
P: ::fbthrift::Protocol + ::std::marker::Send + ::std::marker::Sync + 'static,
P::Deserializer: ::std::marker::Send,
P::Frame: ::std::marker::Send + 'static,
H: GraphService,
R: ::fbthrift::RequestContext<Name = ::const_cstr::ConstCStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
<R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack + ::std::marker::Send + ::std::marker::Sync + 'static
{
type Handler = H;
type RequestContext = R;
async fn call(
&self,
req: ::fbthrift::ProtocolDecoded<P>,
req_ctxt: &R,
) -> ::anyhow::Result<::fbthrift::ProtocolEncodedFinal<P>> {
use ::fbthrift::{BufExt as _, ProtocolReader as _, ServiceProcessor as _};
let mut p = P::deserializer(req);
let (idx, mty, seqid) = p.read_message_begin(|name| self.method_idx(name))?;
if mty != ::fbthrift::MessageType::Call {
return ::std::result::Result::Err(::std::convert::From::from(::fbthrift::ApplicationException::new(
::fbthrift::ApplicationExceptionErrorCode::InvalidMessageType,
format!("message type {:?} not handled", mty)
)));
}
let idx = match idx {
::std::result::Result::Ok(idx) => idx,
::std::result::Result::Err(_) => {
let cur = P::into_buffer(p).reset();
return self.supa.call(cur, req_ctxt).await;
}
};
let res = self.handle_method(idx, &mut p, req_ctxt, seqid).await;
p.read_message_end()?;
match res {
::std::result::Result::Ok(bytes) => ::std::result::Result::Ok(bytes),
::std::result::Result::Err(err) => match err.downcast_ref::<::fbthrift::ProtocolError>() {
::std::option::Option::Some(::fbthrift::ProtocolError::ApplicationException(ae)) => {
let res = ::fbthrift::serialize!(P, |p| {
::fbthrift::protocol::write_message(
p,
"GraphServiceProcessor",
::fbthrift::MessageType::Exception,
seqid,
|p| ::fbthrift::Serialize::write(&ae, p),
)
});
::std::result::Result::Ok(res)
}
_ => ::std::result::Result::Err(err),
},
}
}
}
pub fn make_GraphService_server<F, H, R>(
proto: ::fbthrift::ProtocolID,
handler: H,
) -> ::std::result::Result<::std::boxed::Box<dyn ::fbthrift::ThriftService<F, Handler = H, RequestContext = R> + ::std::marker::Send + 'static>, ::fbthrift::ApplicationException>
where
F: ::fbthrift::Framing + ::std::marker::Send + ::std::marker::Sync + 'static,
H: GraphService,
R: ::fbthrift::RequestContext<Name = ::const_cstr::ConstCStr> + ::std::marker::Send + ::std::marker::Sync + 'static,
<R as ::fbthrift::RequestContext>::ContextStack: ::fbthrift::ContextStack + ::std::marker::Send + ::std::marker::Sync + 'static
{
match proto {
::fbthrift::ProtocolID::BinaryProtocol => {
::std::result::Result::Ok(::std::boxed::Box::new(GraphServiceProcessor::<::fbthrift::BinaryProtocol<F>, H, R>::new(handler)))
}
::fbthrift::ProtocolID::CompactProtocol => {
::std::result::Result::Ok(::std::boxed::Box::new(GraphServiceProcessor::<::fbthrift::CompactProtocol<F>, H, R>::new(handler)))
}
bad => ::std::result::Result::Err(::fbthrift::ApplicationException::invalid_protocol(bad)),
}
}
}
pub mod mock {
pub struct GraphService<'mock> {
pub authenticate: r#impl::graph_service::authenticate<'mock>,
pub signout: r#impl::graph_service::signout<'mock>,
pub execute: r#impl::graph_service::execute<'mock>,
pub executeJson: r#impl::graph_service::executeJson<'mock>,
_marker: ::std::marker::PhantomData<&'mock ()>,
}
impl dyn super::client::GraphService {
pub fn mock<'mock>() -> GraphService<'mock> {
GraphService {
authenticate: r#impl::graph_service::authenticate::unimplemented(),
signout: r#impl::graph_service::signout::unimplemented(),
execute: r#impl::graph_service::execute::unimplemented(),
executeJson: r#impl::graph_service::executeJson::unimplemented(),
_marker: ::std::marker::PhantomData,
}
}
}
#[::async_trait::async_trait]
impl<'mock> super::client::GraphService for GraphService<'mock> {
fn authenticate(
&self,
arg_username: &::std::vec::Vec<::std::primitive::u8>,
arg_password: &::std::vec::Vec<::std::primitive::u8>,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError>> + ::std::marker::Send + 'static>> {
let mut closure = self.authenticate.closure.lock().unwrap();
let closure: &mut dyn ::std::ops::FnMut(::std::vec::Vec<::std::primitive::u8>, ::std::vec::Vec<::std::primitive::u8>) -> _ = &mut **closure;
::std::boxed::Box::pin(::futures::future::ready(closure(arg_username.clone(), arg_password.clone())))
}
fn signout(
&self,
arg_sessionId: ::std::primitive::i64,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<(), crate::errors::graph_service::SignoutError>> + ::std::marker::Send + 'static>> {
let mut closure = self.signout.closure.lock().unwrap();
let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64) -> _ = &mut **closure;
::std::boxed::Box::pin(::futures::future::ready(closure(arg_sessionId.clone())))
}
fn execute(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError>> + ::std::marker::Send + 'static>> {
let mut closure = self.execute.closure.lock().unwrap();
let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> _ = &mut **closure;
::std::boxed::Box::pin(::futures::future::ready(closure(arg_sessionId.clone(), arg_stmt.clone())))
}
fn executeJson(
&self,
arg_sessionId: ::std::primitive::i64,
arg_stmt: &::std::vec::Vec<::std::primitive::u8>,
) -> ::std::pin::Pin<::std::boxed::Box<dyn ::std::future::Future<Output = ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError>> + ::std::marker::Send + 'static>> {
let mut closure = self.executeJson.closure.lock().unwrap();
let closure: &mut dyn ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> _ = &mut **closure;
::std::boxed::Box::pin(::futures::future::ready(closure(arg_sessionId.clone(), arg_stmt.clone())))
}
}
mod r#impl {
pub mod graph_service {
pub struct authenticate<'mock> {
pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
dyn ::std::ops::FnMut(::std::vec::Vec<::std::primitive::u8>, ::std::vec::Vec<::std::primitive::u8>) -> ::std::result::Result<
crate::types::AuthResponse,
crate::errors::graph_service::AuthenticateError,
> + ::std::marker::Send + ::std::marker::Sync + 'mock,
>>,
}
impl<'mock> authenticate<'mock> {
pub fn unimplemented() -> Self {
authenticate {
closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::vec::Vec<::std::primitive::u8>, _: ::std::vec::Vec<::std::primitive::u8>| panic!(
"{}::{} is not mocked",
"GraphService",
"authenticate",
))),
}
}
pub fn ret(&self, value: crate::types::AuthResponse) {
self.mock(move |_: ::std::vec::Vec<::std::primitive::u8>, _: ::std::vec::Vec<::std::primitive::u8>| value.clone());
}
pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::vec::Vec<::std::primitive::u8>, ::std::vec::Vec<::std::primitive::u8>) -> crate::types::AuthResponse + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |username, password| ::std::result::Result::Ok(mock(username, password)));
}
pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::vec::Vec<::std::primitive::u8>, ::std::vec::Vec<::std::primitive::u8>) -> ::std::result::Result<crate::types::AuthResponse, crate::errors::graph_service::AuthenticateError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |username, password| mock(username, password));
}
pub fn throw<E>(&self, exception: E)
where
E: ::std::convert::Into<crate::errors::graph_service::AuthenticateError>,
E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
{
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |_: ::std::vec::Vec<::std::primitive::u8>, _: ::std::vec::Vec<::std::primitive::u8>| ::std::result::Result::Err(exception.clone().into()));
}
}
pub struct signout<'mock> {
pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
dyn ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<
(),
crate::errors::graph_service::SignoutError,
> + ::std::marker::Send + ::std::marker::Sync + 'mock,
>>,
}
impl<'mock> signout<'mock> {
pub fn unimplemented() -> Self {
signout {
closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64| panic!(
"{}::{} is not mocked",
"GraphService",
"signout",
))),
}
}
pub fn ret(&self, value: ()) {
self.mock(move |_: ::std::primitive::i64| value.clone());
}
pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> () + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId| ::std::result::Result::Ok(mock(sessionId)));
}
pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64) -> ::std::result::Result<(), crate::errors::graph_service::SignoutError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId| mock(sessionId));
}
pub fn throw<E>(&self, exception: E)
where
E: ::std::convert::Into<crate::errors::graph_service::SignoutError>,
E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
{
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64| ::std::result::Result::Err(exception.clone().into()));
}
}
pub struct execute<'mock> {
pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
dyn ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> ::std::result::Result<
crate::types::ExecutionResponse,
crate::errors::graph_service::ExecuteError,
> + ::std::marker::Send + ::std::marker::Sync + 'mock,
>>,
}
impl<'mock> execute<'mock> {
pub fn unimplemented() -> Self {
execute {
closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64, _: ::std::vec::Vec<::std::primitive::u8>| panic!(
"{}::{} is not mocked",
"GraphService",
"execute",
))),
}
}
pub fn ret(&self, value: crate::types::ExecutionResponse) {
self.mock(move |_: ::std::primitive::i64, _: ::std::vec::Vec<::std::primitive::u8>| value.clone());
}
pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> crate::types::ExecutionResponse + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId, stmt| ::std::result::Result::Ok(mock(sessionId, stmt)));
}
pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> ::std::result::Result<crate::types::ExecutionResponse, crate::errors::graph_service::ExecuteError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId, stmt| mock(sessionId, stmt));
}
pub fn throw<E>(&self, exception: E)
where
E: ::std::convert::Into<crate::errors::graph_service::ExecuteError>,
E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
{
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64, _: ::std::vec::Vec<::std::primitive::u8>| ::std::result::Result::Err(exception.clone().into()));
}
}
pub struct executeJson<'mock> {
pub(crate) closure: ::std::sync::Mutex<::std::boxed::Box<
dyn ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> ::std::result::Result<
::std::vec::Vec<::std::primitive::u8>,
crate::errors::graph_service::ExecuteJsonError,
> + ::std::marker::Send + ::std::marker::Sync + 'mock,
>>,
}
impl<'mock> executeJson<'mock> {
pub fn unimplemented() -> Self {
executeJson {
closure: ::std::sync::Mutex::new(::std::boxed::Box::new(|_: ::std::primitive::i64, _: ::std::vec::Vec<::std::primitive::u8>| panic!(
"{}::{} is not mocked",
"GraphService",
"executeJson",
))),
}
}
pub fn ret(&self, value: ::std::vec::Vec<::std::primitive::u8>) {
self.mock(move |_: ::std::primitive::i64, _: ::std::vec::Vec<::std::primitive::u8>| value.clone());
}
pub fn mock(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> ::std::vec::Vec<::std::primitive::u8> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId, stmt| ::std::result::Result::Ok(mock(sessionId, stmt)));
}
pub fn mock_result(&self, mut mock: impl ::std::ops::FnMut(::std::primitive::i64, ::std::vec::Vec<::std::primitive::u8>) -> ::std::result::Result<::std::vec::Vec<::std::primitive::u8>, crate::errors::graph_service::ExecuteJsonError> + ::std::marker::Send + ::std::marker::Sync + 'mock) {
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |sessionId, stmt| mock(sessionId, stmt));
}
pub fn throw<E>(&self, exception: E)
where
E: ::std::convert::Into<crate::errors::graph_service::ExecuteJsonError>,
E: ::std::clone::Clone + ::std::marker::Send + ::std::marker::Sync + 'mock,
{
let mut closure = self.closure.lock().unwrap();
*closure = ::std::boxed::Box::new(move |_: ::std::primitive::i64, _: ::std::vec::Vec<::std::primitive::u8>| ::std::result::Result::Err(exception.clone().into()));
}
}
}
}
}
pub mod errors {
pub mod graph_service {
pub type AuthenticateError = ::fbthrift::NonthrowingFunctionError;
pub type SignoutError = ::fbthrift::NonthrowingFunctionError;
pub type ExecuteError = ::fbthrift::NonthrowingFunctionError;
pub type ExecuteJsonError = ::fbthrift::NonthrowingFunctionError;
}
}