review changes

This commit is contained in:
marin postma 2021-06-21 13:57:32 +02:00
parent 763ee521be
commit 56686dee40
No known key found for this signature in database
GPG key ID: 6088B7721C3E39F9
10 changed files with 24 additions and 23 deletions

View file

@ -11,7 +11,7 @@ pub enum DumpActorError {
DumpAlreadyRunning,
#[error("dump `{0}` does not exist")]
DumpDoesNotExist(String),
#[error("Internal error: {0}")]
#[error("internal error: {0}")]
Internal(Box<dyn std::error::Error + Send + Sync + 'static>),
#[error("error while dumping uuids: {0}")]
UuidResolver(#[from] UuidResolverError),

View file

@ -10,7 +10,7 @@ pub type Result<T> = std::result::Result<T, IndexControllerError>;
#[derive(Debug, thiserror::Error)]
pub enum IndexControllerError {
#[error("Missing index uid")]
#[error("missing index uid")]
MissingUid,
#[error("index resolution error: {0}")]
Uuid(#[from] UuidResolverError),

View file

@ -10,11 +10,11 @@ pub enum IndexActorError {
IndexError(#[from] IndexError),
#[error("index already exists")]
IndexAlreadyExists,
#[error("Index doesn't exists")]
#[error("index doesn't exists")]
UnexistingIndex,
#[error("Existing primary key")]
#[error("existing primary key")]
ExistingPrimaryKey,
#[error("Internal Index Error: {0}")]
#[error("internal Index Error: {0}")]
Internal(Box<dyn std::error::Error + Send + Sync + 'static>),
#[error("{0}")]
Milli(#[from] milli::Error),

View file

@ -330,10 +330,10 @@ impl IndexController {
pub async fn update_index(
&self,
uid: String,
index_settings: IndexSettings,
mut index_settings: IndexSettings,
) -> Result<IndexMetadata> {
if index_settings.uid.is_some() {
todo!("Can't change the index uid.")
index_settings.uid.take();
}
let uuid = self.uuid_resolver.get(uid.clone()).await?;

View file

@ -1,6 +1,7 @@
use std::path::{Path, PathBuf};
use std::time::Duration;
use anyhow::bail;
use log::{error, info};
use tokio::fs;
use tokio::task::spawn_blocking;
@ -108,7 +109,7 @@ pub fn load_snapshot(
}
}
} else if db_path.as_ref().exists() && !ignore_snapshot_if_db_exists {
todo!(
bail!(
"database already exists at {:?}, try to delete it or rename it",
db_path
.as_ref()
@ -116,7 +117,7 @@ pub fn load_snapshot(
.unwrap_or_else(|_| db_path.as_ref().to_owned())
)
} else if !snapshot_path.as_ref().exists() && !ignore_missing_snapshot {
todo!(
bail!(
"snapshot doesn't exist at {:?}",
snapshot_path
.as_ref()

View file

@ -9,14 +9,14 @@ pub type Result<T> = std::result::Result<T, UpdateActorError>;
#[derive(Debug, thiserror::Error)]
#[allow(clippy::large_enum_variant)]
pub enum UpdateActorError {
#[error("Update {0} doesn't exist.")]
#[error("update {0} doesn't exist.")]
UnexistingUpdate(u64),
#[error("Internal error processing update: {0}")]
#[error("internal error processing update: {0}")]
Internal(Box<dyn Error + Send + Sync + 'static>),
#[error("error with index: {0}")]
IndexActor(#[from] IndexActorError),
#[error(
"Update store was shut down due to a fatal error, please check your logs for more info."
"update store was shut down due to a fatal error, please check your logs for more info."
)]
FatalUpdateStoreError,
}

View file

@ -4,13 +4,13 @@ pub type Result<T> = std::result::Result<T, UuidResolverError>;
#[derive(Debug, thiserror::Error)]
pub enum UuidResolverError {
#[error("Name already exist.")]
#[error("name already exist.")]
NameAlreadyExist,
#[error("Index \"{0}\" doesn't exist.")]
#[error("index \"{0}\" doesn't exist.")]
UnexistingIndex(String),
#[error("Badly formatted index uid: {0}")]
#[error("badly formatted index uid: {0}")]
BadlyFormatted(String),
#[error("Internal error resolving index uid: {0}")]
#[error("internal error resolving index uid: {0}")]
Internal(Box<dyn std::error::Error + Sync + Send + 'static>),
}