Struct gapi_grpc::google::bytestream::byte_stream_client::ByteStreamClient [−][src]
Introduction
The Byte Stream API enables a client to read and write a stream of bytes to and from a resource. Resources have names, and these names are supplied in the API calls below to identify the resource that is being read from or written to.
All implementations of the Byte Stream API export the interface defined here:
-
Read()
: Reads the contents of a resource. -
Write()
: Writes the contents of a resource. The client can callWrite()
multiple times with the same resource and can check the status of the write by callingQueryWriteStatus()
.
Service parameters and metadata
The ByteStream API provides no direct way to access/modify any metadata associated with the resource.
Errors
The errors returned by the service are in the Google canonical error space.
Implementations
impl ByteStreamClient<Channel>
[src]
pub async fn connect<D>(dst: D) -> Result<Self, Error> where
D: TryInto<Endpoint>,
D::Error: Into<StdError>,
[src]
D: TryInto<Endpoint>,
D::Error: Into<StdError>,
Attempt to create a new client by connecting to a given endpoint.
impl<T> ByteStreamClient<T> where
T: GrpcService<BoxBody>,
T::ResponseBody: Body + HttpBody + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as HttpBody>::Error: Into<StdError> + Send,
[src]
T: GrpcService<BoxBody>,
T::ResponseBody: Body + HttpBody + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as HttpBody>::Error: Into<StdError> + Send,
pub fn new(inner: T) -> Self
[src]
pub fn with_interceptor(inner: T, interceptor: impl Into<Interceptor>) -> Self
[src]
pub async fn read(
&mut self,
request: impl IntoRequest<ReadRequest>
) -> Result<Response<Streaming<ReadResponse>>, Status>
[src]
&mut self,
request: impl IntoRequest<ReadRequest>
) -> Result<Response<Streaming<ReadResponse>>, Status>
Read()
is used to retrieve the contents of a resource as a sequence
of bytes. The bytes are returned in a sequence of responses, and the
responses are delivered as the results of a server-side streaming RPC.
pub async fn write(
&mut self,
request: impl IntoStreamingRequest<Message = WriteRequest>
) -> Result<Response<WriteResponse>, Status>
[src]
&mut self,
request: impl IntoStreamingRequest<Message = WriteRequest>
) -> Result<Response<WriteResponse>, Status>
Write()
is used to send the contents of a resource as a sequence of
bytes. The bytes are sent in a sequence of request protos of a client-side
streaming RPC.
A Write()
action is resumable. If there is an error or the connection is
broken during the Write()
, the client should check the status of the
Write()
by calling QueryWriteStatus()
and continue writing from the
returned committed_size
. This may be less than the amount of data the
client previously sent.
Calling Write()
on a resource name that was previously written and
finalized could cause an error, depending on whether the underlying service
allows over-writing of previously written resources.
When the client closes the request channel, the service will respond with
a WriteResponse
. The service will not view the resource as complete
until the client has sent a WriteRequest
with finish_write
set to
true
. Sending any requests on a stream after sending a request with
finish_write
set to true
will cause an error. The client should
check the WriteResponse
it receives to determine how much data the
service was able to commit and whether the service views the resource as
complete
or not.
pub async fn query_write_status(
&mut self,
request: impl IntoRequest<QueryWriteStatusRequest>
) -> Result<Response<QueryWriteStatusResponse>, Status>
[src]
&mut self,
request: impl IntoRequest<QueryWriteStatusRequest>
) -> Result<Response<QueryWriteStatusResponse>, Status>
QueryWriteStatus()
is used to find the committed_size
for a resource
that is being written, which can then be used as the write_offset
for
the next Write()
call.
If the resource does not exist (i.e., the resource has been deleted, or the
first Write()
has not yet reached the service), this method returns the
error NOT_FOUND
.
The client may call QueryWriteStatus()
at any time to determine how
much data has been processed for this resource. This is useful if the
client is buffering data and needs to know which data can be safely
evicted. For any sequence of QueryWriteStatus()
calls for a given
resource name, the sequence of returned committed_size
values will be
non-decreasing.
Trait Implementations
impl<T: Clone> Clone for ByteStreamClient<T>
[src]
fn clone(&self) -> Self
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<T> Debug for ByteStreamClient<T>
[src]
Auto Trait Implementations
impl<T> !RefUnwindSafe for ByteStreamClient<T>
impl<T> Send for ByteStreamClient<T> where
T: Send,
T: Send,
impl<T> Sync for ByteStreamClient<T> where
T: Sync,
T: Sync,
impl<T> Unpin for ByteStreamClient<T> where
T: Unpin,
T: Unpin,
impl<T> !UnwindSafe for ByteStreamClient<T>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> IntoRequest<T> for T
[src]
pub fn into_request(self) -> Request<T>
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,
impl<T> WithSubscriber for T
[src]
pub fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
[src]
S: Into<Dispatch>,