Skip to content

Commit

Permalink
Remove redundant allocation in metastore actor
Browse files Browse the repository at this point in the history
Signed-off-by: Lee Smet <[email protected]>
  • Loading branch information
LeeSmet committed Sep 10, 2021
1 parent 11bfaf3 commit 60750c8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions zstor/src/actors/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ pub struct ReplaceMetaStore {

/// Actor for a metastore
pub struct MetaStoreActor {
meta_store: Arc<Box<dyn MetaStore>>,
meta_store: Arc<dyn MetaStore>,
writeable: bool,
}

impl MetaStoreActor {
/// Create a new [`MetaStoreActor`] from a given [`MetaStore`].
pub fn new(meta_store: Box<dyn MetaStore>) -> MetaStoreActor {
Self {
meta_store: Arc::new(meta_store),
meta_store: Arc::from(meta_store),
writeable: true,
}
}
Expand Down Expand Up @@ -257,6 +257,6 @@ impl Handler<ReplaceMetaStore> for MetaStoreActor {
type Result = ();

fn handle(&mut self, msg: ReplaceMetaStore, _: &mut Self::Context) -> Self::Result {
self.meta_store = Arc::new(msg.new_store);
self.meta_store = Arc::from(msg.new_store as Box<dyn MetaStore>);
}
}

0 comments on commit 60750c8

Please sign in to comment.