nominal-api 0.1236.0

API bindings for the Nominal platform
Documentation
// This file is @generated by prost-build.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Namespace {
    #[prost(string, repeated, tag = "1")]
    pub levels: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TableName {
    #[prost(string, tag = "1")]
    pub name: ::prost::alloc::string::String,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct TableTarget {
    #[prost(message, optional, tag = "1")]
    pub namespace: ::core::option::Option<Namespace>,
    #[prost(message, optional, tag = "2")]
    pub table_name: ::core::option::Option<TableName>,
}
/// State of a per-table compaction run.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompactionRun {
    #[prost(message, optional, tag = "1")]
    pub target: ::core::option::Option<TableTarget>,
    #[prost(enumeration = "CompactionStatus", tag = "2")]
    pub status: i32,
    /// Set once the workflow has started executing.
    #[prost(message, optional, tag = "3")]
    pub started_at: ::core::option::Option<
        super::super::super::google::protobuf::Timestamp,
    >,
    /// Set on terminal states (succeeded, failed).
    #[prost(message, optional, tag = "4")]
    pub finished_at: ::core::option::Option<
        super::super::super::google::protobuf::Timestamp,
    >,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CompactTableRequest {
    #[prost(message, optional, tag = "1")]
    pub target: ::core::option::Option<TableTarget>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct CompactTableResponse {}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCompactionRunRequest {
    #[prost(message, optional, tag = "1")]
    pub target: ::core::option::Option<TableTarget>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetCompactionRunResponse {
    #[prost(message, optional, tag = "1")]
    pub run: ::core::option::Option<CompactionRun>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CompactionStatus {
    Unspecified = 0,
    Pending = 1,
    Running = 2,
    Succeeded = 3,
    Failed = 4,
    NotFound = 5,
}
impl CompactionStatus {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "COMPACTION_STATUS_UNSPECIFIED",
            Self::Pending => "COMPACTION_STATUS_PENDING",
            Self::Running => "COMPACTION_STATUS_RUNNING",
            Self::Succeeded => "COMPACTION_STATUS_SUCCEEDED",
            Self::Failed => "COMPACTION_STATUS_FAILED",
            Self::NotFound => "COMPACTION_STATUS_NOT_FOUND",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "COMPACTION_STATUS_UNSPECIFIED" => Some(Self::Unspecified),
            "COMPACTION_STATUS_PENDING" => Some(Self::Pending),
            "COMPACTION_STATUS_RUNNING" => Some(Self::Running),
            "COMPACTION_STATUS_SUCCEEDED" => Some(Self::Succeeded),
            "COMPACTION_STATUS_FAILED" => Some(Self::Failed),
            "COMPACTION_STATUS_NOT_FOUND" => Some(Self::NotFound),
            _ => None,
        }
    }
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum CompactionErrors {
    Unspecified = 0,
    TableNotFound = 1,
}
impl CompactionErrors {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "COMPACTION_ERRORS_UNSPECIFIED",
            Self::TableNotFound => "COMPACTION_ERRORS_TABLE_NOT_FOUND",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "COMPACTION_ERRORS_UNSPECIFIED" => Some(Self::Unspecified),
            "COMPACTION_ERRORS_TABLE_NOT_FOUND" => Some(Self::TableNotFound),
            _ => None,
        }
    }
}
/// Generated client implementations.
pub mod iceberg_compaction_service_client {
    #![allow(
        unused_variables,
        dead_code,
        missing_docs,
        clippy::wildcard_imports,
        clippy::let_unit_value,
    )]
    use tonic::codegen::*;
    use tonic::codegen::http::Uri;
    /// Service for programmatically starting and monitoring Iceberg compaction jobs.
    #[derive(Debug, Clone)]
    pub struct IcebergCompactionServiceClient<T> {
        inner: tonic::client::Grpc<T>,
    }
    impl IcebergCompactionServiceClient<tonic::transport::Channel> {
        /// 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: TryInto<tonic::transport::Endpoint>,
            D::Error: Into<StdError>,
        {
            let conn = tonic::transport::Endpoint::new(dst)?.connect().await?;
            Ok(Self::new(conn))
        }
    }
    impl<T> IcebergCompactionServiceClient<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,
        ) -> IcebergCompactionServiceClient<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,
        {
            IcebergCompactionServiceClient::new(
                InterceptedService::new(inner, interceptor),
            )
        }
        /// Compress requests with the given encoding.
        ///
        /// This requires the server to support it otherwise it might respond with an
        /// error.
        #[must_use]
        pub fn send_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.send_compressed(encoding);
            self
        }
        /// Enable decompressing responses.
        #[must_use]
        pub fn accept_compressed(mut self, encoding: CompressionEncoding) -> Self {
            self.inner = self.inner.accept_compressed(encoding);
            self
        }
        /// Limits the maximum size of a decoded message.
        ///
        /// Default: `4MB`
        #[must_use]
        pub fn max_decoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_decoding_message_size(limit);
            self
        }
        /// Limits the maximum size of an encoded message.
        ///
        /// Default: `usize::MAX`
        #[must_use]
        pub fn max_encoding_message_size(mut self, limit: usize) -> Self {
            self.inner = self.inner.max_encoding_message_size(limit);
            self
        }
        /// Kick off a compaction for a specific Iceberg table. Idempotent: if a
        /// compaction is already running for the target, no new workflow is started.
        pub async fn compact_table(
            &mut self,
            request: impl tonic::IntoRequest<super::CompactTableRequest>,
        ) -> std::result::Result<
            tonic::Response<super::CompactTableResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.iceberg.v1.IcebergCompactionService/CompactTable",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.iceberg.v1.IcebergCompactionService",
                        "CompactTable",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
        /// Look up the current state of a compaction run for a target. Returns
        /// a run with status COMPACTION_STATUS_NOT_FOUND if no workflow is on
        /// record for the target.
        pub async fn get_compaction_run(
            &mut self,
            request: impl tonic::IntoRequest<super::GetCompactionRunRequest>,
        ) -> std::result::Result<
            tonic::Response<super::GetCompactionRunResponse>,
            tonic::Status,
        > {
            self.inner
                .ready()
                .await
                .map_err(|e| {
                    tonic::Status::unknown(
                        format!("Service was not ready: {}", e.into()),
                    )
                })?;
            let codec = tonic::codec::ProstCodec::default();
            let path = http::uri::PathAndQuery::from_static(
                "/nominal.iceberg.v1.IcebergCompactionService/GetCompactionRun",
            );
            let mut req = request.into_request();
            req.extensions_mut()
                .insert(
                    GrpcMethod::new(
                        "nominal.iceberg.v1.IcebergCompactionService",
                        "GetCompactionRun",
                    ),
                );
            self.inner.unary(req, path, codec).await
        }
    }
}