Introduce the prepare_for_closing Index method

This commit is contained in:
Clément Renault 2020-10-30 11:46:14 +01:00
parent 222063b19d
commit 99da69c85f
No known key found for this signature in database
GPG Key ID: 92ADA4E935E71FA4

View File

@ -64,6 +64,15 @@ impl Index {
self.env.path()
}
/// Returns an `EnvClosingEvent` that can be used to wait for the closing event,
/// multiple threads can wait on this event.
///
/// Make sure that you drop all the copies of `Index`es you have, env closing are triggered
/// when all references are dropped, the last one will eventually close the environment.
pub fn prepare_for_closing(self) -> heed::EnvClosingEvent {
self.env.prepare_for_closing()
}
/// Writes the documents ids that corresponds to the user-ids-documents-ids FST.
pub fn put_documents_ids(&self, wtxn: &mut heed::RwTxn, docids: &RoaringBitmap) -> heed::Result<()> {
self.main.put::<_, Str, RoaringBitmapCodec>(wtxn, DOCUMENTS_IDS_KEY, docids)