From 6aa50830d235cfe69168477b84b00b6615162a3e Mon Sep 17 00:00:00 2001 From: Tino Rusch Date: Wed, 18 Dec 2024 16:45:09 +0100 Subject: [PATCH] add comments + make byte values from worker and tasks default to a factor of one megabyte when no unit is given --- src/models/metadata.rs | 48 +++++- src/models/pin.rs | 117 +++++++++++++- src/models/serialization_helpers.rs | 238 +++++++++++++++++++++++++++- src/models/task.rs | 122 +++++++++++++- src/models/worker.rs | 102 ++++++++++-- src/models/workflow.rs | 65 ++++++++ 6 files changed, 668 insertions(+), 24 deletions(-) diff --git a/src/models/metadata.rs b/src/models/metadata.rs index f31d9ec..75df7b3 100644 --- a/src/models/metadata.rs +++ b/src/models/metadata.rs @@ -1,25 +1,70 @@ use serde::{Deserialize, Serialize}; use crate::proto::gevulot::gevulot; +/// Metadata represents common metadata fields used across different resource types. +/// +/// # Examples +/// +/// ``` +/// use crate::models::Metadata; +/// use crate::models::Label; +/// +/// let metadata = Metadata { +/// id: Some("task-123".to_string()), +/// name: "my-task".to_string(), +/// creator: Some("alice".to_string()), +/// description: "An example task".to_string(), +/// tags: vec!["tag1".to_string(), "tag2".to_string()], +/// labels: vec![ +/// Label { +/// key: "env".to_string(), +/// value: "prod".to_string() +/// } +/// ], +/// workflow_ref: None +/// }; +/// ``` #[derive(Serialize, Deserialize, Debug, Default)] pub struct Metadata { + /// Unique identifier for the resource pub id: Option, + /// Name of the resource pub name: String, + /// Creator/owner of the resource pub creator: Option, + /// Detailed description of the resource pub description: String, + /// List of searchable tags pub tags: Vec, + /// List of key-value labels pub labels: Vec