mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 02:27:40 +08:00
provide a way to access the internal content path of all processing State
This commit is contained in:
parent
26dcb9e66d
commit
5f5402a3ab
@ -72,6 +72,10 @@ impl Enqueued {
|
||||
pub fn content_path(&self) -> Option<&Path> {
|
||||
self.content.as_deref()
|
||||
}
|
||||
|
||||
pub fn content_path_mut(&mut self) -> Option<&mut PathBuf> {
|
||||
self.content.as_mut()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
@ -87,6 +91,14 @@ impl Processed {
|
||||
pub fn id(&self) -> u64 {
|
||||
self.from.id()
|
||||
}
|
||||
|
||||
pub fn content_path(&self) -> Option<&Path> {
|
||||
self.from.content_path()
|
||||
}
|
||||
|
||||
pub fn content_path_mut(&mut self) -> Option<&mut PathBuf> {
|
||||
self.from.content_path_mut()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
@ -106,6 +118,14 @@ impl Processing {
|
||||
self.from.meta()
|
||||
}
|
||||
|
||||
pub fn content_path(&self) -> Option<&Path> {
|
||||
self.from.content_path()
|
||||
}
|
||||
|
||||
pub fn content_path_mut(&mut self) -> Option<&mut PathBuf> {
|
||||
self.from.content_path_mut()
|
||||
}
|
||||
|
||||
pub fn process(self, success: UpdateResult) -> Processed {
|
||||
Processed {
|
||||
success,
|
||||
@ -135,6 +155,14 @@ impl Aborted {
|
||||
pub fn id(&self) -> u64 {
|
||||
self.from.id()
|
||||
}
|
||||
|
||||
pub fn content_path(&self) -> Option<&Path> {
|
||||
self.from.content_path()
|
||||
}
|
||||
|
||||
pub fn content_path_mut(&mut self) -> Option<&mut PathBuf> {
|
||||
self.from.content_path_mut()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
@ -150,6 +178,14 @@ impl Failed {
|
||||
pub fn id(&self) -> u64 {
|
||||
self.from.id()
|
||||
}
|
||||
|
||||
pub fn content_path(&self) -> Option<&Path> {
|
||||
self.from.content_path()
|
||||
}
|
||||
|
||||
pub fn content_path_mut(&mut self) -> Option<&mut PathBuf> {
|
||||
self.from.content_path_mut()
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
@ -179,6 +215,26 @@ impl UpdateStatus {
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn content_path(&self) -> Option<&Path> {
|
||||
match self {
|
||||
UpdateStatus::Processing(u) => u.content_path(),
|
||||
UpdateStatus::Processed(u) => u.content_path(),
|
||||
UpdateStatus::Aborted(u) => u.content_path(),
|
||||
UpdateStatus::Failed(u) => u.content_path(),
|
||||
UpdateStatus::Enqueued(u) => u.content_path(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn content_path_mut(&mut self) -> Option<&mut PathBuf> {
|
||||
match self {
|
||||
UpdateStatus::Processing(u) => u.content_path_mut(),
|
||||
UpdateStatus::Processed(u) => u.content_path_mut(),
|
||||
UpdateStatus::Aborted(u) => u.content_path_mut(),
|
||||
UpdateStatus::Failed(u) => u.content_path_mut(),
|
||||
UpdateStatus::Enqueued(u) => u.content_path_mut(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl From<Enqueued> for UpdateStatus {
|
||||
|
Loading…
Reference in New Issue
Block a user