This commit is contained in:
mdecimus
2024-08-01 17:09:39 +02:00
parent ed214fd087
commit 3cb8918d2e
34 changed files with 500 additions and 388 deletions

View File

@@ -111,7 +111,7 @@ impl ElasticSearchStore {
.exists(IndicesExistsParts::Index(&[INDEX_NAMES[0]]))
.send()
.await
.map_err(|err| trc::StoreEvent::ElasticSearchError.reason(err))?;
.map_err(|err| trc::StoreEvent::ElasticsearchError.reason(err))?;
if exists.status_code() == StatusCode::NOT_FOUND {
let response = self
@@ -183,11 +183,11 @@ pub(crate) async fn assert_success(response: Result<Response, Error>) -> trc::Re
if status.is_success() {
Ok(response)
} else {
Err(trc::StoreEvent::ElasticSearchError
Err(trc::StoreEvent::ElasticsearchError
.reason(response.text().await.unwrap_or_default())
.ctx(trc::Key::Code, status.as_u16()))
}
}
Err(err) => Err(trc::StoreEvent::ElasticSearchError.reason(err)),
Err(err) => Err(trc::StoreEvent::ElasticsearchError.reason(err)),
}
}

View File

@@ -107,14 +107,14 @@ impl ElasticSearchStore {
let json: Value = response
.json()
.await
.map_err(|err| trc::StoreEvent::ElasticSearchError.reason(err))?;
.map_err(|err| trc::StoreEvent::ElasticsearchError.reason(err))?;
let mut results = RoaringBitmap::new();
for hit in json["hits"]["hits"].as_array().ok_or_else(|| {
trc::StoreEvent::ElasticSearchError.reason("Invalid response from ElasticSearch")
trc::StoreEvent::ElasticsearchError.reason("Invalid response from ElasticSearch")
})? {
results.insert(hit["_source"]["document_id"].as_u64().ok_or_else(|| {
trc::StoreEvent::ElasticSearchError.reason("Invalid response from ElasticSearch")
trc::StoreEvent::ElasticsearchError.reason("Invalid response from ElasticSearch")
})? as u32);
}

View File

@@ -77,7 +77,7 @@ impl TimedTransaction {
#[inline(always)]
fn into_error(error: FdbError) -> trc::Error {
trc::StoreEvent::FoundationDBError
trc::StoreEvent::FoundationdbError
.reason(error.message())
.ctx(trc::Key::Code, error.code())
}

View File

@@ -94,7 +94,7 @@ impl FdbStore {
*key.last_mut().unwrap() += 1;
} else {
trx.cancel();
return Err(trc::StoreEvent::FoundationDBError
return Err(trc::StoreEvent::FoundationdbError
.ctx(
trc::Key::Reason,
"Value is too large",

View File

@@ -20,5 +20,5 @@ pub struct MysqlStore {
#[inline(always)]
fn into_error(err: impl Display) -> trc::Error {
trc::StoreEvent::MySQLError.reason(err)
trc::StoreEvent::MysqlError.reason(err)
}

View File

@@ -21,5 +21,5 @@ pub struct PostgresStore {
#[inline(always)]
fn into_error(err: impl Display) -> trc::Error {
trc::StoreEvent::PostgreSQLError.reason(err)
trc::StoreEvent::PostgresqlError.reason(err)
}

View File

@@ -38,5 +38,5 @@ pub struct RocksDbStore {
#[inline(always)]
fn into_error(err: rocksdb::Error) -> trc::Error {
trc::StoreEvent::RocksDBError.reason(err)
trc::StoreEvent::RocksdbError.reason(err)
}

View File

@@ -24,5 +24,5 @@ pub struct SqliteStore {
#[inline(always)]
fn into_error(err: impl Display) -> trc::Error {
trc::StoreEvent::SQLiteError.reason(err)
trc::StoreEvent::SqliteError.reason(err)
}