Bugfix: Forget to change `overwatch` to `overwatch_rs` (#11)

* direct clone on Bytes instead of deep copy(Bytes::copy_from_slice)

* change overwatch to overwatch_rs
This commit is contained in:
Al Liu 2022-11-22 22:16:07 +08:00 committed by GitHub
parent c127c1d18d
commit e656fb2d9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 16 deletions

View File

@ -1,3 +1,3 @@
pub mod log;
pub mod network;
pub mod storage;
pub mod storage;

View File

@ -1,10 +1,10 @@
use overwatch::services::{
use overwatch_rs::services::{
handle::ServiceStateHandle,
relay::NoMessage,
state::{NoOperator, NoState},
ServiceCore, ServiceData,
};
use serde::{Serialize, Deserialize};
use serde::{Deserialize, Serialize};
use std::net::SocketAddr;
use std::path::PathBuf;
use tracing::Level;
@ -104,16 +104,24 @@ impl ServiceCore for Logger {
}
}
mod serde_level {
use super::Level;
use serde::{Serializer, Serialize, Deserialize, Deserializer, de::Error};
use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer};
pub fn deserialize<'de, D>(deserializer: D) -> Result<Level, D::Error> where D: Deserializer<'de> {
<String>::deserialize(deserializer).and_then(|v| v.parse().map_err(|e| D::Error::custom(format!("invalid log level {}", e))))
pub fn deserialize<'de, D>(deserializer: D) -> Result<Level, D::Error>
where
D: Deserializer<'de>,
{
<String>::deserialize(deserializer).and_then(|v| {
v.parse()
.map_err(|e| D::Error::custom(format!("invalid log level {}", e)))
})
}
pub fn serialize<S>(value: &Level, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
pub fn serialize<S>(value: &Level, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
value.as_str().serialize(serializer)
}
}
}

View File

@ -1,5 +1,5 @@
use super::*;
use overwatch::services::state::ServiceState;
use overwatch_rs::services::state::ServiceState;
use tokio::sync::broadcast::Receiver;
mod waku;

View File

@ -1,6 +1,6 @@
use super::*;
use ::waku::*;
use overwatch::services::state::NoState;
use overwatch_rs::services::state::NoState;
use serde::{Deserialize, Serialize};
use tokio::sync::{
broadcast::{self, Receiver, Sender},

View File

@ -2,7 +2,7 @@ pub mod backends;
use async_trait::async_trait;
use backends::NetworkBackend;
use overwatch::services::{
use overwatch_rs::services::{
handle::ServiceStateHandle,
relay::RelayMessage,
state::{NoOperator, ServiceState},

View File

@ -6,14 +6,14 @@ use std::marker::PhantomData;
// crates
use async_trait::async_trait;
use bytes::Bytes;
use overwatch::services::handle::ServiceStateHandle;
use overwatch_rs::services::handle::ServiceStateHandle;
use serde::de::DeserializeOwned;
// internal
use crate::storage::backends::{StorageSerde, StorageTransaction};
use backends::StorageBackend;
use overwatch::services::relay::RelayMessage;
use overwatch::services::state::{NoOperator, NoState};
use overwatch::services::{ServiceCore, ServiceData, ServiceId};
use overwatch_rs::services::relay::RelayMessage;
use overwatch_rs::services::state::{NoOperator, NoState};
use overwatch_rs::services::{ServiceCore, ServiceData, ServiceId};
use serde::Serialize;
/// Storage message that maps to [`StorageBackend`] trait