pub struct RpcSpec {
pub path: &'static str,
pub service: &'static str,
pub service_full: &'static str,
pub method: &'static str,
pub alias: &'static str,
pub operation_kind: &'static str,
pub read_only: bool,
pub replay_safe: bool,
pub client_streaming: bool,
pub server_streaming: bool,
pub http_method: &'static str,
pub http_path: &'static str,
}Expand description
One RPC, as the contract declares it.
Fields§
§path: &'static strFull gRPC method path, e.g. /udb.services.v1.DataBroker/Select.
service: &'static strService short name, e.g. DataBroker.
service_full: &'static strFully-qualified service name, e.g. udb.services.v1.DataBroker.
method: &'static strMethod name as it appears on the wire, e.g. Select.
alias: &'static strSnake-case alias used by the SDK surfaces.
operation_kind: &'static strDeclared operation kind: read_only, mutation, or destructive.
read_only: boolTrue when the RPC performs no mutation.
replay_safe: boolTrue when the contract EXPLICITLY declares this mutation replayable
(idempotency_contract). false also means “no contract declared”, which
is why most read-only RPCs report false here. Do not read this alone
before retrying — call RpcSpec::retry_safe.
client_streaming: bool§server_streaming: bool§http_method: &'static strREST verb and path from the google.api.http annotation, when annotated.
http_path: &'static strImplementations§
Source§impl RpcSpec
impl RpcSpec
Sourcepub fn is_streaming(&self) -> bool
pub fn is_streaming(&self) -> bool
Whether this RPC streams in either direction.
Sourcepub fn retry_safe(&self) -> bool
pub fn retry_safe(&self) -> bool
Whether repeating this call is safe.
TWO independent facts, and both matter:
read_onlycomes fromoperation_kind. A read applies no mutation, so repeating it is safe regardless of what else is declared.replay_safecomes from an OPTIONALidempotency_contract, and isfalsewhen that contract is simply absent. It marks the handful of MUTATIONS the broker guarantees are replayable.
Reading replay_safe alone would therefore treat “no contract declared”
as “unsafe” and refuse to retry any read — the overwhelming majority of
the surface. Consult this, not either field on its own.
Trait Implementations§
impl Copy for RpcSpec
impl Eq for RpcSpec
impl StructuralPartialEq for RpcSpec
Auto Trait Implementations§
impl Freeze for RpcSpec
impl RefUnwindSafe for RpcSpec
impl Send for RpcSpec
impl Sync for RpcSpec
impl Unpin for RpcSpec
impl UnsafeUnpin for RpcSpec
impl UnwindSafe for RpcSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request