pub struct TaskNamespace {
pub tenant_id: String,
pub package_name: String,
pub workflow_id: String,
pub task_id: String,
}Expand description
Hierarchical namespace for task identification and isolation.
Provides a structured way to identify tasks across different contexts: multi-tenant environments, packaged workflows, and embedded workflows.
The namespace components form a hierarchy from most general (tenant) to most specific (task), enabling precise task resolution while supporting fallback strategies for compatibility.
Fields§
§tenant_id: StringTenant identifier for multi-tenancy support. Default: “public” for single-tenant or public access
package_name: StringPackage or deployment context identifier. Default: “embedded” for tasks compiled into the binary For packaged workflows: name from .so file metadata
workflow_id: StringWorkflow identifier from workflow macro. Groups related tasks together within a package/tenant
task_id: StringIndividual task identifier from task macro. Unique within the workflow context
Implementations§
Source§impl TaskNamespace
impl TaskNamespace
Sourcepub fn new(
tenant_id: &str,
package_name: &str,
workflow_id: &str,
task_id: &str,
) -> Self
pub fn new( tenant_id: &str, package_name: &str, workflow_id: &str, task_id: &str, ) -> Self
Create a complete namespace from all components.
This is the most general constructor, useful when all namespace components are known and need to be specified explicitly.
§Arguments
tenant_id- Tenant identifierpackage_name- Package identifierworkflow_id- Workflow identifiertask_id- Task identifier
Sourcepub fn from_string(namespace_str: &str) -> Result<Self, String>
pub fn from_string(namespace_str: &str) -> Result<Self, String>
Create a TaskNamespace from a string representation.
Parses a namespace string in the format “tenant::package::workflow::task” into a TaskNamespace struct.
§Arguments
namespace_str- String in format “tenant::package::workflow::task”
§Returns
Result<TaskNamespace, String>- Successfully parsed namespace or error message
§Examples
use cloacina_workflow::TaskNamespace;
let ns = TaskNamespace::from_string("public::embedded::etl::extract").unwrap();
assert_eq!(ns.tenant_id, "public");
assert_eq!(ns.task_id, "extract");
// Invalid format
assert!(TaskNamespace::from_string("invalid_format").is_err());Sourcepub fn is_public(&self) -> bool
pub fn is_public(&self) -> bool
Check if this is a public (non-tenant-specific) namespace.
§Returns
true if this namespace uses the default “public” tenant
Sourcepub fn is_embedded(&self) -> bool
pub fn is_embedded(&self) -> bool
Check if this is an embedded (non-packaged) namespace.
§Returns
true if this namespace uses the default “embedded” package
Trait Implementations§
Source§impl Clone for TaskNamespace
impl Clone for TaskNamespace
Source§fn clone(&self) -> TaskNamespace
fn clone(&self) -> TaskNamespace
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for TaskNamespace
impl Debug for TaskNamespace
Source§impl Display for TaskNamespace
impl Display for TaskNamespace
Source§fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult
Format the namespace as a string using the standard format.
Format: tenant_id::package_name::workflow_id::task_id
§Examples
use cloacina_workflow::TaskNamespace;
let ns = TaskNamespace::new("public", "embedded", "etl", "extract");
assert_eq!(ns.to_string(), "public::embedded::etl::extract");
let ns = TaskNamespace::new("tenant_1", "pkg.so", "analytics", "process");
assert_eq!(ns.to_string(), "tenant_1::pkg.so::analytics::process");