pub struct ArtifactNamespace {
pub thread_id: String,
pub task_id: Option<String>,
}Expand description
Artifact namespace for organizing artifacts by thread and task Handles path creation logic consistently across the codebase
Fields§
§thread_id: StringThread ID (required)
task_id: Option<String>Task ID (optional - if None, uses thread-level namespace)
Implementations§
Source§impl ArtifactNamespace
impl ArtifactNamespace
Sourcepub fn new(thread_id: String, task_id: Option<String>) -> Self
pub fn new(thread_id: String, task_id: Option<String>) -> Self
Create a new namespace from thread_id and optional task_id
Sourcepub fn thread_path(&self) -> String
pub fn thread_path(&self) -> String
Get the thread-level namespace path: threads/{short_thread}
Sourcepub fn task_path(&self) -> Option<String>
pub fn task_path(&self) -> Option<String>
Get the task-level namespace path: threads/{short_thread}/tasks/{short_task}
Returns None if task_id is not set
Sourcepub fn primary_path(&self) -> String
pub fn primary_path(&self) -> String
Get the primary namespace path (task-level if available, otherwise thread-level) This is the path where artifacts should be saved
Sourcepub fn all_paths(&self) -> Vec<String>
pub fn all_paths(&self) -> Vec<String>
Get all paths that should be checked when listing artifacts Returns both thread-level and task-level paths (if task_id is set) This ensures list_artifacts can find artifacts saved at either level
Sourcepub fn from_path(_path: &str) -> Option<Self>
pub fn from_path(_path: &str) -> Option<Self>
Parse a namespace path back into thread_id and task_id
Handles both threads/{hash} and threads/{hash}/tasks/{hash} formats
Note: This cannot reverse the hash to get the original UUIDs, so it returns None
In practice, you should store the mapping or use the namespace directly
Trait Implementations§
Source§impl Clone for ArtifactNamespace
impl Clone for ArtifactNamespace
Source§fn clone(&self) -> ArtifactNamespace
fn clone(&self) -> ArtifactNamespace
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ArtifactNamespace
impl Debug for ArtifactNamespace
Source§impl<'de> Deserialize<'de> for ArtifactNamespace
impl<'de> Deserialize<'de> for ArtifactNamespace
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Hash for ArtifactNamespace
impl Hash for ArtifactNamespace
Source§impl JsonSchema for ArtifactNamespace
impl JsonSchema for ArtifactNamespace
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read moreSource§impl PartialEq for ArtifactNamespace
impl PartialEq for ArtifactNamespace
Source§impl Serialize for ArtifactNamespace
impl Serialize for ArtifactNamespace
impl Eq for ArtifactNamespace
impl StructuralPartialEq for ArtifactNamespace
Auto Trait Implementations§
impl Freeze for ArtifactNamespace
impl RefUnwindSafe for ArtifactNamespace
impl Send for ArtifactNamespace
impl Sync for ArtifactNamespace
impl Unpin for ArtifactNamespace
impl UnsafeUnpin for ArtifactNamespace
impl UnwindSafe for ArtifactNamespace
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.