Publish Clusterflux 1d0b6fa filtered source
This commit is contained in:
commit
e5d609cfb2
226 changed files with 86613 additions and 0 deletions
73
crates/clusterflux-coordinator/src/service/keys.rs
Normal file
73
crates/clusterflux-coordinator/src/service/keys.rs
Normal file
|
|
@ -0,0 +1,73 @@
|
|||
use clusterflux_core::{
|
||||
ArtifactId, NodeId, ProcessId, ProjectId, TaskInstanceId, TenantId, VfsPath,
|
||||
};
|
||||
|
||||
pub(super) type TaskControlKey = (TenantId, ProjectId, ProcessId, NodeId, TaskInstanceId);
|
||||
pub(super) type TaskRestartKey = (TenantId, ProjectId, ProcessId, TaskInstanceId);
|
||||
pub(super) type TaskAssignmentKey = (TenantId, ProjectId, NodeId);
|
||||
pub(super) type PanelStopKey = (TenantId, ProjectId, ProcessId);
|
||||
pub(super) type EnrollmentGrantKey = (TenantId, ProjectId, String);
|
||||
pub(super) type ProcessControlKey = (TenantId, ProjectId, ProcessId);
|
||||
|
||||
pub(super) fn task_control_key(
|
||||
tenant: &TenantId,
|
||||
project: &ProjectId,
|
||||
process: &ProcessId,
|
||||
node: &NodeId,
|
||||
task: &TaskInstanceId,
|
||||
) -> TaskControlKey {
|
||||
(
|
||||
tenant.clone(),
|
||||
project.clone(),
|
||||
process.clone(),
|
||||
node.clone(),
|
||||
task.clone(),
|
||||
)
|
||||
}
|
||||
|
||||
pub(super) fn task_restart_key(
|
||||
tenant: &TenantId,
|
||||
project: &ProjectId,
|
||||
process: &ProcessId,
|
||||
task: &TaskInstanceId,
|
||||
) -> TaskRestartKey {
|
||||
(
|
||||
tenant.clone(),
|
||||
project.clone(),
|
||||
process.clone(),
|
||||
task.clone(),
|
||||
)
|
||||
}
|
||||
|
||||
pub(super) fn process_control_key(
|
||||
tenant: &TenantId,
|
||||
project: &ProjectId,
|
||||
process: &ProcessId,
|
||||
) -> ProcessControlKey {
|
||||
(tenant.clone(), project.clone(), process.clone())
|
||||
}
|
||||
|
||||
pub(super) fn panel_stop_key(
|
||||
tenant: &TenantId,
|
||||
project: &ProjectId,
|
||||
process: &ProcessId,
|
||||
) -> PanelStopKey {
|
||||
(tenant.clone(), project.clone(), process.clone())
|
||||
}
|
||||
|
||||
pub(super) fn enrollment_grant_key(
|
||||
tenant: &TenantId,
|
||||
project: &ProjectId,
|
||||
grant: &str,
|
||||
) -> EnrollmentGrantKey {
|
||||
(tenant.clone(), project.clone(), grant.to_owned())
|
||||
}
|
||||
|
||||
pub(super) fn artifact_id_from_path(path: &VfsPath) -> ArtifactId {
|
||||
let value = path
|
||||
.as_str()
|
||||
.strip_prefix("/vfs/artifacts/")
|
||||
.unwrap_or(path.as_str())
|
||||
.replace('/', ":");
|
||||
ArtifactId::new(value)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue