File tree Expand file tree Collapse file tree 2 files changed +16
-33
lines changed
Expand file tree Collapse file tree 2 files changed +16
-33
lines changed Original file line number Diff line number Diff line change @@ -216,19 +216,22 @@ impl DapAggregator for crate::App {
216216 ) -> Result < ( ) , DapError > {
217217 let expiration_time = task_config. not_after ;
218218
219- if self . service_config . role . is_leader ( ) {
220- self . kv ( )
221- . put_with_expiration :: < kv:: prefix:: TaskConfig > (
222- task_id,
223- task_config,
224- expiration_time,
225- )
226- . await
227- . map_err ( |e| fatal_error ! ( err = ?e, "failed to put the a task config in kv" ) ) ?;
228- } else {
229- self . kv ( )
230- . only_cache_put :: < kv:: prefix:: TaskConfig > ( task_id, task_config)
231- . await ;
219+ match self . service_config . role {
220+ daphne:: constants:: DapAggregatorRole :: Leader => {
221+ self . kv ( )
222+ . put_with_expiration :: < kv:: prefix:: TaskConfig > (
223+ task_id,
224+ task_config,
225+ expiration_time,
226+ )
227+ . await
228+ . map_err ( |e| fatal_error ! ( err = ?e, "failed to put the a task config in kv" ) ) ?;
229+ }
230+ daphne:: constants:: DapAggregatorRole :: Helper => {
231+ self . kv ( )
232+ . only_cache_put :: < kv:: prefix:: TaskConfig > ( task_id, task_config)
233+ . await ;
234+ }
232235 }
233236 Ok ( ( ) )
234237 }
Original file line number Diff line number Diff line change @@ -75,16 +75,6 @@ pub enum DapRole {
7575 Helper ,
7676}
7777
78- impl DapRole {
79- pub fn is_leader ( self ) -> bool {
80- self == Self :: Leader
81- }
82-
83- pub fn is_helper ( self ) -> bool {
84- self == Self :: Helper
85- }
86- }
87-
8878impl FromStr for DapRole {
8979 type Err = String ;
9080
@@ -119,16 +109,6 @@ pub enum DapAggregatorRole {
119109 Helper ,
120110}
121111
122- impl DapAggregatorRole {
123- pub fn is_leader ( self ) -> bool {
124- self == Self :: Leader
125- }
126-
127- pub fn is_helper ( self ) -> bool {
128- self == Self :: Helper
129- }
130- }
131-
132112impl FromStr for DapAggregatorRole {
133113 type Err = String ;
134114
You can’t perform that action at this time.
0 commit comments