gitdataai/libs/rpc/admin/generated/admin.rs
ZhenYi 962bf0312d feat(observability): Phase 6 OTLP tracing + Prometheus metrics endpoint
OTLP tracing:
- libs/observability/otlp.rs: SdkTracerProvider via HTTP/proto OTLP exporter
- libs/observability/tracing_middleware.rs: Actix-web span with trace_id propagation
- libs/observability/tracing_fmt.rs: JSON fmt + registry.try_init for layered init
- libs/rpc: gRPC method spans via info_span
- libs/agent, libs/room, libs/service, libs/api: structured tracing throughout

Prometheus metrics:
- libs/observability/prometheus_exporter.rs: /metrics HTTP handler + metrics crate
- libs/observability/metrics_middleware.rs: HttpMetrics middleware + AtomicU64
- libs/observability/redis_metrics.rs: Redis counter poller via RedisMetrics
- libs/room/metrics.rs: RoomMetrics (connections, messages, presence counters)

Config env vars: APP_OTEL_ENABLED, APP_OTEL_ENDPOINT, APP_OTEL_SERVICE_NAME
2026-04-22 10:27:54 +08:00

1188 lines
51 KiB
Rust

// 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<UserSession>,
}
#[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<UserSession>,
}
#[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<UserSession>,
}
#[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<SessionInfo>,
}
#[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, PartialEq, Eq, Hash, ::prost::Message)]
pub struct GetMetricsRequest {
/// filter by instance_id substring
#[prost(string, tag = "1")]
pub instance_filter: ::prost::alloc::string::String,
/// max snapshots per instance (default 100)
#[prost(uint32, tag = "2")]
pub limit: u32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetMetricsResponse {
#[prost(message, repeated, tag = "1")]
pub instances: ::prost::alloc::vec::Vec<InstanceMetrics>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InstanceMetrics {
#[prost(string, tag = "1")]
pub instance_id: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub timestamp_secs: i64,
/// HTTP metrics, key = metric name, value = JSON value
#[prost(map = "string, string", tag = "3")]
pub http: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
/// Room/room metrics
#[prost(map = "string, string", tag = "4")]
pub room: ::std::collections::HashMap<
::prost::alloc::string::String,
::prost::alloc::string::String,
>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExportMetricsCsvRequest {
#[prost(string, tag = "1")]
pub instance_filter: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ExportMetricsCsvResponse {
#[prost(string, tag = "1")]
pub csv: ::prost::alloc::string::String,
}
#[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<Self> {
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<T> {
inner: tonic::client::Grpc<T>,
}
impl SessionAdminClient<tonic::transport::Channel> {
/// Attempt to create a new client by connecting to a given endpoint.
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> SessionAdminClient<T>
where
T: tonic::client::GrpcService<tonic::body::Body>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + 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<F>(
inner: T,
interceptor: F,
) -> SessionAdminClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::Body>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::Body>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::Body>,
>>::Error: Into<StdError> + 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<super::ListWorkspaceSessionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListWorkspaceSessionsResponse>,
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<super::ListUserSessionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListUserSessionsResponse>,
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<super::KickUserFromWorkspaceRequest>,
) -> std::result::Result<
tonic::Response<super::KickUserFromWorkspaceResponse>,
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<super::KickUserRequest>,
) -> std::result::Result<
tonic::Response<super::KickUserResponse>,
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<super::GetUserStatusRequest>,
) -> std::result::Result<
tonic::Response<super::GetUserStatusResponse>,
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<super::GetUserInfoRequest>,
) -> std::result::Result<
tonic::Response<super::GetUserInfoResponse>,
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<super::GetWorkspaceOnlineUsersRequest>,
) -> std::result::Result<
tonic::Response<super::GetWorkspaceOnlineUsersResponse>,
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<super::IsUserOnlineRequest>,
) -> std::result::Result<
tonic::Response<super::IsUserOnlineResponse>,
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
}
pub async fn get_metrics(
&mut self,
request: impl tonic::IntoRequest<super::GetMetricsRequest>,
) -> std::result::Result<
tonic::Response<super::GetMetricsResponse>,
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/GetMetrics",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("admin.SessionAdmin", "GetMetrics"));
self.inner.unary(req, path, codec).await
}
pub async fn export_metrics_csv(
&mut self,
request: impl tonic::IntoRequest<super::ExportMetricsCsvRequest>,
) -> std::result::Result<
tonic::Response<super::ExportMetricsCsvResponse>,
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/ExportMetricsCsv",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("admin.SessionAdmin", "ExportMetricsCsv"));
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<super::ListWorkspaceSessionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListWorkspaceSessionsResponse>,
tonic::Status,
>;
async fn list_user_sessions(
&self,
request: tonic::Request<super::ListUserSessionsRequest>,
) -> std::result::Result<
tonic::Response<super::ListUserSessionsResponse>,
tonic::Status,
>;
async fn kick_user_from_workspace(
&self,
request: tonic::Request<super::KickUserFromWorkspaceRequest>,
) -> std::result::Result<
tonic::Response<super::KickUserFromWorkspaceResponse>,
tonic::Status,
>;
async fn kick_user(
&self,
request: tonic::Request<super::KickUserRequest>,
) -> std::result::Result<
tonic::Response<super::KickUserResponse>,
tonic::Status,
>;
async fn get_user_status(
&self,
request: tonic::Request<super::GetUserStatusRequest>,
) -> std::result::Result<
tonic::Response<super::GetUserStatusResponse>,
tonic::Status,
>;
async fn get_user_info(
&self,
request: tonic::Request<super::GetUserInfoRequest>,
) -> std::result::Result<
tonic::Response<super::GetUserInfoResponse>,
tonic::Status,
>;
async fn get_workspace_online_users(
&self,
request: tonic::Request<super::GetWorkspaceOnlineUsersRequest>,
) -> std::result::Result<
tonic::Response<super::GetWorkspaceOnlineUsersResponse>,
tonic::Status,
>;
async fn is_user_online(
&self,
request: tonic::Request<super::IsUserOnlineRequest>,
) -> std::result::Result<
tonic::Response<super::IsUserOnlineResponse>,
tonic::Status,
>;
async fn get_metrics(
&self,
request: tonic::Request<super::GetMetricsRequest>,
) -> std::result::Result<
tonic::Response<super::GetMetricsResponse>,
tonic::Status,
>;
async fn export_metrics_csv(
&self,
request: tonic::Request<super::ExportMetricsCsvRequest>,
) -> std::result::Result<
tonic::Response<super::ExportMetricsCsvResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct SessionAdminServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
impl<T> SessionAdminServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> 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<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
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<T, B> tonic::codegen::Service<http::Request<B>> for SessionAdminServer<T>
where
T: SessionAdmin,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::Body>;
type Error = std::convert::Infallible;
type Future = BoxFuture<Self::Response, Self::Error>;
fn poll_ready(
&mut self,
_cx: &mut Context<'_>,
) -> Poll<std::result::Result<(), Self::Error>> {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
match req.uri().path() {
"/admin.SessionAdmin/ListWorkspaceSessions" => {
#[allow(non_camel_case_types)]
struct ListWorkspaceSessionsSvc<T: SessionAdmin>(pub Arc<T>);
impl<
T: SessionAdmin,
> tonic::server::UnaryService<super::ListWorkspaceSessionsRequest>
for ListWorkspaceSessionsSvc<T> {
type Response = super::ListWorkspaceSessionsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListWorkspaceSessionsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SessionAdmin>::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<T: SessionAdmin>(pub Arc<T>);
impl<
T: SessionAdmin,
> tonic::server::UnaryService<super::ListUserSessionsRequest>
for ListUserSessionsSvc<T> {
type Response = super::ListUserSessionsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ListUserSessionsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SessionAdmin>::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<T: SessionAdmin>(pub Arc<T>);
impl<
T: SessionAdmin,
> tonic::server::UnaryService<super::KickUserFromWorkspaceRequest>
for KickUserFromWorkspaceSvc<T> {
type Response = super::KickUserFromWorkspaceResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::KickUserFromWorkspaceRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SessionAdmin>::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<T: SessionAdmin>(pub Arc<T>);
impl<
T: SessionAdmin,
> tonic::server::UnaryService<super::KickUserRequest>
for KickUserSvc<T> {
type Response = super::KickUserResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::KickUserRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SessionAdmin>::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<T: SessionAdmin>(pub Arc<T>);
impl<
T: SessionAdmin,
> tonic::server::UnaryService<super::GetUserStatusRequest>
for GetUserStatusSvc<T> {
type Response = super::GetUserStatusResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetUserStatusRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SessionAdmin>::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<T: SessionAdmin>(pub Arc<T>);
impl<
T: SessionAdmin,
> tonic::server::UnaryService<super::GetUserInfoRequest>
for GetUserInfoSvc<T> {
type Response = super::GetUserInfoResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetUserInfoRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SessionAdmin>::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<T: SessionAdmin>(pub Arc<T>);
impl<
T: SessionAdmin,
> tonic::server::UnaryService<super::GetWorkspaceOnlineUsersRequest>
for GetWorkspaceOnlineUsersSvc<T> {
type Response = super::GetWorkspaceOnlineUsersResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::GetWorkspaceOnlineUsersRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SessionAdmin>::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<T: SessionAdmin>(pub Arc<T>);
impl<
T: SessionAdmin,
> tonic::server::UnaryService<super::IsUserOnlineRequest>
for IsUserOnlineSvc<T> {
type Response = super::IsUserOnlineResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::IsUserOnlineRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SessionAdmin>::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)
}
"/admin.SessionAdmin/GetMetrics" => {
#[allow(non_camel_case_types)]
struct GetMetricsSvc<T: SessionAdmin>(pub Arc<T>);
impl<
T: SessionAdmin,
> tonic::server::UnaryService<super::GetMetricsRequest>
for GetMetricsSvc<T> {
type Response = super::GetMetricsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::GetMetricsRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SessionAdmin>::get_metrics(&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 = GetMetricsSvc(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/ExportMetricsCsv" => {
#[allow(non_camel_case_types)]
struct ExportMetricsCsvSvc<T: SessionAdmin>(pub Arc<T>);
impl<
T: SessionAdmin,
> tonic::server::UnaryService<super::ExportMetricsCsvRequest>
for ExportMetricsCsvSvc<T> {
type Response = super::ExportMetricsCsvResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ExportMetricsCsvRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as SessionAdmin>::export_metrics_csv(&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 = ExportMetricsCsvSvc(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<T> Clone for SessionAdminServer<T> {
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<T> tonic::server::NamedService for SessionAdminServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}