#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Info {
#[prost(string, tag = "1")]
pub digest: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub size: i64,
#[prost(message, optional, tag = "3")]
pub created_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "4")]
pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(map = "string, string", tag = "5")]
pub labels:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InfoRequest {
#[prost(string, tag = "1")]
pub digest: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct InfoResponse {
#[prost(message, optional, tag = "1")]
pub info: ::core::option::Option<Info>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateRequest {
#[prost(message, optional, tag = "1")]
pub info: ::core::option::Option<Info>,
#[prost(message, optional, tag = "2")]
pub update_mask: ::core::option::Option<::prost_types::FieldMask>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct UpdateResponse {
#[prost(message, optional, tag = "1")]
pub info: ::core::option::Option<Info>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListContentRequest {
#[prost(string, repeated, tag = "1")]
pub filters: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListContentResponse {
#[prost(message, repeated, tag = "1")]
pub info: ::prost::alloc::vec::Vec<Info>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct DeleteContentRequest {
#[prost(string, tag = "1")]
pub digest: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadContentRequest {
#[prost(string, tag = "1")]
pub digest: ::prost::alloc::string::String,
#[prost(int64, tag = "2")]
pub offset: i64,
#[prost(int64, tag = "3")]
pub size: i64,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ReadContentResponse {
#[prost(int64, tag = "1")]
pub offset: i64,
#[prost(bytes = "vec", tag = "2")]
pub data: ::prost::alloc::vec::Vec<u8>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Status {
#[prost(message, optional, tag = "1")]
pub started_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "2")]
pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(string, tag = "3")]
pub r#ref: ::prost::alloc::string::String,
#[prost(int64, tag = "4")]
pub offset: i64,
#[prost(int64, tag = "5")]
pub total: i64,
#[prost(string, tag = "6")]
pub expected: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StatusRequest {
#[prost(string, tag = "1")]
pub r#ref: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct StatusResponse {
#[prost(message, optional, tag = "1")]
pub status: ::core::option::Option<Status>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListStatusesRequest {
#[prost(string, repeated, tag = "1")]
pub filters: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListStatusesResponse {
#[prost(message, repeated, tag = "1")]
pub statuses: ::prost::alloc::vec::Vec<Status>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WriteContentRequest {
#[prost(enumeration = "WriteAction", tag = "1")]
pub action: i32,
#[prost(string, tag = "2")]
pub r#ref: ::prost::alloc::string::String,
#[prost(int64, tag = "3")]
pub total: i64,
#[prost(string, tag = "4")]
pub expected: ::prost::alloc::string::String,
#[prost(int64, tag = "5")]
pub offset: i64,
#[prost(bytes = "vec", tag = "6")]
pub data: ::prost::alloc::vec::Vec<u8>,
#[prost(map = "string, string", tag = "7")]
pub labels:
::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct WriteContentResponse {
#[prost(enumeration = "WriteAction", tag = "1")]
pub action: i32,
#[prost(message, optional, tag = "2")]
pub started_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(message, optional, tag = "3")]
pub updated_at: ::core::option::Option<::prost_types::Timestamp>,
#[prost(int64, tag = "4")]
pub offset: i64,
#[prost(int64, tag = "5")]
pub total: i64,
#[prost(string, tag = "6")]
pub digest: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct AbortRequest {
#[prost(string, tag = "1")]
pub r#ref: ::prost::alloc::string::String,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum WriteAction {
Stat = 0,
Write = 1,
Commit = 2,
}
#[doc = r" Generated client implementations."]
pub mod content_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::*;
#[doc = " Content provides access to a content addressable storage system."]
#[derive(Debug, Clone)]
pub struct ContentClient<T> {
inner: tonic::client::Grpc<T>,
}
impl ContentClient<tonic::transport::Channel> {
#[doc = r" Attempt to create a new client by connecting to a given endpoint."]
pub async fn connect<D>(dst: D) -> Result<Self, tonic::transport::Error>
where
D: std::convert::TryInto<tonic::transport::Endpoint>,
D::Error: Into<StdError>,
{
let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
Ok(Self::new(conn))
}
}
impl<T> ContentClient<T>
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::ResponseBody: Body + Send + 'static,
T::Error: Into<StdError>,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Self { inner }
}
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ContentClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T: tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
Response = http::Response<
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
{
ContentClient::new(InterceptedService::new(inner, interceptor))
}
#[doc = r" Compress requests with `gzip`."]
#[doc = r""]
#[doc = r" This requires the server to support it otherwise it might respond with an"]
#[doc = r" error."]
pub fn send_gzip(mut self) -> Self {
self.inner = self.inner.send_gzip();
self
}
#[doc = r" Enable decompressing responses with `gzip`."]
pub fn accept_gzip(mut self) -> Self {
self.inner = self.inner.accept_gzip();
self
}
#[doc = " Info returns information about a committed object."]
#[doc = ""]
#[doc = " This call can be used for getting the size of content and checking for"]
#[doc = " existence."]
pub async fn info(
&mut self,
request: impl tonic::IntoRequest<super::InfoRequest>,
) -> Result<tonic::Response<super::InfoResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/containerd.services.content.v1.Content/Info",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Update updates content metadata."]
#[doc = ""]
#[doc = " This call can be used to manage the mutable content labels. The"]
#[doc = " immutable metadata such as digest, size, and committed at cannot"]
#[doc = " be updated."]
pub async fn update(
&mut self,
request: impl tonic::IntoRequest<super::UpdateRequest>,
) -> Result<tonic::Response<super::UpdateResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/containerd.services.content.v1.Content/Update",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " List streams the entire set of content as Info objects and closes the"]
#[doc = " stream."]
#[doc = ""]
#[doc = " Typically, this will yield a large response, chunked into messages."]
#[doc = " Clients should make provisions to ensure they can handle the entire data"]
#[doc = " set."]
pub async fn list(
&mut self,
request: impl tonic::IntoRequest<super::ListContentRequest>,
) -> Result<
tonic::Response<tonic::codec::Streaming<super::ListContentResponse>>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/containerd.services.content.v1.Content/List",
);
self.inner
.server_streaming(request.into_request(), path, codec)
.await
}
#[doc = " Delete will delete the referenced object."]
pub async fn delete(
&mut self,
request: impl tonic::IntoRequest<super::DeleteContentRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/containerd.services.content.v1.Content/Delete",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Read allows one to read an object based on the offset into the content."]
#[doc = ""]
#[doc = " The requested data may be returned in one or more messages."]
pub async fn read(
&mut self,
request: impl tonic::IntoRequest<super::ReadContentRequest>,
) -> Result<
tonic::Response<tonic::codec::Streaming<super::ReadContentResponse>>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/containerd.services.content.v1.Content/Read",
);
self.inner
.server_streaming(request.into_request(), path, codec)
.await
}
#[doc = " Status returns the status for a single reference."]
pub async fn status(
&mut self,
request: impl tonic::IntoRequest<super::StatusRequest>,
) -> Result<tonic::Response<super::StatusResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/containerd.services.content.v1.Content/Status",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " ListStatuses returns the status of ongoing object ingestions, started via"]
#[doc = " Write."]
#[doc = ""]
#[doc = " Only those matching the regular expression will be provided in the"]
#[doc = " response. If the provided regular expression is empty, all ingestions"]
#[doc = " will be provided."]
pub async fn list_statuses(
&mut self,
request: impl tonic::IntoRequest<super::ListStatusesRequest>,
) -> Result<tonic::Response<super::ListStatusesResponse>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/containerd.services.content.v1.Content/ListStatuses",
);
self.inner.unary(request.into_request(), path, codec).await
}
#[doc = " Write begins or resumes writes to a resource identified by a unique ref."]
#[doc = " Only one active stream may exist at a time for each ref."]
#[doc = ""]
#[doc = " Once a write stream has started, it may only write to a single ref, thus"]
#[doc = " once a stream is started, the ref may be omitted on subsequent writes."]
#[doc = ""]
#[doc = " For any write transaction represented by a ref, only a single write may"]
#[doc = " be made to a given offset. If overlapping writes occur, it is an error."]
#[doc = " Writes should be sequential and implementations may throw an error if"]
#[doc = " this is required."]
#[doc = ""]
#[doc = " If expected_digest is set and already part of the content store, the"]
#[doc = " write will fail."]
#[doc = ""]
#[doc = " When completed, the commit flag should be set to true. If expected size"]
#[doc = " or digest is set, the content will be validated against those values."]
pub async fn write(
&mut self,
request: impl tonic::IntoStreamingRequest<Message = super::WriteContentRequest>,
) -> Result<
tonic::Response<tonic::codec::Streaming<super::WriteContentResponse>>,
tonic::Status,
> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/containerd.services.content.v1.Content/Write",
);
self.inner
.streaming(request.into_streaming_request(), path, codec)
.await
}
#[doc = " Abort cancels the ongoing write named in the request. Any resources"]
#[doc = " associated with the write will be collected."]
pub async fn abort(
&mut self,
request: impl tonic::IntoRequest<super::AbortRequest>,
) -> Result<tonic::Response<()>, tonic::Status> {
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/containerd.services.content.v1.Content/Abort",
);
self.inner.unary(request.into_request(), path, codec).await
}
}
}