-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcollection_model.rs
66 lines (61 loc) · 2.1 KB
/
collection_model.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* Pinecone Control Plane API
*
* Pinecone is a vector database that makes it easy to search and retrieve billions of high-dimensional vectors.
*
* The version of the OpenAPI document: 2024-07
* Contact: [email protected]
* Generated by: https://openapi-generator.tech
*/
use crate::openapi::models;
use serde::{Deserialize, Serialize};
/// CollectionModel : The CollectionModel describes the configuration and status of a Pinecone collection.
#[derive(Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct CollectionModel {
/// The name of the collection.
#[serde(rename = "name")]
pub name: String,
/// The size of the collection in bytes.
#[serde(rename = "size", skip_serializing_if = "Option::is_none")]
pub size: Option<i64>,
/// The status of the collection.
#[serde(rename = "status")]
pub status: Status,
/// The dimension of the vectors stored in each record held in the collection.
#[serde(rename = "dimension", skip_serializing_if = "Option::is_none")]
pub dimension: Option<i32>,
/// The number of records stored in the collection.
#[serde(rename = "vector_count", skip_serializing_if = "Option::is_none")]
pub vector_count: Option<i32>,
/// The environment where the collection is hosted.
#[serde(rename = "environment")]
pub environment: String,
}
impl CollectionModel {
/// The CollectionModel describes the configuration and status of a Pinecone collection.
pub fn new(name: String, status: Status, environment: String) -> CollectionModel {
CollectionModel {
name,
size: None,
status,
dimension: None,
vector_count: None,
environment,
}
}
}
/// The status of the collection.
#[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)]
pub enum Status {
#[serde(rename = "Initializing")]
Initializing,
#[serde(rename = "Ready")]
Ready,
#[serde(rename = "Terminating")]
Terminating,
}
impl Default for Status {
fn default() -> Status {
Self::Initializing
}
}