mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 12:27:13 +02:00
add a little bit of documentation
This commit is contained in:
parent
2c4e5ce8be
commit
fe330e1be9
2 changed files with 17 additions and 13 deletions
|
@ -1,7 +1,7 @@
|
|||
//! Utility functions on the DBs. Mainly getter and setters.
|
||||
|
||||
use milli::{
|
||||
heed::{RoTxn, RwTxn},
|
||||
heed::{types::DecodeIgnore, RoTxn, RwTxn},
|
||||
BEU32,
|
||||
};
|
||||
use roaring::RoaringBitmap;
|
||||
|
@ -12,6 +12,18 @@ use crate::{
|
|||
};
|
||||
|
||||
impl IndexScheduler {
|
||||
pub(crate) 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))
|
||||
}
|
||||
|
||||
pub(crate) fn next_task_id(&self, rtxn: &RoTxn) -> Result<TaskId> {
|
||||
Ok(self.last_task_id(rtxn)?.unwrap_or_default())
|
||||
}
|
||||
|
||||
pub(crate) fn get_task(&self, rtxn: &RoTxn, task_id: TaskId) -> Result<Option<Task>> {
|
||||
Ok(self.all_tasks.get(rtxn, &BEU32::new(task_id))?)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue