Namespace
Rust Implementation: cloacina::python::namespace::PyTaskNamespace
Python wrapper for TaskNamespace
new(tenant_id: str, package_name: str, workflow_id: str, task_id: str) -> Self
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::new
Create a new TaskNamespace
Parameters:
| Name | Type | Description |
|---|---|---|
tenant_id |
str |
|
package_name |
str |
|
workflow_id |
str |
|
task_id |
str |
Source
pub fn new(tenant_id: &str, package_name: &str, workflow_id: &str, task_id: &str) -> Self {
Self {
inner: crate::TaskNamespace::new(tenant_id, package_name, workflow_id, task_id),
}
}
from_string(namespace_str: str) -> Self
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::from_string
Parse TaskNamespace from string format “tenant::package::workflow::task”
Parameters:
| Name | Type | Description |
|---|---|---|
namespace_str |
str |
Source
pub fn from_string(namespace_str: &str) -> PyResult<Self> {
crate::TaskNamespace::from_string(namespace_str)
.map(|inner| Self { inner })
.map_err(|e| PyValueError::new_err(format!("Invalid namespace format: {}", e)))
}
tenant_id() -> str
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::tenant_id
Get tenant ID
Source
pub fn tenant_id(&self) -> &str {
&self.inner.tenant_id
}
package_name() -> str
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::package_name
Get package name
Source
pub fn package_name(&self) -> &str {
&self.inner.package_name
}
workflow_id() -> str
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::workflow_id
Get workflow ID
Source
pub fn workflow_id(&self) -> &str {
&self.inner.workflow_id
}
task_id() -> str
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::task_id
Get task ID
Source
pub fn task_id(&self) -> &str {
&self.inner.task_id
}
parent() -> Self
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::parent
Get parent namespace (without task_id)
Source
pub fn parent(&self) -> Self {
Self {
inner: crate::TaskNamespace::new(
&self.inner.tenant_id,
&self.inner.package_name,
&self.inner.workflow_id,
"",
),
}
}
is_child_of(parent: PyTaskNamespace) -> bool
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::is_child_of
Check if this namespace is a child of another
Parameters:
| Name | Type | Description |
|---|---|---|
parent |
PyTaskNamespace |
Source
pub fn is_child_of(&self, parent: &PyTaskNamespace) -> bool {
self.inner.tenant_id == parent.inner.tenant_id
&& self.inner.package_name == parent.inner.package_name
&& self.inner.workflow_id == parent.inner.workflow_id
&& !self.inner.task_id.is_empty()
&& parent.inner.task_id.is_empty()
}
is_sibling_of(other: PyTaskNamespace) -> bool
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::is_sibling_of
Check if this namespace is a sibling of another (same parent)
Parameters:
| Name | Type | Description |
|---|---|---|
other |
PyTaskNamespace |
Source
pub fn is_sibling_of(&self, other: &PyTaskNamespace) -> bool {
self.inner.tenant_id == other.inner.tenant_id
&& self.inner.package_name == other.inner.package_name
&& self.inner.workflow_id == other.inner.workflow_id
&& !self.inner.task_id.is_empty()
&& !other.inner.task_id.is_empty()
&& self.inner.task_id != other.inner.task_id
}
__str__() -> str
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::str
String representation
Source
pub fn __str__(&self) -> String {
self.inner.to_string()
}
__repr__() -> str
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::repr
String representation
Source
pub fn __repr__(&self) -> String {
format!(
"TaskNamespace('{}', '{}', '{}', '{}')",
self.inner.tenant_id,
self.inner.package_name,
self.inner.workflow_id,
self.inner.task_id
)
}
__eq__(other: PyTaskNamespace) -> bool
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::eq
Equality comparison
Parameters:
| Name | Type | Description |
|---|---|---|
other |
PyTaskNamespace |
Source
pub fn __eq__(&self, other: &PyTaskNamespace) -> bool {
self.inner == other.inner
}
__hash__() -> int
Rust Implementation: cloacina::python::namespace::PyTaskNamespace::hash
Hash for use in sets/dicts
Source
pub fn __hash__(&self) -> u64 {
use std::collections::hash_map::DefaultHasher;
use std::hash::{Hash, Hasher};
let mut hasher = DefaultHasher::new();
self.inner.hash(&mut hasher);
hasher.finish()
}