diff --git a/CHANGELOG.md b/CHANGELOG.md index 1f91b651a..cc69893ca 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,7 @@ - chore: Update libp2p to 0.54. [PR 289](https://github.com/dariusc93/rust-ipfs/pull/289) - chore: Change IpfsOptions visibility, remove UninitializedIpfs::{empty, with_opt}. [PR 294](https://github.com/dariusc93/rust-ipfs/pull/294) - refactor: Support multiple certificates for wss. [PR 295](https://github.com/dariusc93/rust-ipfs/pull/295) +- refactor: Remove redundant static lifetime. [PR 301](https://github.com/dariusc93/rust-ipfs/pull/301) # 0.11.21 - chore: Put libp2p-webrtc-websys behind feature. diff --git a/src/repo/datastore/flatfs.rs b/src/repo/datastore/flatfs.rs index 869e69b36..20dd56b72 100644 --- a/src/repo/datastore/flatfs.rs +++ b/src/repo/datastore/flatfs.rs @@ -136,7 +136,7 @@ fn build_kv, P: AsRef>( ) -> BoxStream<'static, (Vec, Vec)> { let data_path = data_path.as_ref().to_path_buf(); let path = path.as_ref().to_path_buf(); - async_stream::stream! { + let st = async_stream::stream! { if path.is_file() { return; } @@ -171,8 +171,9 @@ fn build_kv, P: AsRef>( } } } - } - .boxed() + }; + + st.boxed() } /// The column operations are all unimplemented pending at least downscoping of the diff --git a/src/repo/mod.rs b/src/repo/mod.rs index 49af6d712..25852b868 100644 --- a/src/repo/mod.rs +++ b/src/repo/mod.rs @@ -64,7 +64,7 @@ pub enum BlockRmError { /// This API is being discussed and evolved, which will likely lead to breakage. #[async_trait] -pub trait BlockStore: Debug + Send + Sync + 'static { +pub trait BlockStore: Debug + Send + Sync { async fn init(&self) -> Result<(), Error>; /// FIXME: redundant and never called during initialization, which is expected to happen during [`init`]. async fn open(&self) -> Result<(), Error>; @@ -88,7 +88,7 @@ pub trait BlockStore: Debug + Send + Sync + 'static { #[async_trait] /// Generic layer of abstraction for a key-value data store. -pub trait DataStore: PinStore + Debug + Send + Sync + 'static { +pub trait DataStore: PinStore + Debug + Send + Sync { async fn init(&self) -> Result<(), Error>; async fn open(&self) -> Result<(), Error>; /// Checks if a key is present in the datastore. @@ -179,7 +179,7 @@ impl error::Error for LockError { /// /// This ensures no two IPFS nodes can be started with the same peer ID, as exclusive access to the /// repository is guarenteed. This is most useful when using an fs backed repo. -pub trait Lock: Debug + Send + Sync + 'static { +pub trait Lock: Debug + Send + Sync { // fn new(path: PathBuf) -> Self; fn try_exclusive(&self) -> Result<(), LockError>; } @@ -187,7 +187,7 @@ pub trait Lock: Debug + Send + Sync + 'static { type References<'a> = futures::stream::BoxStream<'a, Result>; #[async_trait] -pub trait PinStore: Debug + Send + Sync + Unpin + 'static { +pub trait PinStore: Debug + Send + Sync { async fn is_pinned(&self, block: &Cid) -> Result; async fn insert_direct_pin(&self, target: &Cid) -> Result<(), Error>;