mirror of
https://github.com/meilisearch/MeiliSearch
synced 2025-07-04 04:17:10 +02:00
implements the get_tasks
This commit is contained in:
parent
5b282acb7b
commit
f84cbee170
7 changed files with 131 additions and 22 deletions
|
@ -31,6 +31,7 @@ pub struct Query {
|
|||
#[serde(rename = "type")]
|
||||
pub kind: Option<Vec<Kind>>,
|
||||
pub index_uid: Option<Vec<String>>,
|
||||
pub uid: Option<Vec<TaskId>>,
|
||||
}
|
||||
|
||||
impl Default for Query {
|
||||
|
@ -41,6 +42,7 @@ impl Default for Query {
|
|||
status: None,
|
||||
kind: None,
|
||||
index_uid: None,
|
||||
uid: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,6 +74,15 @@ impl Query {
|
|||
..self
|
||||
}
|
||||
}
|
||||
|
||||
pub fn with_uid(self, uid: TaskId) -> Self {
|
||||
let mut task_vec = self.uid.unwrap_or_default();
|
||||
task_vec.push(uid);
|
||||
Self {
|
||||
uid: Some(task_vec),
|
||||
..self
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub mod db_name {
|
||||
|
@ -172,7 +183,11 @@ impl IndexScheduler {
|
|||
};
|
||||
|
||||
// This is the list of all the tasks.
|
||||
let mut tasks = RoaringBitmap::from_iter(0..last_task_id);
|
||||
let mut tasks = RoaringBitmap::from_sorted_iter(0..last_task_id).unwrap();
|
||||
|
||||
if let Some(uids) = query.uid {
|
||||
tasks &= RoaringBitmap::from_iter(uids);
|
||||
}
|
||||
|
||||
if let Some(status) = query.status {
|
||||
let mut status_tasks = RoaringBitmap::new();
|
||||
|
@ -256,6 +271,10 @@ impl IndexScheduler {
|
|||
Ok(self.file_store.new_update()?)
|
||||
}
|
||||
|
||||
pub fn delete_update_file(&self, uuid: Uuid) -> Result<()> {
|
||||
Ok(self.file_store.delete(uuid)?)
|
||||
}
|
||||
|
||||
/// This worker function must be run in a different thread and must be run only once.
|
||||
pub fn run(&self) -> ! {
|
||||
loop {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue