lance_namespace_reqwest_client/models/create_table_version_request.rs
1/*
2 * Lance Namespace Specification
3 *
4 * This OpenAPI specification is a part of the Lance namespace specification. It contains 2 parts: The `components/schemas`, `components/responses`, `components/examples`, `tags` sections define the request and response shape for each operation in a Lance Namespace across all implementations. See https://lance.org/format/namespace/operations for more details. The `servers`, `security`, `paths`, `components/parameters` sections are for the Lance REST Namespace implementation, which defines a complete REST server that can work with Lance datasets. See https://lance.org/format/namespace/rest for more details.
5 *
6 * The version of the OpenAPI document: 1.0.0
7 *
8 * Generated by: https://openapi-generator.tech
9 */
10
11use crate::models;
12use serde::{Deserialize, Serialize};
13
14/// CreateTableVersionRequest : Request to create a new table version entry. This supports `put_if_not_exists` semantics, where the operation fails if the version already exists.
15#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
16pub struct CreateTableVersionRequest {
17 #[serde(rename = "identity", skip_serializing_if = "Option::is_none")]
18 pub identity: Option<Box<models::Identity>>,
19 /// Arbitrary context for a request as key-value pairs. How to use the context is custom to the specific implementation. REST NAMESPACE ONLY Context entries are passed via HTTP headers using the naming convention `x-lance-ctx-<key>: <value>`. For example, a context entry `{\"trace_id\": \"abc123\"}` would be sent as the header `x-lance-ctx-trace_id: abc123`.
20 #[serde(rename = "context", skip_serializing_if = "Option::is_none")]
21 pub context: Option<std::collections::HashMap<String, String>>,
22 /// The table identifier
23 #[serde(rename = "id", skip_serializing_if = "Option::is_none")]
24 pub id: Option<Vec<String>>,
25 /// Version number to create
26 #[serde(rename = "version")]
27 pub version: i64,
28 /// Branch to target. When not specified, the main branch is used.
29 #[serde(rename = "branch", skip_serializing_if = "Option::is_none")]
30 pub branch: Option<String>,
31 /// Path to the manifest file for this version
32 #[serde(rename = "manifest_path")]
33 pub manifest_path: String,
34 /// Size of the manifest file in bytes
35 #[serde(rename = "manifest_size", skip_serializing_if = "Option::is_none")]
36 pub manifest_size: Option<i64>,
37 /// Optional ETag for the manifest file
38 #[serde(rename = "e_tag", skip_serializing_if = "Option::is_none")]
39 pub e_tag: Option<String>,
40 /// Optional metadata for the version
41 #[serde(rename = "metadata", skip_serializing_if = "Option::is_none")]
42 pub metadata: Option<std::collections::HashMap<String, String>>,
43 /// The naming scheme used for manifest files in the `_versions/` directory. Known values: - `V1`: `_versions/{version}.manifest` - Simple version-based naming - `V2`: `_versions/{inverted_version}.manifest` - Zero-padded, reversed version number (uses `u64::MAX - version`) for O(1) lookup of latest version on object stores V2 is preferred for new tables as it enables efficient latest-version discovery without needing to list all versions.
44 #[serde(rename = "naming_scheme", skip_serializing_if = "Option::is_none")]
45 pub naming_scheme: Option<String>,
46}
47
48impl CreateTableVersionRequest {
49 /// Request to create a new table version entry. This supports `put_if_not_exists` semantics, where the operation fails if the version already exists.
50 pub fn new(version: i64, manifest_path: String) -> CreateTableVersionRequest {
51 CreateTableVersionRequest {
52 identity: None,
53 context: None,
54 id: None,
55 version,
56 branch: None,
57 manifest_path,
58 manifest_size: None,
59 e_tag: None,
60 metadata: None,
61 naming_scheme: None,
62 }
63 }
64}
65