#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct AvoidBlockDeadLockRequest {
#[prost(int64, optional, tag = "1")]
pub block_id: ::core::option::Option<i64>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct AvoidBlockDeadLockResponse {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CheckRequest {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CheckResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Chunk {
#[prost(bytes = "vec", optional, tag = "1")]
pub data: ::core::option::Option<::prost::alloc::vec::Vec<u8>>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadRequest {
#[prost(int64, optional, tag = "1")]
pub block_id: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "2")]
pub offset: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "3")]
pub length: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "4")]
pub chunk_size: ::core::option::Option<i64>,
#[prost(message, optional, tag = "5")]
pub open_ufs_block_options: ::core::option::Option<
super::super::proto::dataserver::OpenUfsBlockOptions,
>,
#[prost(int64, optional, tag = "6")]
pub offset_received: ::core::option::Option<i64>,
#[prost(bool, optional, tag = "7")]
pub position_short: ::core::option::Option<bool>,
#[prost(string, optional, tag = "8")]
pub request_id: ::core::option::Option<::prost::alloc::string::String>,
#[prost(message, optional, tag = "9")]
pub capability: ::core::option::Option<super::super::proto::security::Capability>,
#[prost(int64, optional, tag = "10")]
pub block_size: ::core::option::Option<i64>,
#[prost(int32, optional, tag = "11")]
pub prefetch_window: ::core::option::Option<i32>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadResponse {
#[prost(message, optional, tag = "1")]
pub chunk: ::core::option::Option<Chunk>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WriteRequestCommand {
#[prost(enumeration = "RequestType", optional, tag = "1")]
pub r#type: ::core::option::Option<i32>,
#[prost(int64, optional, tag = "2")]
pub id: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "3")]
pub offset: ::core::option::Option<i64>,
#[prost(bool, optional, tag = "4")]
pub flush: ::core::option::Option<bool>,
#[prost(message, optional, tag = "5")]
pub create_ufs_file_options: ::core::option::Option<
super::super::proto::dataserver::CreateUfsFileOptions,
>,
#[prost(int64, optional, tag = "6")]
pub space_to_reserve: ::core::option::Option<i64>,
#[prost(message, optional, tag = "7")]
pub capability: ::core::option::Option<super::super::proto::security::Capability>,
#[prost(string, optional, tag = "8")]
pub medium_type: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WriteRequest {
#[prost(oneof = "write_request::Value", tags = "1, 2")]
pub value: ::core::option::Option<write_request::Value>,
}
pub mod write_request {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Value {
#[prost(message, tag = "1")]
Command(super::WriteRequestCommand),
#[prost(message, tag = "2")]
Chunk(super::Chunk),
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct WriteResponse {
#[prost(int64, optional, tag = "1")]
pub offset: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AsyncCacheRequest {
#[prost(int64, optional, tag = "1")]
pub block_id: ::core::option::Option<i64>,
#[prost(string, optional, tag = "2")]
pub source_host: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int32, optional, tag = "3")]
pub source_port: ::core::option::Option<i32>,
#[prost(message, optional, tag = "4")]
pub open_ufs_block_options: ::core::option::Option<
super::super::proto::dataserver::OpenUfsBlockOptions,
>,
#[prost(int64, optional, tag = "5")]
pub length: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "6")]
pub offset: ::core::option::Option<i64>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct AsyncCacheResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct SyncCacheRequest {
#[prost(int64, optional, tag = "1")]
pub block_id: ::core::option::Option<i64>,
#[prost(string, optional, tag = "2")]
pub source_host: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int32, optional, tag = "3")]
pub source_port: ::core::option::Option<i32>,
#[prost(message, optional, tag = "4")]
pub open_ufs_block_options: ::core::option::Option<
super::super::proto::dataserver::OpenUfsBlockOptions,
>,
#[prost(int64, optional, tag = "5")]
pub length: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "6")]
pub offset: ::core::option::Option<i64>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SyncCacheResponse {
#[prost(bool, optional, tag = "1")]
pub result: ::core::option::Option<bool>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OpenLocalBlockRequest {
#[prost(int64, optional, tag = "1")]
pub block_id: ::core::option::Option<i64>,
#[prost(message, optional, tag = "2")]
pub capability: ::core::option::Option<super::super::proto::security::Capability>,
#[prost(int64, optional, tag = "3")]
pub block_size: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct OpenLocalBlockResponse {
#[prost(string, optional, tag = "1")]
pub path: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int64, optional, tag = "2")]
pub block_size: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateLocalBlockRequest {
#[prost(int64, optional, tag = "1")]
pub block_id: ::core::option::Option<i64>,
#[prost(int32, optional, tag = "2")]
pub tier: ::core::option::Option<i32>,
#[prost(int64, optional, tag = "3")]
pub space_to_reserve: ::core::option::Option<i64>,
#[prost(bool, optional, tag = "4")]
pub only_reserve_space: ::core::option::Option<bool>,
#[prost(message, optional, tag = "5")]
pub capability: ::core::option::Option<super::super::proto::security::Capability>,
#[prost(string, optional, tag = "6")]
pub medium_type: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CreateLocalBlockResponse {
#[prost(string, optional, tag = "1")]
pub path: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RemoveBlockRequest {
#[prost(int64, optional, tag = "1")]
pub block_id: ::core::option::Option<i64>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct RemoveBlockResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MoveBlockRequest {
#[prost(int64, optional, tag = "1")]
pub block_id: ::core::option::Option<i64>,
#[prost(string, optional, tag = "2")]
pub medium_type: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct MoveBlockResponse {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ClearMetricsRequest {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ClearMetricsResponse {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FreeWorkerRequest {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct FreeWorkerResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckBlocksRequest {
#[prost(int64, repeated, packed = "false", tag = "1")]
pub block_ids: ::prost::alloc::vec::Vec<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckBlocksResponse {
#[prost(map = "int64, bool", tag = "1")]
pub block_exists: ::std::collections::HashMap<i64, bool>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Block {
#[prost(int64, required, tag = "1")]
pub block_id: i64,
#[prost(int64, required, tag = "2")]
pub length: i64,
#[prost(string, optional, tag = "3")]
pub ufs_path: ::core::option::Option<::prost::alloc::string::String>,
#[prost(int64, optional, tag = "4")]
pub offset_in_file: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "5")]
pub mount_id: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BlockStatus {
#[prost(message, required, tag = "1")]
pub block: Block,
#[prost(int32, required, tag = "2")]
pub code: i32,
#[prost(string, optional, tag = "3")]
pub message: ::core::option::Option<::prost::alloc::string::String>,
#[prost(bool, optional, tag = "4")]
pub retryable: ::core::option::Option<bool>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UfsReadOptions {
#[prost(string, required, tag = "1")]
pub tag: ::prost::alloc::string::String,
#[prost(bool, required, tag = "2")]
pub position_short: bool,
#[prost(int64, optional, tag = "3")]
pub bandwidth: ::core::option::Option<i64>,
#[prost(string, optional, tag = "4")]
pub user: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum RequestType {
GoosefsBlock = 0,
UfsFile = 1,
UfsFallbackBlock = 2,
}
impl RequestType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::GoosefsBlock => "GOOSEFS_BLOCK",
Self::UfsFile => "UFS_FILE",
Self::UfsFallbackBlock => "UFS_FALLBACK_BLOCK",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"GOOSEFS_BLOCK" => Some(Self::GoosefsBlock),
"UFS_FILE" => Some(Self::UfsFile),
"UFS_FALLBACK_BLOCK" => Some(Self::UfsFallbackBlock),
_ => None,
}
}
}
pub mod block_worker_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 BlockWorkerClient<T> {
inner: tonic::client::Grpc<T>,
}
impl BlockWorkerClient<tonic::transport::Channel> {
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> BlockWorkerClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
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,
) -> BlockWorkerClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
BlockWorkerClient::new(InterceptedService::new(inner, interceptor))
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[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 read_block(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::ReadRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::ReadResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.BlockWorker/ReadBlock",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.BlockWorker",
"ReadBlock",
),
);
self.inner.streaming(req, path, codec).await
}
pub async fn write_block(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::WriteRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::WriteResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.BlockWorker/WriteBlock",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.BlockWorker",
"WriteBlock",
),
);
self.inner.streaming(req, path, codec).await
}
pub async fn open_local_block(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::OpenLocalBlockRequest,
>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::OpenLocalBlockResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.BlockWorker/OpenLocalBlock",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.BlockWorker",
"OpenLocalBlock",
),
);
self.inner.streaming(req, path, codec).await
}
pub async fn create_local_block(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::CreateLocalBlockRequest,
>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::CreateLocalBlockResponse>>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.BlockWorker/CreateLocalBlock",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.BlockWorker",
"CreateLocalBlock",
),
);
self.inner.streaming(req, path, codec).await
}
pub async fn async_cache(
&mut self,
request: impl tonic::IntoRequest<super::AsyncCacheRequest>,
) -> std::result::Result<
tonic::Response<super::AsyncCacheResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.BlockWorker/AsyncCache",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.BlockWorker",
"AsyncCache",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn remove_block(
&mut self,
request: impl tonic::IntoRequest<super::RemoveBlockRequest>,
) -> std::result::Result<
tonic::Response<super::RemoveBlockResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.BlockWorker/RemoveBlock",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.BlockWorker",
"RemoveBlock",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn move_block(
&mut self,
request: impl tonic::IntoRequest<super::MoveBlockRequest>,
) -> std::result::Result<
tonic::Response<super::MoveBlockResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.BlockWorker/MoveBlock",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.BlockWorker",
"MoveBlock",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn free_worker(
&mut self,
request: impl tonic::IntoRequest<super::FreeWorkerRequest>,
) -> std::result::Result<
tonic::Response<super::FreeWorkerResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.BlockWorker/FreeWorker",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.BlockWorker",
"FreeWorker",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn clear_metrics(
&mut self,
request: impl tonic::IntoRequest<super::ClearMetricsRequest>,
) -> std::result::Result<
tonic::Response<super::ClearMetricsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.BlockWorker/ClearMetrics",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.BlockWorker",
"ClearMetrics",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn avoid_block_dead_lock(
&mut self,
request: impl tonic::IntoRequest<super::AvoidBlockDeadLockRequest>,
) -> std::result::Result<
tonic::Response<super::AvoidBlockDeadLockResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.BlockWorker/AvoidBlockDeadLock",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.BlockWorker",
"AvoidBlockDeadLock",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn sync_cache(
&mut self,
request: impl tonic::IntoRequest<super::SyncCacheRequest>,
) -> std::result::Result<
tonic::Response<super::SyncCacheResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.BlockWorker/SyncCache",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.BlockWorker",
"SyncCache",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn check_blocks(
&mut self,
request: impl tonic::IntoRequest<super::CheckBlocksRequest>,
) -> std::result::Result<
tonic::Response<super::CheckBlocksResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.BlockWorker/CheckBlocks",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.BlockWorker",
"CheckBlocks",
),
);
self.inner.unary(req, path, codec).await
}
}
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct WorkerManagerMasterInfo {
#[prost(int64, optional, tag = "1")]
pub capacity_bytes: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "2")]
pub free_bytes: ::core::option::Option<i64>,
#[prost(int32, optional, tag = "3")]
pub live_worker_num: ::core::option::Option<i32>,
#[prost(int32, optional, tag = "4")]
pub lost_worker_num: ::core::option::Option<i32>,
#[prost(int64, optional, tag = "5")]
pub used_bytes: ::core::option::Option<i64>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetCapacityBytesPOptions {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetCapacityBytesPResponse {
#[prost(int64, optional, tag = "1")]
pub bytes: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetWorkerManagerMasterInfoPOptions {
#[prost(
enumeration = "WorkerManagerMasterInfoField",
repeated,
packed = "false",
tag = "1"
)]
pub filters: ::prost::alloc::vec::Vec<i32>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetWorkerManagerMasterInfoPResponse {
#[prost(message, optional, tag = "1")]
pub worker_manager_master_info: ::core::option::Option<WorkerManagerMasterInfo>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetUsedBytesPOptions {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetUsedBytesPResponse {
#[prost(int64, optional, tag = "1")]
pub bytes: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WorkerInfo {
#[prost(int64, optional, tag = "1")]
pub id: ::core::option::Option<i64>,
#[prost(message, optional, tag = "2")]
pub address: ::core::option::Option<super::WorkerNetAddress>,
#[prost(int32, optional, tag = "3")]
pub last_contact_sec: ::core::option::Option<i32>,
#[prost(enumeration = "super::WorkerStatus", optional, tag = "4")]
pub state: ::core::option::Option<i32>,
#[prost(int64, optional, tag = "5")]
pub capacity_bytes: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "6")]
pub used_bytes: ::core::option::Option<i64>,
#[prost(int64, optional, tag = "7")]
pub start_time_ms: ::core::option::Option<i64>,
#[prost(int32, optional, tag = "8")]
pub virtual_node_num: ::core::option::Option<i32>,
#[prost(bool, optional, tag = "9")]
pub alive: ::core::option::Option<bool>,
#[prost(double, optional, tag = "10")]
pub sync_cache_rate_limit: ::core::option::Option<f64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetWorkerReportPOptions {
#[prost(string, repeated, tag = "1")]
pub addresses: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(enumeration = "WorkerInfoField", repeated, packed = "false", tag = "2")]
pub field_ranges: ::prost::alloc::vec::Vec<i32>,
#[prost(enumeration = "WorkerRange", optional, tag = "3")]
pub worker_range: ::core::option::Option<i32>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetWorkerInfoListPOptions {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetWorkerInfoListPResponse {
#[prost(message, repeated, tag = "1")]
pub worker_infos: ::prost::alloc::vec::Vec<WorkerInfo>,
#[prost(int64, optional, tag = "2")]
pub last_updated_timestamp: ::core::option::Option<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WorkerLostStorageInfo {
#[prost(message, optional, tag = "1")]
pub address: ::core::option::Option<super::WorkerNetAddress>,
#[prost(message, optional, tag = "2")]
pub lost_storage: ::core::option::Option<StorageList>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetWorkerLostStoragePOptions {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetWorkerLostStoragePResponse {
#[prost(message, repeated, tag = "1")]
pub worker_lost_storage_info: ::prost::alloc::vec::Vec<WorkerLostStorageInfo>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ManageWorkerPRequest {
#[prost(message, optional, tag = "1")]
pub address: ::core::option::Option<super::WorkerNetAddress>,
#[prost(enumeration = "super::ManageWorkerAction", optional, tag = "2")]
pub action: ::core::option::Option<i32>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ManageWorkerPResponse {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UpdateClusterRateLimitPRequest {
#[prost(double, optional, tag = "1")]
pub rate_limit: ::core::option::Option<f64>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct UpdateClusterRateLimitPResponse {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetClusterRateLimitPRequest {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetClusterRateLimitPResponse {
#[prost(double, optional, tag = "1")]
pub rate_limit: ::core::option::Option<f64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TierList {
#[prost(int64, repeated, packed = "false", tag = "1")]
pub tiers: ::prost::alloc::vec::Vec<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct BlockIdList {
#[prost(int64, repeated, packed = "false", tag = "1")]
pub block_id: ::prost::alloc::vec::Vec<i64>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StorageList {
#[prost(string, repeated, tag = "1")]
pub storage: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum WorkerManagerMasterInfoField {
CapacityBytes = 1,
FreeBytes = 2,
LiveWorkerNum = 3,
LostWorkerNum = 4,
UsedBytes = 5,
}
impl WorkerManagerMasterInfoField {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::CapacityBytes => "CAPACITY_BYTES",
Self::FreeBytes => "FREE_BYTES",
Self::LiveWorkerNum => "LIVE_WORKER_NUM",
Self::LostWorkerNum => "LOST_WORKER_NUM",
Self::UsedBytes => "USED_BYTES",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"CAPACITY_BYTES" => Some(Self::CapacityBytes),
"FREE_BYTES" => Some(Self::FreeBytes),
"LIVE_WORKER_NUM" => Some(Self::LiveWorkerNum),
"LOST_WORKER_NUM" => Some(Self::LostWorkerNum),
"USED_BYTES" => Some(Self::UsedBytes),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum WorkerRange {
All = 1,
Live = 2,
Lost = 3,
Specified = 4,
}
impl WorkerRange {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::All => "ALL",
Self::Live => "LIVE",
Self::Lost => "LOST",
Self::Specified => "SPECIFIED",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"ALL" => Some(Self::All),
"LIVE" => Some(Self::Live),
"LOST" => Some(Self::Lost),
"SPECIFIED" => Some(Self::Specified),
_ => None,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum WorkerInfoField {
WorkerCapacityBytes = 1,
Id = 2,
LastContactSec = 3,
StartTimeMs = 4,
WorkerUsedBytes = 5,
WorkerSyncCacheRateLimit = 6,
}
impl WorkerInfoField {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::WorkerCapacityBytes => "WORKER_CAPACITY_BYTES",
Self::Id => "ID",
Self::LastContactSec => "LAST_CONTACT_SEC",
Self::StartTimeMs => "START_TIME_MS",
Self::WorkerUsedBytes => "WORKER_USED_BYTES",
Self::WorkerSyncCacheRateLimit => "WORKER_SYNC_CACHE_RATE_LIMIT",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"WORKER_CAPACITY_BYTES" => Some(Self::WorkerCapacityBytes),
"ID" => Some(Self::Id),
"LAST_CONTACT_SEC" => Some(Self::LastContactSec),
"START_TIME_MS" => Some(Self::StartTimeMs),
"WORKER_USED_BYTES" => Some(Self::WorkerUsedBytes),
"WORKER_SYNC_CACHE_RATE_LIMIT" => Some(Self::WorkerSyncCacheRateLimit),
_ => None,
}
}
}
pub mod worker_manager_master_client_service_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 WorkerManagerMasterClientServiceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl WorkerManagerMasterClientServiceClient<tonic::transport::Channel> {
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> WorkerManagerMasterClientServiceClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
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,
) -> WorkerManagerMasterClientServiceClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
WorkerManagerMasterClientServiceClient::new(
InterceptedService::new(inner, interceptor),
)
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.send_compressed(encoding);
self
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.inner = self.inner.accept_compressed(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.inner = self.inner.max_decoding_message_size(limit);
self
}
#[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 get_worker_manager_master_info(
&mut self,
request: impl tonic::IntoRequest<super::GetWorkerManagerMasterInfoPOptions>,
) -> std::result::Result<
tonic::Response<super::GetWorkerManagerMasterInfoPResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService/GetWorkerManagerMasterInfo",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService",
"GetWorkerManagerMasterInfo",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_capacity_bytes(
&mut self,
request: impl tonic::IntoRequest<super::GetCapacityBytesPOptions>,
) -> std::result::Result<
tonic::Response<super::GetCapacityBytesPResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService/GetCapacityBytes",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService",
"GetCapacityBytes",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_used_bytes(
&mut self,
request: impl tonic::IntoRequest<super::GetUsedBytesPOptions>,
) -> std::result::Result<
tonic::Response<super::GetUsedBytesPResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService/GetUsedBytes",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService",
"GetUsedBytes",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_worker_info_list(
&mut self,
request: impl tonic::IntoRequest<super::GetWorkerInfoListPOptions>,
) -> std::result::Result<
tonic::Response<super::GetWorkerInfoListPResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService/GetWorkerInfoList",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService",
"GetWorkerInfoList",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_worker_report(
&mut self,
request: impl tonic::IntoRequest<super::GetWorkerReportPOptions>,
) -> std::result::Result<
tonic::Response<super::GetWorkerInfoListPResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService/GetWorkerReport",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService",
"GetWorkerReport",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_worker_lost_storage(
&mut self,
request: impl tonic::IntoRequest<super::GetWorkerLostStoragePOptions>,
) -> std::result::Result<
tonic::Response<super::GetWorkerLostStoragePResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService/GetWorkerLostStorage",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService",
"GetWorkerLostStorage",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn manage_worker(
&mut self,
request: impl tonic::IntoRequest<super::ManageWorkerPRequest>,
) -> std::result::Result<
tonic::Response<super::ManageWorkerPResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService/ManageWorker",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService",
"ManageWorker",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn update_cluster_rate_limit(
&mut self,
request: impl tonic::IntoRequest<super::UpdateClusterRateLimitPRequest>,
) -> std::result::Result<
tonic::Response<super::UpdateClusterRateLimitPResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService/UpdateClusterRateLimit",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService",
"UpdateClusterRateLimit",
),
);
self.inner.unary(req, path, codec).await
}
pub async fn get_cluster_rate_limit(
&mut self,
request: impl tonic::IntoRequest<super::GetClusterRateLimitPRequest>,
) -> std::result::Result<
tonic::Response<super::GetClusterRateLimitPResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService/GetClusterRateLimit",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(
GrpcMethod::new(
"com.qcloud.cos.goosefs.grpc.block.WorkerManagerMasterClientService",
"GetClusterRateLimit",
),
);
self.inner.unary(req, path, codec).await
}
}
}