remove anyhow refs & implement missing errors

This commit is contained in:
marin postma 2021-06-14 21:26:35 +02:00
parent c1b6f0e833
commit 58f9974be4
No known key found for this signature in database
GPG key ID: 6088B7721C3E39F9
40 changed files with 707 additions and 668 deletions

View file

@ -3,7 +3,7 @@ use milli::update::{IndexDocumentsMethod, UpdateFormat};
use super::Data;
use crate::index::{Checked, Settings};
use crate::index_controller::{IndexMetadata, IndexSettings, UpdateStatus};
use crate::index_controller::{IndexMetadata, IndexSettings, UpdateStatus, error::Result};
impl Data {
pub async fn add_documents(
@ -13,7 +13,7 @@ impl Data {
format: UpdateFormat,
stream: Payload,
primary_key: Option<String>,
) -> anyhow::Result<UpdateStatus> {
) -> Result<UpdateStatus> {
let update_status = self
.index_controller
.add_documents(index, method, format, stream, primary_key)
@ -26,7 +26,7 @@ impl Data {
index: String,
settings: Settings<Checked>,
create: bool,
) -> anyhow::Result<UpdateStatus> {
) -> Result<UpdateStatus> {
let update = self
.index_controller
.update_settings(index, settings, create)
@ -34,7 +34,7 @@ impl Data {
Ok(update)
}
pub async fn clear_documents(&self, index: String) -> anyhow::Result<UpdateStatus> {
pub async fn clear_documents(&self, index: String) -> Result<UpdateStatus> {
let update = self.index_controller.clear_documents(index).await?;
Ok(update)
}
@ -43,7 +43,7 @@ impl Data {
&self,
index: String,
document_ids: Vec<String>,
) -> anyhow::Result<UpdateStatus> {
) -> Result<UpdateStatus> {
let update = self
.index_controller
.delete_documents(index, document_ids)
@ -51,16 +51,16 @@ impl Data {
Ok(update)
}
pub async fn delete_index(&self, index: String) -> anyhow::Result<()> {
pub async fn delete_index(&self, index: String) -> Result<()> {
self.index_controller.delete_index(index).await?;
Ok(())
}
pub async fn get_update_status(&self, index: String, uid: u64) -> anyhow::Result<UpdateStatus> {
pub async fn get_update_status(&self, index: String, uid: u64) -> Result<UpdateStatus> {
self.index_controller.update_status(index, uid).await
}
pub async fn get_updates_status(&self, index: String) -> anyhow::Result<Vec<UpdateStatus>> {
pub async fn get_updates_status(&self, index: String) -> Result<Vec<UpdateStatus>> {
self.index_controller.all_update_status(index).await
}
@ -69,7 +69,7 @@ impl Data {
uid: String,
primary_key: Option<String>,
new_uid: Option<String>,
) -> anyhow::Result<IndexMetadata> {
) -> Result<IndexMetadata> {
let settings = IndexSettings {
uid: new_uid,
primary_key,