Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
karolisg committed Mar 4, 2024
1 parent 2c9727f commit d6b0fd6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
11 changes: 7 additions & 4 deletions dozer-ingestion/aerospike/src/connector.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use dozer_ingestion_connector::dozer_types::errors::internal::BoxedError;
use dozer_ingestion_connector::dozer_types::event::Event;
use dozer_ingestion_connector::dozer_types::log::{debug, error, info, warn};
use dozer_ingestion_connector::dozer_types::log::{error, info, trace, warn};
use dozer_ingestion_connector::dozer_types::models::connection::AerospikeConnection;
use dozer_ingestion_connector::dozer_types::models::ingestion_types::{
IngestionMessage, TransactionInfo,
Expand Down Expand Up @@ -112,6 +112,9 @@ pub enum AerospikeConnectorError {

#[error("Failed parsing timestamp: {0}")]
TimestampParsingError(#[from] dozer_ingestion_connector::dozer_types::chrono::ParseError),

#[error("Key is neither string or int")]
KeyNotSupported(Value),
}

#[derive(Deserialize, Debug)]
Expand Down Expand Up @@ -314,15 +317,15 @@ async fn event_request_handler(
let event = json.into_inner();
let state = data.into_inner();

debug!("Event data: {:?}", event);
trace!("Event data: {:?}", event);
// TODO: Handle delete
if event.msg != "write" {
return HttpResponse::Ok().finish();
}

let operation_events = map_events(event, &state.tables_index_map).await;

debug!("Mapped events {:?}", operation_events);
trace!("Mapped events {:?}", operation_events);
match operation_events {
Ok(None) => HttpResponse::Ok().finish(),
Ok(Some(message)) => {
Expand Down Expand Up @@ -646,7 +649,7 @@ async fn map_events(
.ok_or(AerospikeConnectorError::ParsingUIntFailed)?,
);
}
_ => todo!("Throw error when key is not a string or number"),
v => return Err(AerospikeConnectorError::KeyNotSupported(v)),
}
} else {
return Err(AerospikeConnectorError::PkIsNone(key0, table_name, key2));
Expand Down
7 changes: 2 additions & 5 deletions dozer-sink-aerospike/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,16 +243,13 @@ impl Client {
response: &mut *mut i8,
) -> Result<(), AerospikeError> {
as_try(|err| {
let res = aerospike_info_any(
aerospike_info_any(
self.inner.as_ptr(),
err,
null(),
request.as_ptr(),
response as *mut *mut i8,
);
let response_string = CStr::from_ptr(*response);
println!("response: [{:?}] {:?}", res, response_string);
res
)
})
}
}
Expand Down

0 comments on commit d6b0fd6

Please sign in to comment.