@@ -28,8 +28,8 @@ pub struct Extras {
28
28
pub ( crate ) fixed_level : Option < u8 > ,
29
29
/// Number of execute times
30
30
pub ( crate ) exec_times : u32 ,
31
- /// The task group id . Used in priority queue.
32
- pub ( crate ) group_id : u64 ,
31
+ /// The task group name . Used in priority queue.
32
+ pub ( crate ) group_name : String ,
33
33
}
34
34
35
35
impl Extras {
@@ -45,7 +45,7 @@ impl Extras {
45
45
current_level : 0 ,
46
46
fixed_level : None ,
47
47
exec_times : 0 ,
48
- group_id : 0 ,
48
+ group_name : String :: new ( ) ,
49
49
}
50
50
}
51
51
@@ -68,23 +68,7 @@ impl Extras {
68
68
current_level : fixed_level. unwrap_or ( 0 ) ,
69
69
fixed_level,
70
70
exec_times : 0 ,
71
- group_id : 0 ,
72
- }
73
- }
74
-
75
- /// Creates an `Extra` for task cells pushed into a priority task queue
76
- /// with custom settings.
77
- pub fn new_priority ( group_id : u64 , task_id : u64 , fixed_level : Option < u8 > ) -> Extras {
78
- Extras {
79
- start_time : Instant :: now ( ) ,
80
- schedule_time : None ,
81
- task_id,
82
- running_time : None ,
83
- total_running_time : None ,
84
- current_level : fixed_level. unwrap_or ( 0 ) ,
85
- fixed_level,
86
- exec_times : 0 ,
87
- group_id,
71
+ group_name : String :: new ( ) ,
88
72
}
89
73
}
90
74
@@ -110,8 +94,13 @@ impl Extras {
110
94
self . current_level
111
95
}
112
96
113
- /// Gets the group id of this task
114
- pub fn group_id ( & self ) -> u64 {
115
- self . group_id
97
+ /// Gets the group name of this task.
98
+ pub fn group_name ( & self ) -> & str {
99
+ & self . group_name
100
+ }
101
+
102
+ /// Set the group name of this task.
103
+ pub fn set_group_name ( & mut self , name : String ) {
104
+ self . group_name = name;
116
105
}
117
106
}
0 commit comments