Closed jplatte closed 1 year ago
We have these already https://docs.rs/elsa/latest/elsa/sync/index.html
No set types but I'd accept a PR wrapping the map type into a set.
Also for sets just an RWLock<Set>
is fine, the key value proposition of elsa isn't relevant for sets because sets don't produce references anyway.
Okay, thanks for the quick reply!
Likely irrelevant remark: I don't think an RwLock
instead of a Mutex
is right for my use case (AFAICT the only operation I'm going to need is insert
, to check if the value was already present and insert it if not).
Yeah the kind of synchronization depends on your use case. Mutices are fine overall
Hi! I just found out about this crate because I wanted to keep track of which directories were created and which files were written by a parallel static site generator I'm working on and an append-only set seemed like a good solution that's potentially more efficient than a regular set behind a mutex.
While I couldn't find an append-only set anywhere, elsa at least offers append-only map types, and it seems like it would be trivial to build set types on top. However, I noticed that both map types don't implement
Sync
, which makes them no better thanstd
types for my use case.Am I wrong to think that an append-only set would be the right tool for my use case? Are
Sync
set and map types possible (such that they perform better than a mutex-protected map or set) and in-scope for this crate?