Skip to content

cloacina-python::namespace

Rust

Binding

Python API: cloaca.TaskNamespace

Python wrapper for TaskNamespace

Name Type Description
inner cloacina::TaskNamespace
fn new(
tenant_id: &str,
package_name: &str,
workflow_id: &str,
task_id: &str,
) -> Self

Python API: cloaca.TaskNamespace.new

Create a new TaskNamespace

Source
pub fn new(tenant_id: &str, package_name: &str, workflow_id: &str, task_id: &str) -> Self {
Self {
inner: cloacina::TaskNamespace::new(tenant_id, package_name, workflow_id, task_id),
}
}
fn from_string(namespace_str: &str) -> PyResult<Self>

Python API: cloaca.TaskNamespace.from_string

Parse TaskNamespace from string format “tenant::package::workflow::task”

Source
pub fn from_string(namespace_str: &str) -> PyResult<Self> {
cloacina::TaskNamespace::from_string(namespace_str)
.map(|inner| Self { inner })
.map_err(|e| PyValueError::new_err(format!("Invalid namespace format: {}", e)))
}
fn tenant_id(&self) -> &str

Python API: cloaca.TaskNamespace.tenant_id

Get tenant ID

Source
pub fn tenant_id(&self) -> &str {
&self.inner.tenant_id
}
fn package_name(&self) -> &str

Python API: cloaca.TaskNamespace.package_name

Get package name

Source
pub fn package_name(&self) -> &str {
&self.inner.package_name
}
fn workflow_id(&self) -> &str

Python API: cloaca.TaskNamespace.workflow_id

Get workflow ID

Source
pub fn workflow_id(&self) -> &str {
&self.inner.workflow_id
}
fn task_id(&self) -> &str

Python API: cloaca.TaskNamespace.task_id

Get task ID

Source
pub fn task_id(&self) -> &str {
&self.inner.task_id
}
fn parent(&self) -> Self

Python API: cloaca.TaskNamespace.parent

Get parent namespace (without task_id)

Source
pub fn parent(&self) -> Self {
Self {
inner: cloacina::TaskNamespace::new(
&self.inner.tenant_id,
&self.inner.package_name,
&self.inner.workflow_id,
"",
),
}
}
fn is_child_of(&self, parent: &PyTaskNamespace) -> bool

Python API: cloaca.TaskNamespace.is_child_of

Check if this namespace is a child of another

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()
}
fn is_sibling_of(&self, other: &PyTaskNamespace) -> bool

Python API: cloaca.TaskNamespace.is_sibling_of

Check if this namespace is a sibling of another (same parent)

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
}
fn __str__(&self) -> String

Python API: cloaca.TaskNamespace.__str__

String representation

Source
pub fn __str__(&self) -> String {
self.inner.to_string()
}
fn __repr__(&self) -> String

Python API: cloaca.TaskNamespace.__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
)
}
fn __eq__(&self, other: &PyTaskNamespace) -> bool

Python API: cloaca.TaskNamespace.__eq__

Equality comparison

Source
pub fn __eq__(&self, other: &PyTaskNamespace) -> bool {
self.inner == other.inner
}
fn __hash__(&self) -> u64

Python API: cloaca.TaskNamespace.__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()
}

pub

fn from_rust(namespace: cloacina::TaskNamespace) -> Self

Convert from Rust TaskNamespace (for internal use)

Source
pub fn from_rust(namespace: cloacina::TaskNamespace) -> Self {
Self { inner: namespace }
}

pub

fn to_rust(&self) -> cloacina::TaskNamespace

Convert to Rust TaskNamespace (for internal use)

Source
pub fn to_rust(&self) -> cloacina::TaskNamespace {
self.inner.clone()
}