Skip to content

Commit

Permalink
Change workunit_store from Vec to HashSet
Browse files Browse the repository at this point in the history
  • Loading branch information
cattibrie committed Jul 9, 2019
1 parent 831d2bb commit 4a7ea42
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/rust/engine/workunit_store/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,22 +45,22 @@ pub struct WorkUnit {

#[derive (Clone)]
pub struct WorkUnitStore {
workunits: Arc<Mutex<Vec<WorkUnit>>>,
workunits: Arc<Mutex<HashSet<WorkUnit>>>,
}

impl WorkUnitStore {
pub fn new() -> WorkUnitStore {
WorkUnitStore {
workunits: Arc::new(Mutex::new(Vec::new())),
workunits: Arc::new(Mutex::new(HashSet::new())),
}
}

pub fn get_workunits(&self) -> Arc<Mutex<Vec<WorkUnit>>> {
pub fn get_workunits(&self) -> Arc<Mutex<HashSet<WorkUnit>>> {
self.workunits.clone()
}

pub fn add_workunit(&self, workunit: WorkUnit) {
self.workunits.lock().push(workunit);
self.workunits.lock().insert(workunit);
}
}

Expand Down

0 comments on commit 4a7ea42

Please sign in to comment.