SledStore possible improvement
Closed this issue · 2 comments
#[derive(Debug, Clone)]
pub struct SledStore {
db: Arc<RwLock<sled::Db>>,
}
https://github.com/whisperfish/presage/blob/main/src/store/sled.rs
Is there a reason for the use of std::sync::Arc;
and std::sync::RwLock;
?
If it is just to implement the Clone
trait, Sled has clone functionality. https://docs.rs/sled/latest/sled/struct.Db.html#method.clone
Am I missing something?
You're absolutely right, I suppose this is either an oversight or a remnant from an older version of sled
. Note that I already start to improve it in https://github.com/whisperfish/presage/pull/73/files#diff-bff239fd4eb8e089e02d935c568c6b2c34feab544fc43316617d304b016c04c8R41 which I'll attempt to merge rather sooner than later.
I just stumbled on it, while trying to improve my own sled implementation in another project. I am using your SledStore
as a template to migrate/improve my own messy code.
Awesome that you already improved it. Feel free to close the issue whenever you like.