add a little bit of documentation

This commit is contained in:
Irevoire 2022-09-07 11:21:53 +02:00 committed by Clément Renault
parent 2c4e5ce8be
commit fe330e1be9
No known key found for this signature in database
GPG key ID: 92ADA4E935E71FA4
2 changed files with 17 additions and 13 deletions

View file

@ -70,6 +70,9 @@ pub struct IndexScheduler {
}
impl IndexScheduler {
/// Return the index corresponding to the name. If it wasn't opened before
/// it'll be opened. But if it doesn't exist on disk it'll throw an
/// `IndexNotFound` error.
pub fn index(&self, name: &str) -> Result<Index> {
let rtxn = self.env.read_txn()?;
let uuid = self
@ -105,18 +108,6 @@ impl IndexScheduler {
Ok(index)
}
fn last_task_id(&self, rtxn: &RoTxn) -> Result<Option<TaskId>> {
Ok(self
.all_tasks
.remap_data_type::<DecodeIgnore>()
.last(rtxn)?
.map(|(k, _)| k.get() + 1))
}
fn next_task_id(&self, rtxn: &RoTxn) -> Result<TaskId> {
Ok(self.last_task_id(rtxn)?.unwrap_or_default())
}
/// Returns the tasks corresponding to the query.
pub fn get_tasks(&self, query: Query) -> Result<Vec<Task>> {
let rtxn = self.env.read_txn()?;
@ -200,6 +191,7 @@ impl IndexScheduler {
Ok(())
}
/// Notify the scheduler there is or may be work to do.
pub fn notify(&self) {
self.wake_up
.store(true, std::sync::atomic::Ordering::Relaxed);