// This file is @generated by prost-build. #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct UserSession { #[prost(string, tag = "1")] pub session_id: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub user_id: ::prost::alloc::string::String, #[prost(string, tag = "3")] pub workspace_id: ::prost::alloc::string::String, #[prost(string, optional, tag = "4")] pub ip_address: ::core::option::Option<::prost::alloc::string::String>, #[prost(string, optional, tag = "5")] pub user_agent: ::core::option::Option<::prost::alloc::string::String>, #[prost(message, optional, tag = "6")] pub connected_at: ::core::option::Option<::prost_types::Timestamp>, #[prost(message, optional, tag = "7")] pub last_heartbeat: ::core::option::Option<::prost_types::Timestamp>, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct SessionInfo { #[prost(string, tag = "1")] pub user_id: ::prost::alloc::string::String, #[prost(uint32, tag = "2")] pub session_count: u32, #[prost(string, repeated, tag = "3")] pub workspaces: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, #[prost(message, optional, tag = "4")] pub latest_session: ::core::option::Option, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct ListWorkspaceSessionsRequest { #[prost(string, tag = "1")] pub workspace_id: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListWorkspaceSessionsResponse { #[prost(message, repeated, tag = "1")] pub sessions: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct ListUserSessionsRequest { #[prost(string, tag = "1")] pub user_id: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct ListUserSessionsResponse { #[prost(message, repeated, tag = "1")] pub sessions: ::prost::alloc::vec::Vec, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct KickUserFromWorkspaceRequest { #[prost(string, tag = "1")] pub user_id: ::prost::alloc::string::String, #[prost(string, tag = "2")] pub workspace_id: ::prost::alloc::string::String, } #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] pub struct KickUserFromWorkspaceResponse { #[prost(uint32, tag = "1")] pub kicked_count: u32, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct KickUserRequest { #[prost(string, tag = "1")] pub user_id: ::prost::alloc::string::String, } #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] pub struct KickUserResponse { #[prost(uint32, tag = "1")] pub kicked_count: u32, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetUserStatusRequest { #[prost(string, tag = "1")] pub user_id: ::prost::alloc::string::String, } #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetUserStatusResponse { #[prost(enumeration = "OnlineStatus", tag = "1")] pub status: i32, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetUserInfoRequest { #[prost(string, tag = "1")] pub user_id: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetUserInfoResponse { #[prost(message, optional, tag = "1")] pub info: ::core::option::Option, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetWorkspaceOnlineUsersRequest { #[prost(string, tag = "1")] pub workspace_id: ::prost::alloc::string::String, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct GetWorkspaceOnlineUsersResponse { #[prost(string, repeated, tag = "1")] pub user_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>, } #[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] pub struct IsUserOnlineRequest { #[prost(string, tag = "1")] pub user_id: ::prost::alloc::string::String, } #[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)] pub struct IsUserOnlineResponse { #[prost(bool, tag = "1")] pub online: bool, } #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)] #[repr(i32)] pub enum OnlineStatus { Unspecified = 0, Online = 1, Idle = 2, Offline = 3, } impl OnlineStatus { /// String value of the enum field names used in the ProtoBuf definition. /// /// The values are not transformed in any way and thus are considered stable /// (if the ProtoBuf definition does not change) and safe for programmatic use. pub fn as_str_name(&self) -> &'static str { match self { Self::Unspecified => "ONLINE_STATUS_UNSPECIFIED", Self::Online => "ONLINE_STATUS_ONLINE", Self::Idle => "ONLINE_STATUS_IDLE", Self::Offline => "ONLINE_STATUS_OFFLINE", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "ONLINE_STATUS_UNSPECIFIED" => Some(Self::Unspecified), "ONLINE_STATUS_ONLINE" => Some(Self::Online), "ONLINE_STATUS_IDLE" => Some(Self::Idle), "ONLINE_STATUS_OFFLINE" => Some(Self::Offline), _ => None, } } } /// Generated client implementations. pub mod session_admin_client { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; use tonic::codegen::http::Uri; #[derive(Debug, Clone)] pub struct SessionAdminClient { inner: tonic::client::Grpc, } impl SessionAdminClient { /// Attempt to create a new client by connecting to a given endpoint. pub async fn connect(dst: D) -> Result where D: TryInto, D::Error: Into, { let conn = tonic::transport::Endpoint::new(dst)?.connect().await?; Ok(Self::new(conn)) } } impl SessionAdminClient where T: tonic::client::GrpcService, T::Error: Into, T::ResponseBody: Body + std::marker::Send + 'static, ::Error: Into + std::marker::Send, { pub fn new(inner: T) -> Self { let inner = tonic::client::Grpc::new(inner); Self { inner } } pub fn with_origin(inner: T, origin: Uri) -> Self { let inner = tonic::client::Grpc::with_origin(inner, origin); Self { inner } } pub fn with_interceptor( inner: T, interceptor: F, ) -> SessionAdminClient> where F: tonic::service::Interceptor, T::ResponseBody: Default, T: tonic::codegen::Service< http::Request, Response = http::Response< >::ResponseBody, >, >, , >>::Error: Into + std::marker::Send + std::marker::Sync, { SessionAdminClient::new(InterceptedService::new(inner, interceptor)) } /// Compress requests with the given encoding. /// /// This requires the server to support it otherwise it might respond with an /// error. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.send_compressed(encoding); self } /// Enable decompressing responses. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.inner = self.inner.accept_compressed(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_decoding_message_size(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.inner = self.inner.max_encoding_message_size(limit); self } pub async fn list_workspace_sessions( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/admin.SessionAdmin/ListWorkspaceSessions", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("admin.SessionAdmin", "ListWorkspaceSessions")); self.inner.unary(req, path, codec).await } pub async fn list_user_sessions( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/admin.SessionAdmin/ListUserSessions", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("admin.SessionAdmin", "ListUserSessions")); self.inner.unary(req, path, codec).await } pub async fn kick_user_from_workspace( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/admin.SessionAdmin/KickUserFromWorkspace", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("admin.SessionAdmin", "KickUserFromWorkspace")); self.inner.unary(req, path, codec).await } pub async fn kick_user( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/admin.SessionAdmin/KickUser", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("admin.SessionAdmin", "KickUser")); self.inner.unary(req, path, codec).await } pub async fn get_user_status( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/admin.SessionAdmin/GetUserStatus", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("admin.SessionAdmin", "GetUserStatus")); self.inner.unary(req, path, codec).await } pub async fn get_user_info( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/admin.SessionAdmin/GetUserInfo", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("admin.SessionAdmin", "GetUserInfo")); self.inner.unary(req, path, codec).await } pub async fn get_workspace_online_users( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/admin.SessionAdmin/GetWorkspaceOnlineUsers", ); let mut req = request.into_request(); req.extensions_mut() .insert( GrpcMethod::new("admin.SessionAdmin", "GetWorkspaceOnlineUsers"), ); self.inner.unary(req, path, codec).await } pub async fn is_user_online( &mut self, request: impl tonic::IntoRequest, ) -> std::result::Result< tonic::Response, tonic::Status, > { self.inner .ready() .await .map_err(|e| { tonic::Status::unknown( format!("Service was not ready: {}", e.into()), ) })?; let codec = tonic_prost::ProstCodec::default(); let path = http::uri::PathAndQuery::from_static( "/admin.SessionAdmin/IsUserOnline", ); let mut req = request.into_request(); req.extensions_mut() .insert(GrpcMethod::new("admin.SessionAdmin", "IsUserOnline")); self.inner.unary(req, path, codec).await } } } /// Generated server implementations. pub mod session_admin_server { #![allow( unused_variables, dead_code, missing_docs, clippy::wildcard_imports, clippy::let_unit_value, )] use tonic::codegen::*; /// Generated trait containing gRPC methods that should be implemented for use with SessionAdminServer. #[async_trait] pub trait SessionAdmin: std::marker::Send + std::marker::Sync + 'static { async fn list_workspace_sessions( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn list_user_sessions( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn kick_user_from_workspace( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn kick_user( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn get_user_status( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn get_user_info( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn get_workspace_online_users( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; async fn is_user_online( &self, request: tonic::Request, ) -> std::result::Result< tonic::Response, tonic::Status, >; } #[derive(Debug)] pub struct SessionAdminServer { inner: Arc, accept_compression_encodings: EnabledCompressionEncodings, send_compression_encodings: EnabledCompressionEncodings, max_decoding_message_size: Option, max_encoding_message_size: Option, } impl SessionAdminServer { pub fn new(inner: T) -> Self { Self::from_arc(Arc::new(inner)) } pub fn from_arc(inner: Arc) -> Self { Self { inner, accept_compression_encodings: Default::default(), send_compression_encodings: Default::default(), max_decoding_message_size: None, max_encoding_message_size: None, } } pub fn with_interceptor( inner: T, interceptor: F, ) -> InterceptedService where F: tonic::service::Interceptor, { InterceptedService::new(Self::new(inner), interceptor) } /// Enable decompressing requests with the given encoding. #[must_use] pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self { self.accept_compression_encodings.enable(encoding); self } /// Compress responses with the given encoding, if the client supports it. #[must_use] pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self { self.send_compression_encodings.enable(encoding); self } /// Limits the maximum size of a decoded message. /// /// Default: `4MB` #[must_use] pub fn max_decoding_message_size(mut self, limit: usize) -> Self { self.max_decoding_message_size = Some(limit); self } /// Limits the maximum size of an encoded message. /// /// Default: `usize::MAX` #[must_use] pub fn max_encoding_message_size(mut self, limit: usize) -> Self { self.max_encoding_message_size = Some(limit); self } } impl tonic::codegen::Service> for SessionAdminServer where T: SessionAdmin, B: Body + std::marker::Send + 'static, B::Error: Into + std::marker::Send + 'static, { type Response = http::Response; type Error = std::convert::Infallible; type Future = BoxFuture; fn poll_ready( &mut self, _cx: &mut Context<'_>, ) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, req: http::Request) -> Self::Future { match req.uri().path() { "/admin.SessionAdmin/ListWorkspaceSessions" => { #[allow(non_camel_case_types)] struct ListWorkspaceSessionsSvc(pub Arc); impl< T: SessionAdmin, > tonic::server::UnaryService for ListWorkspaceSessionsSvc { type Response = super::ListWorkspaceSessionsResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::list_workspace_sessions( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ListWorkspaceSessionsSvc(inner); let codec = tonic_prost::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/admin.SessionAdmin/ListUserSessions" => { #[allow(non_camel_case_types)] struct ListUserSessionsSvc(pub Arc); impl< T: SessionAdmin, > tonic::server::UnaryService for ListUserSessionsSvc { type Response = super::ListUserSessionsResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::list_user_sessions(&inner, request) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = ListUserSessionsSvc(inner); let codec = tonic_prost::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/admin.SessionAdmin/KickUserFromWorkspace" => { #[allow(non_camel_case_types)] struct KickUserFromWorkspaceSvc(pub Arc); impl< T: SessionAdmin, > tonic::server::UnaryService for KickUserFromWorkspaceSvc { type Response = super::KickUserFromWorkspaceResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::kick_user_from_workspace( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = KickUserFromWorkspaceSvc(inner); let codec = tonic_prost::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/admin.SessionAdmin/KickUser" => { #[allow(non_camel_case_types)] struct KickUserSvc(pub Arc); impl< T: SessionAdmin, > tonic::server::UnaryService for KickUserSvc { type Response = super::KickUserResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::kick_user(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = KickUserSvc(inner); let codec = tonic_prost::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/admin.SessionAdmin/GetUserStatus" => { #[allow(non_camel_case_types)] struct GetUserStatusSvc(pub Arc); impl< T: SessionAdmin, > tonic::server::UnaryService for GetUserStatusSvc { type Response = super::GetUserStatusResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_user_status(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetUserStatusSvc(inner); let codec = tonic_prost::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/admin.SessionAdmin/GetUserInfo" => { #[allow(non_camel_case_types)] struct GetUserInfoSvc(pub Arc); impl< T: SessionAdmin, > tonic::server::UnaryService for GetUserInfoSvc { type Response = super::GetUserInfoResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_user_info(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetUserInfoSvc(inner); let codec = tonic_prost::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/admin.SessionAdmin/GetWorkspaceOnlineUsers" => { #[allow(non_camel_case_types)] struct GetWorkspaceOnlineUsersSvc(pub Arc); impl< T: SessionAdmin, > tonic::server::UnaryService for GetWorkspaceOnlineUsersSvc { type Response = super::GetWorkspaceOnlineUsersResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request< super::GetWorkspaceOnlineUsersRequest, >, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::get_workspace_online_users( &inner, request, ) .await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = GetWorkspaceOnlineUsersSvc(inner); let codec = tonic_prost::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } "/admin.SessionAdmin/IsUserOnline" => { #[allow(non_camel_case_types)] struct IsUserOnlineSvc(pub Arc); impl< T: SessionAdmin, > tonic::server::UnaryService for IsUserOnlineSvc { type Response = super::IsUserOnlineResponse; type Future = BoxFuture< tonic::Response, tonic::Status, >; fn call( &mut self, request: tonic::Request, ) -> Self::Future { let inner = Arc::clone(&self.0); let fut = async move { ::is_user_online(&inner, request).await }; Box::pin(fut) } } let accept_compression_encodings = self.accept_compression_encodings; let send_compression_encodings = self.send_compression_encodings; let max_decoding_message_size = self.max_decoding_message_size; let max_encoding_message_size = self.max_encoding_message_size; let inner = self.inner.clone(); let fut = async move { let method = IsUserOnlineSvc(inner); let codec = tonic_prost::ProstCodec::default(); let mut grpc = tonic::server::Grpc::new(codec) .apply_compression_config( accept_compression_encodings, send_compression_encodings, ) .apply_max_message_size_config( max_decoding_message_size, max_encoding_message_size, ); let res = grpc.unary(method, req).await; Ok(res) }; Box::pin(fut) } _ => { Box::pin(async move { let mut response = http::Response::new( tonic::body::Body::default(), ); let headers = response.headers_mut(); headers .insert( tonic::Status::GRPC_STATUS, (tonic::Code::Unimplemented as i32).into(), ); headers .insert( http::header::CONTENT_TYPE, tonic::metadata::GRPC_CONTENT_TYPE, ); Ok(response) }) } } } } impl Clone for SessionAdminServer { fn clone(&self) -> Self { let inner = self.inner.clone(); Self { inner, accept_compression_encodings: self.accept_compression_encodings, send_compression_encodings: self.send_compression_encodings, max_decoding_message_size: self.max_decoding_message_size, max_encoding_message_size: self.max_encoding_message_size, } } } /// Generated gRPC service name pub const SERVICE_NAME: &str = "admin.SessionAdmin"; impl tonic::server::NamedService for SessionAdminServer { const NAME: &'static str = SERVICE_NAME; } }