Skip to main content

unitycatalog_server/codegen/model_versions/
handler.rs

1// @generated — do not edit by hand.
2//! Handler trait for [`ModelVersionHandler`].
3//!
4//! Implement this trait to provide a custom backend for this service, then mount the
5//! generated handler functions (in the sibling `server` module) onto an `axum::Router`
6//! with your implementation as state.
7//!
8//! # Composability
9//!
10//! A single struct can implement multiple handler traits to serve multiple
11//! services. Use [`axum::Router::merge`] to compose per-service routers together.
12//!
13//! Manage model versions in the service.
14//!
15//! A model version belongs to a registered model and is identified by the model's
16//! three-level name plus a server-assigned integer version. It carries its own
17//! artifact storage location and READY/PENDING lifecycle.
18use crate::Result;
19use async_trait::async_trait;
20use unitycatalog_common::models::model_versions::v1::*;
21#[async_trait]
22pub trait ModelVersionHandler<Cx = crate::api::RequestContext>: Send + Sync + 'static {
23    /// List model versions
24    ///
25    /// List the model versions of the specified registered model. If the caller is
26    /// the metastore admin, all model versions are returned. Otherwise, the caller
27    /// must have the appropriate privileges on the parent model.
28    async fn list_model_versions(
29        &self,
30        request: ListModelVersionsRequest,
31        context: Cx,
32    ) -> Result<ListModelVersionsResponse>;
33    /// Create a model version
34    ///
35    /// Creates a new model version in PENDING_REGISTRATION status. The server
36    /// assigns the version number and a storage location for the artifacts. The
37    /// caller must be a metastore admin or the owner of the parent registered model.
38    async fn create_model_version(
39        &self,
40        request: CreateModelVersionRequest,
41        context: Cx,
42    ) -> Result<ModelVersion>;
43    /// Get a model version
44    ///
45    /// Gets a model version by its parent model name and version number.
46    async fn get_model_version(
47        &self,
48        request: GetModelVersionRequest,
49        context: Cx,
50    ) -> Result<ModelVersion>;
51    /// Update a model version
52    ///
53    /// Updates the model version that matches the supplied name and version.
54    async fn update_model_version(
55        &self,
56        request: UpdateModelVersionRequest,
57        context: Cx,
58    ) -> Result<ModelVersion>;
59    /// Delete a model version
60    ///
61    /// Deletes the model version that matches the supplied name and version. For the
62    /// deletion to succeed, the caller must be the owner of the parent registered
63    /// model.
64    async fn delete_model_version(
65        &self,
66        request: DeleteModelVersionRequest,
67        context: Cx,
68    ) -> Result<()>;
69    /// Finalize a model version
70    ///
71    /// Transitions a model version to READY once all artifacts have been written to
72    /// its storage location.
73    async fn finalize_model_version(
74        &self,
75        request: FinalizeModelVersionRequest,
76        context: Cx,
77    ) -> Result<ModelVersion>;
78}