#[error("The media directory structure depth multiplied by the length is equal to or greater than a sha256 hex hash, please reduce at least one of the two so that their product is less than 64")]
DirectoryStructureLengthDepthTooLarge,
#[error("Invalid S3 config")]
S3,
#[error("Failed to construct proxy config: {source}")]
@ -559,7 +596,7 @@ impl TryFrom<ShadowDirectoryStructure> for DirectoryStructure {
{
Ok(Self::Deep{length,depth})
}else{
Err(Error::bad_config("The media directory structure depth multiplied by the depth is equal to or greater than a sha256 hex hash, please reduce at least one of the two so that their product is less than 64"))
Err(Error::DirectoryStructureLengthDepthTooLarge)
}
}
}
@ -603,7 +640,7 @@ impl TryFrom<ShadowS3MediaBackend> for S3MediaBackend {
"Found rocksdb at database_path, but is not specified in config.",
));
// Only works as these are the only two active backends currently. If there ever were
// to be more than 2, this could get complicated due to there not being attributes
// available on expressions yet: https://github.com/rust-lang/rust/issues/15701
matchconfig.database_backend{
#[cfg(feature = "rocksdb")]
DatabaseBackend::RocksDB=>{
ifsqlite_exists{
returnErr(Error::Initialization(
"Found sqlite at database_path, but is not specified in config.",
));
}
}
#[cfg(feature = "sqlite")]
DatabaseBackend::SQLite=>{
ifrocksdb_exists{
returnErr(Error::Initialization(
"Found rocksdb at database_path, but is not specified in config.",
));
}
}
}
Ok(())
@ -279,23 +277,18 @@ impl KeyValueDatabase {
if!Path::new(&config.database_path).exists(){
fs::create_dir_all(&config.database_path)
.map_err(|_|Error::BadConfig("Database folder doesn't exists and couldn't be created (e.g. due to missing permissions). Please create the database folder yourself."))?;
.map_err(|_|Error::Initialization("Database folder doesn't exists and couldn't be created (e.g. due to missing permissions). Please create the database folder yourself."))?;
error!(config=?s.config.default_room_version,fallback=?crate::config::default_default_room_version(),"Room version in config isn't supported, falling back to default version");
error!(config=?s.config.default_room_version,fallback=?conduit_config::default_default_room_version(),"Room version in config isn't supported, falling back to default version");