feat: with String EventInfo

Signed-off-by: kjuulh <contact@kjuulh.io>
This commit is contained in:
2023-10-05 22:09:56 +02:00
parent bc28451f8d
commit 4a88d2fecd
13 changed files with 89 additions and 131 deletions

View File

@@ -33,10 +33,11 @@ pub struct InMemoryPersistence {
#[async_trait]
impl crunch_traits::Persistence for InMemoryPersistence {
async fn insert(&self, event_info: &EventInfo, content: Vec<u8>) -> anyhow::Result<()> {
let msg = crunch_envelope::proto::wrap(event_info.domain, event_info.entity_type, &content);
let msg =
crunch_envelope::proto::wrap(&event_info.domain, &event_info.entity_type, &content);
let msg = Msg {
id: uuid::Uuid::new_v4().to_string(),
info: *event_info,
info: event_info.to_owned(),
msg,
state: MsgState::Pending,
};
@@ -71,7 +72,7 @@ impl crunch_traits::Persistence for InMemoryPersistence {
let (content, _) = crunch_envelope::proto::unwrap(event.msg.as_slice())
.map_err(|e| PersistenceError::GetErr(anyhow::anyhow!(e)))?;
Ok(Some((event.info, content)))
Ok(Some((event.info.to_owned(), content)))
}
async fn update_published(&self, event_id: &str) -> Result<(), PersistenceError> {

View File

@@ -64,7 +64,7 @@ impl Transport for InMemoryTransport {
.expect("transport to be available, as we just created it");
sender
.send(TransportEnvelope {
info: *event_info,
info: event_info.to_owned(),
content,
})
.map_err(|e| anyhow::anyhow!(e.to_string()))