#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct ResponseHeader {
#[prost(uint64, tag = "1")]
pub cluster_id: u64,
#[prost(uint64, tag = "2")]
pub member_id: u64,
#[prost(int64, tag = "3")]
pub revision: i64,
#[prost(uint64, tag = "4")]
pub raft_term: u64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct RangeRequest {
#[prost(bytes = "vec", tag = "1")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "2")]
pub range_end: ::prost::alloc::vec::Vec<u8>,
#[prost(int64, tag = "3")]
pub limit: i64,
#[prost(int64, tag = "4")]
pub revision: i64,
#[prost(enumeration = "range_request::SortOrder", tag = "5")]
pub sort_order: i32,
#[prost(enumeration = "range_request::SortTarget", tag = "6")]
pub sort_target: i32,
#[prost(bool, tag = "7")]
pub serializable: bool,
#[prost(bool, tag = "8")]
pub keys_only: bool,
#[prost(bool, tag = "9")]
pub count_only: bool,
#[prost(int64, tag = "10")]
pub min_mod_revision: i64,
#[prost(int64, tag = "11")]
pub max_mod_revision: i64,
#[prost(int64, tag = "12")]
pub min_create_revision: i64,
#[prost(int64, tag = "13")]
pub max_create_revision: i64,
}
pub mod range_request {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum SortOrder {
None = 0,
Ascend = 1,
Descend = 2,
}
impl SortOrder {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::None => "NONE",
Self::Ascend => "ASCEND",
Self::Descend => "DESCEND",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NONE" => Some(Self::None),
"ASCEND" => Some(Self::Ascend),
"DESCEND" => Some(Self::Descend),
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum SortTarget {
Key = 0,
Version = 1,
Create = 2,
Mod = 3,
Value = 4,
}
impl SortTarget {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Key => "KEY",
Self::Version => "VERSION",
Self::Create => "CREATE",
Self::Mod => "MOD",
Self::Value => "VALUE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"KEY" => Some(Self::Key),
"VERSION" => Some(Self::Version),
"CREATE" => Some(Self::Create),
"MOD" => Some(Self::Mod),
"VALUE" => Some(Self::Value),
_ => None,
}
}
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RangeResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(message, repeated, tag = "2")]
pub kvs: ::prost::alloc::vec::Vec<super::mvccpb::KeyValue>,
#[prost(bool, tag = "3")]
pub more: bool,
#[prost(int64, tag = "4")]
pub count: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PutRequest {
#[prost(bytes = "vec", tag = "1")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "2")]
pub value: ::prost::alloc::vec::Vec<u8>,
#[prost(int64, tag = "3")]
pub lease: i64,
#[prost(bool, tag = "4")]
pub prev_kv: bool,
#[prost(bool, tag = "5")]
pub ignore_value: bool,
#[prost(bool, tag = "6")]
pub ignore_lease: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct PutResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(message, optional, tag = "2")]
pub prev_kv: ::core::option::Option<super::mvccpb::KeyValue>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DeleteRangeRequest {
#[prost(bytes = "vec", tag = "1")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "2")]
pub range_end: ::prost::alloc::vec::Vec<u8>,
#[prost(bool, tag = "3")]
pub prev_kv: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteRangeResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(int64, tag = "2")]
pub deleted: i64,
#[prost(message, repeated, tag = "3")]
pub prev_kvs: ::prost::alloc::vec::Vec<super::mvccpb::KeyValue>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct RequestOp {
#[prost(oneof = "request_op::Request", tags = "1, 2, 3, 4")]
pub request: ::core::option::Option<request_op::Request>,
}
pub mod request_op {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Request {
#[prost(message, tag = "1")]
RequestRange(super::RangeRequest),
#[prost(message, tag = "2")]
RequestPut(super::PutRequest),
#[prost(message, tag = "3")]
RequestDeleteRange(super::DeleteRangeRequest),
#[prost(message, tag = "4")]
RequestTxn(super::TxnRequest),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ResponseOp {
#[prost(oneof = "response_op::Response", tags = "1, 2, 3, 4")]
pub response: ::core::option::Option<response_op::Response>,
}
pub mod response_op {
#[derive(Clone, PartialEq, ::prost::Oneof)]
pub enum Response {
#[prost(message, tag = "1")]
ResponseRange(super::RangeResponse),
#[prost(message, tag = "2")]
ResponsePut(super::PutResponse),
#[prost(message, tag = "3")]
ResponseDeleteRange(super::DeleteRangeResponse),
#[prost(message, tag = "4")]
ResponseTxn(super::TxnResponse),
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Compare {
#[prost(enumeration = "compare::CompareResult", tag = "1")]
pub result: i32,
#[prost(enumeration = "compare::CompareTarget", tag = "2")]
pub target: i32,
#[prost(bytes = "vec", tag = "3")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "64")]
pub range_end: ::prost::alloc::vec::Vec<u8>,
#[prost(oneof = "compare::TargetUnion", tags = "4, 5, 6, 7, 8")]
pub target_union: ::core::option::Option<compare::TargetUnion>,
}
pub mod compare {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum CompareResult {
Equal = 0,
Greater = 1,
Less = 2,
NotEqual = 3,
}
impl CompareResult {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Equal => "EQUAL",
Self::Greater => "GREATER",
Self::Less => "LESS",
Self::NotEqual => "NOT_EQUAL",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"EQUAL" => Some(Self::Equal),
"GREATER" => Some(Self::Greater),
"LESS" => Some(Self::Less),
"NOT_EQUAL" => Some(Self::NotEqual),
_ => None,
}
}
}
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum CompareTarget {
Version = 0,
Create = 1,
Mod = 2,
Value = 3,
Lease = 4,
}
impl CompareTarget {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Version => "VERSION",
Self::Create => "CREATE",
Self::Mod => "MOD",
Self::Value => "VALUE",
Self::Lease => "LEASE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"VERSION" => Some(Self::Version),
"CREATE" => Some(Self::Create),
"MOD" => Some(Self::Mod),
"VALUE" => Some(Self::Value),
"LEASE" => Some(Self::Lease),
_ => None,
}
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum TargetUnion {
#[prost(int64, tag = "4")]
Version(i64),
#[prost(int64, tag = "5")]
CreateRevision(i64),
#[prost(int64, tag = "6")]
ModRevision(i64),
#[prost(bytes, tag = "7")]
Value(::prost::alloc::vec::Vec<u8>),
#[prost(int64, tag = "8")]
Lease(i64),
}
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TxnRequest {
#[prost(message, repeated, tag = "1")]
pub compare: ::prost::alloc::vec::Vec<Compare>,
#[prost(message, repeated, tag = "2")]
pub success: ::prost::alloc::vec::Vec<RequestOp>,
#[prost(message, repeated, tag = "3")]
pub failure: ::prost::alloc::vec::Vec<RequestOp>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TxnResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(bool, tag = "2")]
pub succeeded: bool,
#[prost(message, repeated, tag = "3")]
pub responses: ::prost::alloc::vec::Vec<ResponseOp>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CompactionRequest {
#[prost(int64, tag = "1")]
pub revision: i64,
#[prost(bool, tag = "2")]
pub physical: bool,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct CompactionResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HashRequest {}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HashKvRequest {
#[prost(int64, tag = "1")]
pub revision: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HashKvResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(uint32, tag = "2")]
pub hash: u32,
#[prost(int64, tag = "3")]
pub compact_revision: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct HashResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(uint32, tag = "2")]
pub hash: u32,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SnapshotRequest {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SnapshotResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(uint64, tag = "2")]
pub remaining_bytes: u64,
#[prost(bytes = "vec", tag = "3")]
pub blob: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WatchRequest {
#[prost(oneof = "watch_request::RequestUnion", tags = "1, 2, 3")]
pub request_union: ::core::option::Option<watch_request::RequestUnion>,
}
pub mod watch_request {
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
pub enum RequestUnion {
#[prost(message, tag = "1")]
CreateRequest(super::WatchCreateRequest),
#[prost(message, tag = "2")]
CancelRequest(super::WatchCancelRequest),
#[prost(message, tag = "3")]
ProgressRequest(super::WatchProgressRequest),
}
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WatchCreateRequest {
#[prost(bytes = "vec", tag = "1")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "2")]
pub range_end: ::prost::alloc::vec::Vec<u8>,
#[prost(int64, tag = "3")]
pub start_revision: i64,
#[prost(bool, tag = "4")]
pub progress_notify: bool,
#[prost(enumeration = "watch_create_request::FilterType", repeated, tag = "5")]
pub filters: ::prost::alloc::vec::Vec<i32>,
#[prost(bool, tag = "6")]
pub prev_kv: bool,
#[prost(int64, tag = "7")]
pub watch_id: i64,
#[prost(bool, tag = "8")]
pub fragment: bool,
}
pub mod watch_create_request {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum FilterType {
Noput = 0,
Nodelete = 1,
}
impl FilterType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Noput => "NOPUT",
Self::Nodelete => "NODELETE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NOPUT" => Some(Self::Noput),
"NODELETE" => Some(Self::Nodelete),
_ => None,
}
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WatchCancelRequest {
#[prost(int64, tag = "1")]
pub watch_id: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct WatchProgressRequest {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WatchResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(int64, tag = "2")]
pub watch_id: i64,
#[prost(bool, tag = "3")]
pub created: bool,
#[prost(bool, tag = "4")]
pub canceled: bool,
#[prost(int64, tag = "5")]
pub compact_revision: i64,
#[prost(string, tag = "6")]
pub cancel_reason: ::prost::alloc::string::String,
#[prost(bool, tag = "7")]
pub fragment: bool,
#[prost(message, repeated, tag = "11")]
pub events: ::prost::alloc::vec::Vec<super::mvccpb::Event>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LeaseGrantRequest {
#[prost(int64, tag = "1")]
pub ttl: i64,
#[prost(int64, tag = "2")]
pub id: i64,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LeaseGrantResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(int64, tag = "2")]
pub id: i64,
#[prost(int64, tag = "3")]
pub ttl: i64,
#[prost(string, tag = "4")]
pub error: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LeaseRevokeRequest {
#[prost(int64, tag = "1")]
pub id: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LeaseRevokeResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LeaseCheckpoint {
#[prost(int64, tag = "1")]
pub id: i64,
#[prost(int64, tag = "2")]
pub remaining_ttl: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LeaseCheckpointRequest {
#[prost(message, repeated, tag = "1")]
pub checkpoints: ::prost::alloc::vec::Vec<LeaseCheckpoint>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LeaseCheckpointResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LeaseKeepAliveRequest {
#[prost(int64, tag = "1")]
pub id: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LeaseKeepAliveResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(int64, tag = "2")]
pub id: i64,
#[prost(int64, tag = "3")]
pub ttl: i64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LeaseTimeToLiveRequest {
#[prost(int64, tag = "1")]
pub id: i64,
#[prost(bool, tag = "2")]
pub keys: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LeaseTimeToLiveResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(int64, tag = "2")]
pub id: i64,
#[prost(int64, tag = "3")]
pub ttl: i64,
#[prost(int64, tag = "4")]
pub granted_ttl: i64,
#[prost(bytes = "vec", repeated, tag = "5")]
pub keys: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec<u8>>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LeaseLeasesRequest {}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct LeaseStatus {
#[prost(int64, tag = "1")]
pub id: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct LeaseLeasesResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(message, repeated, tag = "2")]
pub leases: ::prost::alloc::vec::Vec<LeaseStatus>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Member {
#[prost(uint64, tag = "1")]
pub id: u64,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(string, repeated, tag = "3")]
pub peer_ur_ls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(string, repeated, tag = "4")]
pub client_ur_ls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(bool, tag = "5")]
pub is_learner: bool,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MemberAddRequest {
#[prost(string, repeated, tag = "1")]
pub peer_ur_ls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(bool, tag = "2")]
pub is_learner: bool,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MemberAddResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(message, optional, tag = "2")]
pub member: ::core::option::Option<Member>,
#[prost(message, repeated, tag = "3")]
pub members: ::prost::alloc::vec::Vec<Member>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MemberRemoveRequest {
#[prost(uint64, tag = "1")]
pub id: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MemberRemoveResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(message, repeated, tag = "2")]
pub members: ::prost::alloc::vec::Vec<Member>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MemberUpdateRequest {
#[prost(uint64, tag = "1")]
pub id: u64,
#[prost(string, repeated, tag = "2")]
pub peer_ur_ls: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MemberUpdateResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(message, repeated, tag = "2")]
pub members: ::prost::alloc::vec::Vec<Member>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MemberListRequest {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MemberListResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(message, repeated, tag = "2")]
pub members: ::prost::alloc::vec::Vec<Member>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MemberPromoteRequest {
#[prost(uint64, tag = "1")]
pub id: u64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct MemberPromoteResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(message, repeated, tag = "2")]
pub members: ::prost::alloc::vec::Vec<Member>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DefragmentRequest {}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct DefragmentResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MoveLeaderRequest {
#[prost(uint64, tag = "1")]
pub target_id: u64,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MoveLeaderResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AlarmRequest {
#[prost(enumeration = "alarm_request::AlarmAction", tag = "1")]
pub action: i32,
#[prost(uint64, tag = "2")]
pub member_id: u64,
#[prost(enumeration = "AlarmType", tag = "3")]
pub alarm: i32,
}
pub mod alarm_request {
#[derive(
Clone,
Copy,
Debug,
PartialEq,
Eq,
Hash,
PartialOrd,
Ord,
::prost::Enumeration
)]
#[repr(i32)]
pub enum AlarmAction {
Get = 0,
Activate = 1,
Deactivate = 2,
}
impl AlarmAction {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::Get => "GET",
Self::Activate => "ACTIVATE",
Self::Deactivate => "DEACTIVATE",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"GET" => Some(Self::Get),
"ACTIVATE" => Some(Self::Activate),
"DEACTIVATE" => Some(Self::Deactivate),
_ => None,
}
}
}
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AlarmMember {
#[prost(uint64, tag = "1")]
pub member_id: u64,
#[prost(enumeration = "AlarmType", tag = "2")]
pub alarm: i32,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AlarmResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(message, repeated, tag = "2")]
pub alarms: ::prost::alloc::vec::Vec<AlarmMember>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StatusRequest {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct StatusResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(string, tag = "2")]
pub version: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub db_size: i64,
#[prost(uint64, tag = "4")]
pub leader: u64,
#[prost(uint64, tag = "5")]
pub raft_index: u64,
#[prost(uint64, tag = "6")]
pub raft_term: u64,
#[prost(uint64, tag = "7")]
pub raft_applied_index: u64,
#[prost(string, repeated, tag = "8")]
pub errors: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
#[prost(int64, tag = "9")]
pub db_size_in_use: i64,
#[prost(bool, tag = "10")]
pub is_learner: bool,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthEnableRequest {}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthDisableRequest {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthenticateRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub password: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserAddRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub password: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub options: ::core::option::Option<super::authpb::UserAddOptions>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserGetRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserDeleteRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserChangePasswordRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub password: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserGrantRoleRequest {
#[prost(string, tag = "1")]
pub user: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub role: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserRevokeRoleRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub role: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthRoleAddRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthRoleGetRequest {
#[prost(string, tag = "1")]
pub role: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserListRequest {}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthRoleListRequest {}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthRoleDeleteRequest {
#[prost(string, tag = "1")]
pub role: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthRoleGrantPermissionRequest {
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
#[prost(message, optional, tag = "2")]
pub perm: ::core::option::Option<super::authpb::Permission>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthRoleRevokePermissionRequest {
#[prost(string, tag = "1")]
pub role: ::prost::alloc::string::String,
#[prost(bytes = "vec", tag = "2")]
pub key: ::prost::alloc::vec::Vec<u8>,
#[prost(bytes = "vec", tag = "3")]
pub range_end: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthEnableResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthDisableResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthenticateResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(string, tag = "2")]
pub token: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserAddResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserGetResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(string, repeated, tag = "2")]
pub roles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserDeleteResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserChangePasswordResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserGrantRoleResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserRevokeRoleResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthRoleAddResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AuthRoleGetResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(message, repeated, tag = "2")]
pub perm: ::prost::alloc::vec::Vec<super::authpb::Permission>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthRoleListResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(string, repeated, tag = "2")]
pub roles: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthUserListResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
#[prost(string, repeated, tag = "2")]
pub users: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthRoleDeleteResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthRoleGrantPermissionResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AuthRoleRevokePermissionResponse {
#[prost(message, optional, tag = "1")]
pub header: ::core::option::Option<ResponseHeader>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum AlarmType {
None = 0,
Nospace = 1,
Corrupt = 2,
}
impl AlarmType {
pub fn as_str_name(&self) -> &'static str {
match self {
Self::None => "NONE",
Self::Nospace => "NOSPACE",
Self::Corrupt => "CORRUPT",
}
}
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"NONE" => Some(Self::None),
"NOSPACE" => Some(Self::Nospace),
"CORRUPT" => Some(Self::Corrupt),
_ => None,
}
}
}
pub mod kv_client {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
use tonic::codegen::http::Uri;
use tonic::metadata::{Ascii, MetadataValue};
use crate::etcdpb::XPEER;
#[derive(Debug, Clone)]
pub struct KvClient<T> {
inner: tonic::client::Grpc<T>,
}
impl KvClient<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> KvClient<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,
) -> KvClient<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,
{
KvClient::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 range(
&mut self,
request: impl tonic::IntoRequest<super::RangeRequest>,
) -> std::result::Result<tonic::Response<super::RangeResponse>, 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("/etcdserverpb.KV/Range");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("etcdserverpb.KV", "Range"));
self.inner.unary(req, path, codec).await
}
pub async fn put(
&mut self,
request: impl tonic::IntoRequest<super::PutRequest>,
peer: Option<MetadataValue<Ascii>>,
) -> std::result::Result<tonic::Response<super::PutResponse>, 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("/etcdserverpb.KV/Put");
let mut req = request.into_request();
if let Some(peer) = peer {
req.metadata_mut().insert(XPEER, peer);
}
req.extensions_mut().insert(GrpcMethod::new("etcdserverpb.KV", "Put"));
self.inner.unary(req, path, codec).await
}
pub async fn delete_range(
&mut self,
request: impl tonic::IntoRequest<super::DeleteRangeRequest>,
peer: Option<MetadataValue<Ascii>>,
) -> std::result::Result<
tonic::Response<super::DeleteRangeResponse>,
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(
"/etcdserverpb.KV/DeleteRange",
);
let mut req = request.into_request();
if let Some(peer) = peer {
req.metadata_mut().insert(XPEER, peer);
}
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.KV", "DeleteRange"));
self.inner.unary(req, path, codec).await
}
pub async fn txn(
&mut self,
request: impl tonic::IntoRequest<super::TxnRequest>,
peer: Option<MetadataValue<Ascii>>,
) -> std::result::Result<tonic::Response<super::TxnResponse>, 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("/etcdserverpb.KV/Txn");
let mut req = request.into_request();
if let Some(peer) = peer {
req.metadata_mut().insert(XPEER, peer);
}
req.extensions_mut().insert(GrpcMethod::new("etcdserverpb.KV", "Txn"));
self.inner.unary(req, path, codec).await
}
pub async fn compact(
&mut self,
request: impl tonic::IntoRequest<super::CompactionRequest>,
) -> std::result::Result<
tonic::Response<super::CompactionResponse>,
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("/etcdserverpb.KV/Compact");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("etcdserverpb.KV", "Compact"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod kv_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Kv: std::marker::Send + std::marker::Sync + 'static {
async fn range(
&self,
request: tonic::Request<super::RangeRequest>,
) -> std::result::Result<tonic::Response<super::RangeResponse>, tonic::Status>;
async fn put(
&self,
request: tonic::Request<super::PutRequest>,
) -> std::result::Result<tonic::Response<super::PutResponse>, tonic::Status>;
async fn delete_range(
&self,
request: tonic::Request<super::DeleteRangeRequest>,
) -> std::result::Result<
tonic::Response<super::DeleteRangeResponse>,
tonic::Status,
>;
async fn txn(
&self,
request: tonic::Request<super::TxnRequest>,
) -> std::result::Result<tonic::Response<super::TxnResponse>, tonic::Status>;
async fn compact(
&self,
request: tonic::Request<super::CompactionRequest>,
) -> std::result::Result<
tonic::Response<super::CompactionResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct KvServer<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> KvServer<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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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 KvServer<T>
where
T: Kv,
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() {
"/etcdserverpb.KV/Range" => {
#[allow(non_camel_case_types)]
struct RangeSvc<T: Kv>(pub Arc<T>);
impl<T: Kv> tonic::server::UnaryService<super::RangeRequest>
for RangeSvc<T> {
type Response = super::RangeResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::RangeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kv>::range(&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 = RangeSvc(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)
}
"/etcdserverpb.KV/Put" => {
#[allow(non_camel_case_types)]
struct PutSvc<T: Kv>(pub Arc<T>);
impl<T: Kv> tonic::server::UnaryService<super::PutRequest>
for PutSvc<T> {
type Response = super::PutResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::PutRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kv>::put(&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 = PutSvc(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)
}
"/etcdserverpb.KV/DeleteRange" => {
#[allow(non_camel_case_types)]
struct DeleteRangeSvc<T: Kv>(pub Arc<T>);
impl<T: Kv> tonic::server::UnaryService<super::DeleteRangeRequest>
for DeleteRangeSvc<T> {
type Response = super::DeleteRangeResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DeleteRangeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kv>::delete_range(&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 = DeleteRangeSvc(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)
}
"/etcdserverpb.KV/Txn" => {
#[allow(non_camel_case_types)]
struct TxnSvc<T: Kv>(pub Arc<T>);
impl<T: Kv> tonic::server::UnaryService<super::TxnRequest>
for TxnSvc<T> {
type Response = super::TxnResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::TxnRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kv>::txn(&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 = TxnSvc(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)
}
"/etcdserverpb.KV/Compact" => {
#[allow(non_camel_case_types)]
struct CompactSvc<T: Kv>(pub Arc<T>);
impl<T: Kv> tonic::server::UnaryService<super::CompactionRequest>
for CompactSvc<T> {
type Response = super::CompactionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::CompactionRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Kv>::compact(&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 = CompactSvc(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 KvServer<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,
}
}
}
pub const SERVICE_NAME: &str = "etcdserverpb.KV";
impl<T> tonic::server::NamedService for KvServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod watch_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 WatchClient<T> {
inner: tonic::client::Grpc<T>,
}
impl WatchClient<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> WatchClient<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,
) -> WatchClient<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,
{
WatchClient::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 watch(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::WatchRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::WatchResponse>>,
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("/etcdserverpb.Watch/Watch");
let mut req = request.into_streaming_request();
req.extensions_mut().insert(GrpcMethod::new("etcdserverpb.Watch", "Watch"));
self.inner.streaming(req, path, codec).await
}
}
}
pub mod watch_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Watch: std::marker::Send + std::marker::Sync + 'static {
type WatchStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::WatchResponse, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn watch(
&self,
request: tonic::Request<tonic::Streaming<super::WatchRequest>>,
) -> std::result::Result<tonic::Response<Self::WatchStream>, tonic::Status>;
}
#[derive(Debug)]
pub struct WatchServer<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> WatchServer<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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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 WatchServer<T>
where
T: Watch,
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() {
"/etcdserverpb.Watch/Watch" => {
#[allow(non_camel_case_types)]
struct WatchSvc<T: Watch>(pub Arc<T>);
impl<T: Watch> tonic::server::StreamingService<super::WatchRequest>
for WatchSvc<T> {
type Response = super::WatchResponse;
type ResponseStream = T::WatchStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::WatchRequest>,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Watch>::watch(&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 = WatchSvc(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.streaming(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 WatchServer<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,
}
}
}
pub const SERVICE_NAME: &str = "etcdserverpb.Watch";
impl<T> tonic::server::NamedService for WatchServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod lease_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 LeaseClient<T> {
inner: tonic::client::Grpc<T>,
}
impl LeaseClient<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> LeaseClient<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,
) -> LeaseClient<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,
{
LeaseClient::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 lease_grant(
&mut self,
request: impl tonic::IntoRequest<super::LeaseGrantRequest>,
) -> std::result::Result<
tonic::Response<super::LeaseGrantResponse>,
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(
"/etcdserverpb.Lease/LeaseGrant",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Lease", "LeaseGrant"));
self.inner.unary(req, path, codec).await
}
pub async fn lease_revoke(
&mut self,
request: impl tonic::IntoRequest<super::LeaseRevokeRequest>,
) -> std::result::Result<
tonic::Response<super::LeaseRevokeResponse>,
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(
"/etcdserverpb.Lease/LeaseRevoke",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Lease", "LeaseRevoke"));
self.inner.unary(req, path, codec).await
}
pub async fn lease_keep_alive(
&mut self,
request: impl tonic::IntoStreamingRequest<
Message = super::LeaseKeepAliveRequest,
>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::LeaseKeepAliveResponse>>,
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(
"/etcdserverpb.Lease/LeaseKeepAlive",
);
let mut req = request.into_streaming_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Lease", "LeaseKeepAlive"));
self.inner.streaming(req, path, codec).await
}
pub async fn lease_time_to_live(
&mut self,
request: impl tonic::IntoRequest<super::LeaseTimeToLiveRequest>,
) -> std::result::Result<
tonic::Response<super::LeaseTimeToLiveResponse>,
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(
"/etcdserverpb.Lease/LeaseTimeToLive",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Lease", "LeaseTimeToLive"));
self.inner.unary(req, path, codec).await
}
pub async fn lease_leases(
&mut self,
request: impl tonic::IntoRequest<super::LeaseLeasesRequest>,
) -> std::result::Result<
tonic::Response<super::LeaseLeasesResponse>,
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(
"/etcdserverpb.Lease/LeaseLeases",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Lease", "LeaseLeases"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod lease_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Lease: std::marker::Send + std::marker::Sync + 'static {
async fn lease_grant(
&self,
request: tonic::Request<super::LeaseGrantRequest>,
) -> std::result::Result<
tonic::Response<super::LeaseGrantResponse>,
tonic::Status,
>;
async fn lease_revoke(
&self,
request: tonic::Request<super::LeaseRevokeRequest>,
) -> std::result::Result<
tonic::Response<super::LeaseRevokeResponse>,
tonic::Status,
>;
type LeaseKeepAliveStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::LeaseKeepAliveResponse, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn lease_keep_alive(
&self,
request: tonic::Request<tonic::Streaming<super::LeaseKeepAliveRequest>>,
) -> std::result::Result<
tonic::Response<Self::LeaseKeepAliveStream>,
tonic::Status,
>;
async fn lease_time_to_live(
&self,
request: tonic::Request<super::LeaseTimeToLiveRequest>,
) -> std::result::Result<
tonic::Response<super::LeaseTimeToLiveResponse>,
tonic::Status,
>;
async fn lease_leases(
&self,
request: tonic::Request<super::LeaseLeasesRequest>,
) -> std::result::Result<
tonic::Response<super::LeaseLeasesResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct LeaseServer<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> LeaseServer<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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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 LeaseServer<T>
where
T: Lease,
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() {
"/etcdserverpb.Lease/LeaseGrant" => {
#[allow(non_camel_case_types)]
struct LeaseGrantSvc<T: Lease>(pub Arc<T>);
impl<T: Lease> tonic::server::UnaryService<super::LeaseGrantRequest>
for LeaseGrantSvc<T> {
type Response = super::LeaseGrantResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::LeaseGrantRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Lease>::lease_grant(&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 = LeaseGrantSvc(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)
}
"/etcdserverpb.Lease/LeaseRevoke" => {
#[allow(non_camel_case_types)]
struct LeaseRevokeSvc<T: Lease>(pub Arc<T>);
impl<T: Lease> tonic::server::UnaryService<super::LeaseRevokeRequest>
for LeaseRevokeSvc<T> {
type Response = super::LeaseRevokeResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::LeaseRevokeRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Lease>::lease_revoke(&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 = LeaseRevokeSvc(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)
}
"/etcdserverpb.Lease/LeaseKeepAlive" => {
#[allow(non_camel_case_types)]
struct LeaseKeepAliveSvc<T: Lease>(pub Arc<T>);
impl<
T: Lease,
> tonic::server::StreamingService<super::LeaseKeepAliveRequest>
for LeaseKeepAliveSvc<T> {
type Response = super::LeaseKeepAliveResponse;
type ResponseStream = T::LeaseKeepAliveStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
tonic::Streaming<super::LeaseKeepAliveRequest>,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Lease>::lease_keep_alive(&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 = LeaseKeepAliveSvc(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.streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/etcdserverpb.Lease/LeaseTimeToLive" => {
#[allow(non_camel_case_types)]
struct LeaseTimeToLiveSvc<T: Lease>(pub Arc<T>);
impl<
T: Lease,
> tonic::server::UnaryService<super::LeaseTimeToLiveRequest>
for LeaseTimeToLiveSvc<T> {
type Response = super::LeaseTimeToLiveResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::LeaseTimeToLiveRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Lease>::lease_time_to_live(&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 = LeaseTimeToLiveSvc(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)
}
"/etcdserverpb.Lease/LeaseLeases" => {
#[allow(non_camel_case_types)]
struct LeaseLeasesSvc<T: Lease>(pub Arc<T>);
impl<T: Lease> tonic::server::UnaryService<super::LeaseLeasesRequest>
for LeaseLeasesSvc<T> {
type Response = super::LeaseLeasesResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::LeaseLeasesRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Lease>::lease_leases(&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 = LeaseLeasesSvc(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 LeaseServer<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,
}
}
}
pub const SERVICE_NAME: &str = "etcdserverpb.Lease";
impl<T> tonic::server::NamedService for LeaseServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod cluster_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 ClusterClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ClusterClient<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> ClusterClient<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,
) -> ClusterClient<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,
{
ClusterClient::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 member_add(
&mut self,
request: impl tonic::IntoRequest<super::MemberAddRequest>,
) -> std::result::Result<
tonic::Response<super::MemberAddResponse>,
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(
"/etcdserverpb.Cluster/MemberAdd",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Cluster", "MemberAdd"));
self.inner.unary(req, path, codec).await
}
pub async fn member_remove(
&mut self,
request: impl tonic::IntoRequest<super::MemberRemoveRequest>,
) -> std::result::Result<
tonic::Response<super::MemberRemoveResponse>,
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(
"/etcdserverpb.Cluster/MemberRemove",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Cluster", "MemberRemove"));
self.inner.unary(req, path, codec).await
}
pub async fn member_update(
&mut self,
request: impl tonic::IntoRequest<super::MemberUpdateRequest>,
) -> std::result::Result<
tonic::Response<super::MemberUpdateResponse>,
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(
"/etcdserverpb.Cluster/MemberUpdate",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Cluster", "MemberUpdate"));
self.inner.unary(req, path, codec).await
}
pub async fn member_list(
&mut self,
request: impl tonic::IntoRequest<super::MemberListRequest>,
) -> std::result::Result<
tonic::Response<super::MemberListResponse>,
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(
"/etcdserverpb.Cluster/MemberList",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Cluster", "MemberList"));
self.inner.unary(req, path, codec).await
}
pub async fn member_promote(
&mut self,
request: impl tonic::IntoRequest<super::MemberPromoteRequest>,
) -> std::result::Result<
tonic::Response<super::MemberPromoteResponse>,
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(
"/etcdserverpb.Cluster/MemberPromote",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Cluster", "MemberPromote"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod cluster_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Cluster: std::marker::Send + std::marker::Sync + 'static {
async fn member_add(
&self,
request: tonic::Request<super::MemberAddRequest>,
) -> std::result::Result<
tonic::Response<super::MemberAddResponse>,
tonic::Status,
>;
async fn member_remove(
&self,
request: tonic::Request<super::MemberRemoveRequest>,
) -> std::result::Result<
tonic::Response<super::MemberRemoveResponse>,
tonic::Status,
>;
async fn member_update(
&self,
request: tonic::Request<super::MemberUpdateRequest>,
) -> std::result::Result<
tonic::Response<super::MemberUpdateResponse>,
tonic::Status,
>;
async fn member_list(
&self,
request: tonic::Request<super::MemberListRequest>,
) -> std::result::Result<
tonic::Response<super::MemberListResponse>,
tonic::Status,
>;
async fn member_promote(
&self,
request: tonic::Request<super::MemberPromoteRequest>,
) -> std::result::Result<
tonic::Response<super::MemberPromoteResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct ClusterServer<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> ClusterServer<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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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 ClusterServer<T>
where
T: Cluster,
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() {
"/etcdserverpb.Cluster/MemberAdd" => {
#[allow(non_camel_case_types)]
struct MemberAddSvc<T: Cluster>(pub Arc<T>);
impl<T: Cluster> tonic::server::UnaryService<super::MemberAddRequest>
for MemberAddSvc<T> {
type Response = super::MemberAddResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MemberAddRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Cluster>::member_add(&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 = MemberAddSvc(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)
}
"/etcdserverpb.Cluster/MemberRemove" => {
#[allow(non_camel_case_types)]
struct MemberRemoveSvc<T: Cluster>(pub Arc<T>);
impl<
T: Cluster,
> tonic::server::UnaryService<super::MemberRemoveRequest>
for MemberRemoveSvc<T> {
type Response = super::MemberRemoveResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MemberRemoveRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Cluster>::member_remove(&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 = MemberRemoveSvc(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)
}
"/etcdserverpb.Cluster/MemberUpdate" => {
#[allow(non_camel_case_types)]
struct MemberUpdateSvc<T: Cluster>(pub Arc<T>);
impl<
T: Cluster,
> tonic::server::UnaryService<super::MemberUpdateRequest>
for MemberUpdateSvc<T> {
type Response = super::MemberUpdateResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MemberUpdateRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Cluster>::member_update(&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 = MemberUpdateSvc(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)
}
"/etcdserverpb.Cluster/MemberList" => {
#[allow(non_camel_case_types)]
struct MemberListSvc<T: Cluster>(pub Arc<T>);
impl<
T: Cluster,
> tonic::server::UnaryService<super::MemberListRequest>
for MemberListSvc<T> {
type Response = super::MemberListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MemberListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Cluster>::member_list(&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 = MemberListSvc(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)
}
"/etcdserverpb.Cluster/MemberPromote" => {
#[allow(non_camel_case_types)]
struct MemberPromoteSvc<T: Cluster>(pub Arc<T>);
impl<
T: Cluster,
> tonic::server::UnaryService<super::MemberPromoteRequest>
for MemberPromoteSvc<T> {
type Response = super::MemberPromoteResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MemberPromoteRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Cluster>::member_promote(&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 = MemberPromoteSvc(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 ClusterServer<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,
}
}
}
pub const SERVICE_NAME: &str = "etcdserverpb.Cluster";
impl<T> tonic::server::NamedService for ClusterServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod maintenance_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 MaintenanceClient<T> {
inner: tonic::client::Grpc<T>,
}
impl MaintenanceClient<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> MaintenanceClient<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,
) -> MaintenanceClient<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,
{
MaintenanceClient::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 alarm(
&mut self,
request: impl tonic::IntoRequest<super::AlarmRequest>,
) -> std::result::Result<tonic::Response<super::AlarmResponse>, 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(
"/etcdserverpb.Maintenance/Alarm",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Maintenance", "Alarm"));
self.inner.unary(req, path, codec).await
}
pub async fn status(
&mut self,
request: impl tonic::IntoRequest<super::StatusRequest>,
) -> std::result::Result<tonic::Response<super::StatusResponse>, 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(
"/etcdserverpb.Maintenance/Status",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Maintenance", "Status"));
self.inner.unary(req, path, codec).await
}
pub async fn defragment(
&mut self,
request: impl tonic::IntoRequest<super::DefragmentRequest>,
) -> std::result::Result<
tonic::Response<super::DefragmentResponse>,
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(
"/etcdserverpb.Maintenance/Defragment",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Maintenance", "Defragment"));
self.inner.unary(req, path, codec).await
}
pub async fn hash(
&mut self,
request: impl tonic::IntoRequest<super::HashRequest>,
) -> std::result::Result<tonic::Response<super::HashResponse>, 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(
"/etcdserverpb.Maintenance/Hash",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Maintenance", "Hash"));
self.inner.unary(req, path, codec).await
}
pub async fn hash_kv(
&mut self,
request: impl tonic::IntoRequest<super::HashKvRequest>,
) -> std::result::Result<tonic::Response<super::HashKvResponse>, 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(
"/etcdserverpb.Maintenance/HashKV",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Maintenance", "HashKV"));
self.inner.unary(req, path, codec).await
}
pub async fn snapshot(
&mut self,
request: impl tonic::IntoRequest<super::SnapshotRequest>,
) -> std::result::Result<
tonic::Response<tonic::codec::Streaming<super::SnapshotResponse>>,
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(
"/etcdserverpb.Maintenance/Snapshot",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Maintenance", "Snapshot"));
self.inner.server_streaming(req, path, codec).await
}
pub async fn move_leader(
&mut self,
request: impl tonic::IntoRequest<super::MoveLeaderRequest>,
) -> std::result::Result<
tonic::Response<super::MoveLeaderResponse>,
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(
"/etcdserverpb.Maintenance/MoveLeader",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Maintenance", "MoveLeader"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod maintenance_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Maintenance: std::marker::Send + std::marker::Sync + 'static {
async fn alarm(
&self,
request: tonic::Request<super::AlarmRequest>,
) -> std::result::Result<tonic::Response<super::AlarmResponse>, tonic::Status>;
async fn status(
&self,
request: tonic::Request<super::StatusRequest>,
) -> std::result::Result<tonic::Response<super::StatusResponse>, tonic::Status>;
async fn defragment(
&self,
request: tonic::Request<super::DefragmentRequest>,
) -> std::result::Result<
tonic::Response<super::DefragmentResponse>,
tonic::Status,
>;
async fn hash(
&self,
request: tonic::Request<super::HashRequest>,
) -> std::result::Result<tonic::Response<super::HashResponse>, tonic::Status>;
async fn hash_kv(
&self,
request: tonic::Request<super::HashKvRequest>,
) -> std::result::Result<tonic::Response<super::HashKvResponse>, tonic::Status>;
type SnapshotStream: tonic::codegen::tokio_stream::Stream<
Item = std::result::Result<super::SnapshotResponse, tonic::Status>,
>
+ std::marker::Send
+ 'static;
async fn snapshot(
&self,
request: tonic::Request<super::SnapshotRequest>,
) -> std::result::Result<tonic::Response<Self::SnapshotStream>, tonic::Status>;
async fn move_leader(
&self,
request: tonic::Request<super::MoveLeaderRequest>,
) -> std::result::Result<
tonic::Response<super::MoveLeaderResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct MaintenanceServer<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> MaintenanceServer<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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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 MaintenanceServer<T>
where
T: Maintenance,
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() {
"/etcdserverpb.Maintenance/Alarm" => {
#[allow(non_camel_case_types)]
struct AlarmSvc<T: Maintenance>(pub Arc<T>);
impl<T: Maintenance> tonic::server::UnaryService<super::AlarmRequest>
for AlarmSvc<T> {
type Response = super::AlarmResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AlarmRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Maintenance>::alarm(&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 = AlarmSvc(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)
}
"/etcdserverpb.Maintenance/Status" => {
#[allow(non_camel_case_types)]
struct StatusSvc<T: Maintenance>(pub Arc<T>);
impl<
T: Maintenance,
> tonic::server::UnaryService<super::StatusRequest>
for StatusSvc<T> {
type Response = super::StatusResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::StatusRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Maintenance>::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 = StatusSvc(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)
}
"/etcdserverpb.Maintenance/Defragment" => {
#[allow(non_camel_case_types)]
struct DefragmentSvc<T: Maintenance>(pub Arc<T>);
impl<
T: Maintenance,
> tonic::server::UnaryService<super::DefragmentRequest>
for DefragmentSvc<T> {
type Response = super::DefragmentResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::DefragmentRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Maintenance>::defragment(&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 = DefragmentSvc(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)
}
"/etcdserverpb.Maintenance/Hash" => {
#[allow(non_camel_case_types)]
struct HashSvc<T: Maintenance>(pub Arc<T>);
impl<T: Maintenance> tonic::server::UnaryService<super::HashRequest>
for HashSvc<T> {
type Response = super::HashResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::HashRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Maintenance>::hash(&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 = HashSvc(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)
}
"/etcdserverpb.Maintenance/HashKV" => {
#[allow(non_camel_case_types)]
struct HashKVSvc<T: Maintenance>(pub Arc<T>);
impl<
T: Maintenance,
> tonic::server::UnaryService<super::HashKvRequest>
for HashKVSvc<T> {
type Response = super::HashKvResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::HashKvRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Maintenance>::hash_kv(&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 = HashKVSvc(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)
}
"/etcdserverpb.Maintenance/Snapshot" => {
#[allow(non_camel_case_types)]
struct SnapshotSvc<T: Maintenance>(pub Arc<T>);
impl<
T: Maintenance,
> tonic::server::ServerStreamingService<super::SnapshotRequest>
for SnapshotSvc<T> {
type Response = super::SnapshotResponse;
type ResponseStream = T::SnapshotStream;
type Future = BoxFuture<
tonic::Response<Self::ResponseStream>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::SnapshotRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Maintenance>::snapshot(&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 = SnapshotSvc(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.server_streaming(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/etcdserverpb.Maintenance/MoveLeader" => {
#[allow(non_camel_case_types)]
struct MoveLeaderSvc<T: Maintenance>(pub Arc<T>);
impl<
T: Maintenance,
> tonic::server::UnaryService<super::MoveLeaderRequest>
for MoveLeaderSvc<T> {
type Response = super::MoveLeaderResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::MoveLeaderRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Maintenance>::move_leader(&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 = MoveLeaderSvc(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 MaintenanceServer<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,
}
}
}
pub const SERVICE_NAME: &str = "etcdserverpb.Maintenance";
impl<T> tonic::server::NamedService for MaintenanceServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
pub mod auth_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 AuthClient<T> {
inner: tonic::client::Grpc<T>,
}
impl AuthClient<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> AuthClient<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,
) -> AuthClient<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,
{
AuthClient::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 auth_enable(
&mut self,
request: impl tonic::IntoRequest<super::AuthEnableRequest>,
) -> std::result::Result<
tonic::Response<super::AuthEnableResponse>,
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(
"/etcdserverpb.Auth/AuthEnable",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Auth", "AuthEnable"));
self.inner.unary(req, path, codec).await
}
pub async fn auth_disable(
&mut self,
request: impl tonic::IntoRequest<super::AuthDisableRequest>,
) -> std::result::Result<
tonic::Response<super::AuthDisableResponse>,
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(
"/etcdserverpb.Auth/AuthDisable",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Auth", "AuthDisable"));
self.inner.unary(req, path, codec).await
}
pub async fn authenticate(
&mut self,
request: impl tonic::IntoRequest<super::AuthenticateRequest>,
) -> std::result::Result<
tonic::Response<super::AuthenticateResponse>,
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(
"/etcdserverpb.Auth/Authenticate",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Auth", "Authenticate"));
self.inner.unary(req, path, codec).await
}
pub async fn user_add(
&mut self,
request: impl tonic::IntoRequest<super::AuthUserAddRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserAddResponse>,
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(
"/etcdserverpb.Auth/UserAdd",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("etcdserverpb.Auth", "UserAdd"));
self.inner.unary(req, path, codec).await
}
pub async fn user_get(
&mut self,
request: impl tonic::IntoRequest<super::AuthUserGetRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserGetResponse>,
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(
"/etcdserverpb.Auth/UserGet",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("etcdserverpb.Auth", "UserGet"));
self.inner.unary(req, path, codec).await
}
pub async fn user_list(
&mut self,
request: impl tonic::IntoRequest<super::AuthUserListRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserListResponse>,
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(
"/etcdserverpb.Auth/UserList",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Auth", "UserList"));
self.inner.unary(req, path, codec).await
}
pub async fn user_delete(
&mut self,
request: impl tonic::IntoRequest<super::AuthUserDeleteRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserDeleteResponse>,
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(
"/etcdserverpb.Auth/UserDelete",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Auth", "UserDelete"));
self.inner.unary(req, path, codec).await
}
pub async fn user_change_password(
&mut self,
request: impl tonic::IntoRequest<super::AuthUserChangePasswordRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserChangePasswordResponse>,
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(
"/etcdserverpb.Auth/UserChangePassword",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Auth", "UserChangePassword"));
self.inner.unary(req, path, codec).await
}
pub async fn user_grant_role(
&mut self,
request: impl tonic::IntoRequest<super::AuthUserGrantRoleRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserGrantRoleResponse>,
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(
"/etcdserverpb.Auth/UserGrantRole",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Auth", "UserGrantRole"));
self.inner.unary(req, path, codec).await
}
pub async fn user_revoke_role(
&mut self,
request: impl tonic::IntoRequest<super::AuthUserRevokeRoleRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserRevokeRoleResponse>,
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(
"/etcdserverpb.Auth/UserRevokeRole",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Auth", "UserRevokeRole"));
self.inner.unary(req, path, codec).await
}
pub async fn role_add(
&mut self,
request: impl tonic::IntoRequest<super::AuthRoleAddRequest>,
) -> std::result::Result<
tonic::Response<super::AuthRoleAddResponse>,
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(
"/etcdserverpb.Auth/RoleAdd",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("etcdserverpb.Auth", "RoleAdd"));
self.inner.unary(req, path, codec).await
}
pub async fn role_get(
&mut self,
request: impl tonic::IntoRequest<super::AuthRoleGetRequest>,
) -> std::result::Result<
tonic::Response<super::AuthRoleGetResponse>,
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(
"/etcdserverpb.Auth/RoleGet",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("etcdserverpb.Auth", "RoleGet"));
self.inner.unary(req, path, codec).await
}
pub async fn role_list(
&mut self,
request: impl tonic::IntoRequest<super::AuthRoleListRequest>,
) -> std::result::Result<
tonic::Response<super::AuthRoleListResponse>,
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(
"/etcdserverpb.Auth/RoleList",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Auth", "RoleList"));
self.inner.unary(req, path, codec).await
}
pub async fn role_delete(
&mut self,
request: impl tonic::IntoRequest<super::AuthRoleDeleteRequest>,
) -> std::result::Result<
tonic::Response<super::AuthRoleDeleteResponse>,
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(
"/etcdserverpb.Auth/RoleDelete",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Auth", "RoleDelete"));
self.inner.unary(req, path, codec).await
}
pub async fn role_grant_permission(
&mut self,
request: impl tonic::IntoRequest<super::AuthRoleGrantPermissionRequest>,
) -> std::result::Result<
tonic::Response<super::AuthRoleGrantPermissionResponse>,
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(
"/etcdserverpb.Auth/RoleGrantPermission",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Auth", "RoleGrantPermission"));
self.inner.unary(req, path, codec).await
}
pub async fn role_revoke_permission(
&mut self,
request: impl tonic::IntoRequest<super::AuthRoleRevokePermissionRequest>,
) -> std::result::Result<
tonic::Response<super::AuthRoleRevokePermissionResponse>,
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(
"/etcdserverpb.Auth/RoleRevokePermission",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("etcdserverpb.Auth", "RoleRevokePermission"));
self.inner.unary(req, path, codec).await
}
}
}
pub mod auth_server {
#![allow(
unused_variables,
dead_code,
missing_docs,
clippy::wildcard_imports,
clippy::let_unit_value,
)]
use tonic::codegen::*;
#[async_trait]
pub trait Auth: std::marker::Send + std::marker::Sync + 'static {
async fn auth_enable(
&self,
request: tonic::Request<super::AuthEnableRequest>,
) -> std::result::Result<
tonic::Response<super::AuthEnableResponse>,
tonic::Status,
>;
async fn auth_disable(
&self,
request: tonic::Request<super::AuthDisableRequest>,
) -> std::result::Result<
tonic::Response<super::AuthDisableResponse>,
tonic::Status,
>;
async fn authenticate(
&self,
request: tonic::Request<super::AuthenticateRequest>,
) -> std::result::Result<
tonic::Response<super::AuthenticateResponse>,
tonic::Status,
>;
async fn user_add(
&self,
request: tonic::Request<super::AuthUserAddRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserAddResponse>,
tonic::Status,
>;
async fn user_get(
&self,
request: tonic::Request<super::AuthUserGetRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserGetResponse>,
tonic::Status,
>;
async fn user_list(
&self,
request: tonic::Request<super::AuthUserListRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserListResponse>,
tonic::Status,
>;
async fn user_delete(
&self,
request: tonic::Request<super::AuthUserDeleteRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserDeleteResponse>,
tonic::Status,
>;
async fn user_change_password(
&self,
request: tonic::Request<super::AuthUserChangePasswordRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserChangePasswordResponse>,
tonic::Status,
>;
async fn user_grant_role(
&self,
request: tonic::Request<super::AuthUserGrantRoleRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserGrantRoleResponse>,
tonic::Status,
>;
async fn user_revoke_role(
&self,
request: tonic::Request<super::AuthUserRevokeRoleRequest>,
) -> std::result::Result<
tonic::Response<super::AuthUserRevokeRoleResponse>,
tonic::Status,
>;
async fn role_add(
&self,
request: tonic::Request<super::AuthRoleAddRequest>,
) -> std::result::Result<
tonic::Response<super::AuthRoleAddResponse>,
tonic::Status,
>;
async fn role_get(
&self,
request: tonic::Request<super::AuthRoleGetRequest>,
) -> std::result::Result<
tonic::Response<super::AuthRoleGetResponse>,
tonic::Status,
>;
async fn role_list(
&self,
request: tonic::Request<super::AuthRoleListRequest>,
) -> std::result::Result<
tonic::Response<super::AuthRoleListResponse>,
tonic::Status,
>;
async fn role_delete(
&self,
request: tonic::Request<super::AuthRoleDeleteRequest>,
) -> std::result::Result<
tonic::Response<super::AuthRoleDeleteResponse>,
tonic::Status,
>;
async fn role_grant_permission(
&self,
request: tonic::Request<super::AuthRoleGrantPermissionRequest>,
) -> std::result::Result<
tonic::Response<super::AuthRoleGrantPermissionResponse>,
tonic::Status,
>;
async fn role_revoke_permission(
&self,
request: tonic::Request<super::AuthRoleRevokePermissionRequest>,
) -> std::result::Result<
tonic::Response<super::AuthRoleRevokePermissionResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct AuthServer<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> AuthServer<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)
}
#[must_use]
pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.accept_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
self.send_compression_encodings.enable(encoding);
self
}
#[must_use]
pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
self.max_decoding_message_size = Some(limit);
self
}
#[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 AuthServer<T>
where
T: Auth,
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() {
"/etcdserverpb.Auth/AuthEnable" => {
#[allow(non_camel_case_types)]
struct AuthEnableSvc<T: Auth>(pub Arc<T>);
impl<T: Auth> tonic::server::UnaryService<super::AuthEnableRequest>
for AuthEnableSvc<T> {
type Response = super::AuthEnableResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthEnableRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::auth_enable(&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 = AuthEnableSvc(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)
}
"/etcdserverpb.Auth/AuthDisable" => {
#[allow(non_camel_case_types)]
struct AuthDisableSvc<T: Auth>(pub Arc<T>);
impl<T: Auth> tonic::server::UnaryService<super::AuthDisableRequest>
for AuthDisableSvc<T> {
type Response = super::AuthDisableResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthDisableRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::auth_disable(&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 = AuthDisableSvc(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)
}
"/etcdserverpb.Auth/Authenticate" => {
#[allow(non_camel_case_types)]
struct AuthenticateSvc<T: Auth>(pub Arc<T>);
impl<T: Auth> tonic::server::UnaryService<super::AuthenticateRequest>
for AuthenticateSvc<T> {
type Response = super::AuthenticateResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthenticateRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::authenticate(&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 = AuthenticateSvc(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)
}
"/etcdserverpb.Auth/UserAdd" => {
#[allow(non_camel_case_types)]
struct UserAddSvc<T: Auth>(pub Arc<T>);
impl<T: Auth> tonic::server::UnaryService<super::AuthUserAddRequest>
for UserAddSvc<T> {
type Response = super::AuthUserAddResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthUserAddRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::user_add(&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 = UserAddSvc(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)
}
"/etcdserverpb.Auth/UserGet" => {
#[allow(non_camel_case_types)]
struct UserGetSvc<T: Auth>(pub Arc<T>);
impl<T: Auth> tonic::server::UnaryService<super::AuthUserGetRequest>
for UserGetSvc<T> {
type Response = super::AuthUserGetResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthUserGetRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::user_get(&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 = UserGetSvc(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)
}
"/etcdserverpb.Auth/UserList" => {
#[allow(non_camel_case_types)]
struct UserListSvc<T: Auth>(pub Arc<T>);
impl<T: Auth> tonic::server::UnaryService<super::AuthUserListRequest>
for UserListSvc<T> {
type Response = super::AuthUserListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthUserListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::user_list(&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 = UserListSvc(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)
}
"/etcdserverpb.Auth/UserDelete" => {
#[allow(non_camel_case_types)]
struct UserDeleteSvc<T: Auth>(pub Arc<T>);
impl<
T: Auth,
> tonic::server::UnaryService<super::AuthUserDeleteRequest>
for UserDeleteSvc<T> {
type Response = super::AuthUserDeleteResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthUserDeleteRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::user_delete(&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 = UserDeleteSvc(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)
}
"/etcdserverpb.Auth/UserChangePassword" => {
#[allow(non_camel_case_types)]
struct UserChangePasswordSvc<T: Auth>(pub Arc<T>);
impl<
T: Auth,
> tonic::server::UnaryService<super::AuthUserChangePasswordRequest>
for UserChangePasswordSvc<T> {
type Response = super::AuthUserChangePasswordResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthUserChangePasswordRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::user_change_password(&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 = UserChangePasswordSvc(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)
}
"/etcdserverpb.Auth/UserGrantRole" => {
#[allow(non_camel_case_types)]
struct UserGrantRoleSvc<T: Auth>(pub Arc<T>);
impl<
T: Auth,
> tonic::server::UnaryService<super::AuthUserGrantRoleRequest>
for UserGrantRoleSvc<T> {
type Response = super::AuthUserGrantRoleResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthUserGrantRoleRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::user_grant_role(&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 = UserGrantRoleSvc(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)
}
"/etcdserverpb.Auth/UserRevokeRole" => {
#[allow(non_camel_case_types)]
struct UserRevokeRoleSvc<T: Auth>(pub Arc<T>);
impl<
T: Auth,
> tonic::server::UnaryService<super::AuthUserRevokeRoleRequest>
for UserRevokeRoleSvc<T> {
type Response = super::AuthUserRevokeRoleResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthUserRevokeRoleRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::user_revoke_role(&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 = UserRevokeRoleSvc(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)
}
"/etcdserverpb.Auth/RoleAdd" => {
#[allow(non_camel_case_types)]
struct RoleAddSvc<T: Auth>(pub Arc<T>);
impl<T: Auth> tonic::server::UnaryService<super::AuthRoleAddRequest>
for RoleAddSvc<T> {
type Response = super::AuthRoleAddResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthRoleAddRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::role_add(&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 = RoleAddSvc(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)
}
"/etcdserverpb.Auth/RoleGet" => {
#[allow(non_camel_case_types)]
struct RoleGetSvc<T: Auth>(pub Arc<T>);
impl<T: Auth> tonic::server::UnaryService<super::AuthRoleGetRequest>
for RoleGetSvc<T> {
type Response = super::AuthRoleGetResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthRoleGetRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::role_get(&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 = RoleGetSvc(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)
}
"/etcdserverpb.Auth/RoleList" => {
#[allow(non_camel_case_types)]
struct RoleListSvc<T: Auth>(pub Arc<T>);
impl<T: Auth> tonic::server::UnaryService<super::AuthRoleListRequest>
for RoleListSvc<T> {
type Response = super::AuthRoleListResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthRoleListRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::role_list(&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 = RoleListSvc(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)
}
"/etcdserverpb.Auth/RoleDelete" => {
#[allow(non_camel_case_types)]
struct RoleDeleteSvc<T: Auth>(pub Arc<T>);
impl<
T: Auth,
> tonic::server::UnaryService<super::AuthRoleDeleteRequest>
for RoleDeleteSvc<T> {
type Response = super::AuthRoleDeleteResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::AuthRoleDeleteRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::role_delete(&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 = RoleDeleteSvc(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)
}
"/etcdserverpb.Auth/RoleGrantPermission" => {
#[allow(non_camel_case_types)]
struct RoleGrantPermissionSvc<T: Auth>(pub Arc<T>);
impl<
T: Auth,
> tonic::server::UnaryService<super::AuthRoleGrantPermissionRequest>
for RoleGrantPermissionSvc<T> {
type Response = super::AuthRoleGrantPermissionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::AuthRoleGrantPermissionRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::role_grant_permission(&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 = RoleGrantPermissionSvc(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)
}
"/etcdserverpb.Auth/RoleRevokePermission" => {
#[allow(non_camel_case_types)]
struct RoleRevokePermissionSvc<T: Auth>(pub Arc<T>);
impl<
T: Auth,
> tonic::server::UnaryService<super::AuthRoleRevokePermissionRequest>
for RoleRevokePermissionSvc<T> {
type Response = super::AuthRoleRevokePermissionResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::AuthRoleRevokePermissionRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Auth>::role_revoke_permission(&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 = RoleRevokePermissionSvc(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 AuthServer<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,
}
}
}
pub const SERVICE_NAME: &str = "etcdserverpb.Auth";
impl<T> tonic::server::NamedService for AuthServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}