Updates
This commit is contained in:
		@@ -387,3 +387,47 @@ impl Job {
 | 
			
		||||
        Ok(job_ids)
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Canonical Redis key builders for queues and hashes
 | 
			
		||||
pub mod keys {
 | 
			
		||||
    use super::{NAMESPACE_PREFIX, ScriptType};
 | 
			
		||||
 | 
			
		||||
    // hero:job:{job_id}
 | 
			
		||||
    pub fn job_hash(job_id: &str) -> String {
 | 
			
		||||
        format!("{}{}", NAMESPACE_PREFIX, job_id)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // hero:q:reply:{job_id}
 | 
			
		||||
    pub fn reply(job_id: &str) -> String {
 | 
			
		||||
        format!("hero:q:reply:{}", job_id)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // hero:q:work:type:{script_type}
 | 
			
		||||
    pub fn work_type(script_type: &ScriptType) -> String {
 | 
			
		||||
        format!("hero:q:work:type:{}", script_type.actor_queue_suffix())
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // hero:q:work:type:{script_type}:group:{group}
 | 
			
		||||
    pub fn work_group(script_type: &ScriptType, group: &str) -> String {
 | 
			
		||||
        format!(
 | 
			
		||||
            "hero:q:work:type:{}:group:{}",
 | 
			
		||||
            script_type.actor_queue_suffix(),
 | 
			
		||||
            group
 | 
			
		||||
        )
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // hero:q:work:type:{script_type}:group:{group}:inst:{instance}
 | 
			
		||||
    pub fn work_instance(script_type: &ScriptType, group: &str, instance: &str) -> String {
 | 
			
		||||
        format!(
 | 
			
		||||
            "hero:q:work:type:{}:group:{}:inst:{}",
 | 
			
		||||
            script_type.actor_queue_suffix(),
 | 
			
		||||
            group,
 | 
			
		||||
            instance
 | 
			
		||||
        )
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // hero:q:ctl:type:{script_type}
 | 
			
		||||
    pub fn stop_type(script_type: &ScriptType) -> String {
 | 
			
		||||
        format!("hero:q:ctl:type:{}", script_type.actor_queue_suffix())
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user