Skip to content

Commit

Permalink
refactor: Remove redundant static lifetime (#301)
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusc93 committed Sep 4, 2024
1 parent 7599156 commit dcad6fb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 4 additions & 3 deletions src/repo/datastore/flatfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fn build_kv<R: AsRef<Path>, P: AsRef<Path>>(
) -> BoxStream<'static, (Vec<u8>, Vec<u8>)> {
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;
}
Expand Down Expand Up @@ -171,8 +171,9 @@ fn build_kv<R: AsRef<Path>, P: AsRef<Path>>(
}
}
}
}
.boxed()
};

st.boxed()
}

/// The column operations are all unimplemented pending at least downscoping of the
Expand Down
8 changes: 4 additions & 4 deletions src/repo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
Expand All @@ -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.
Expand Down Expand Up @@ -179,15 +179,15 @@ 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>;
}

type References<'a> = futures::stream::BoxStream<'a, Result<Cid, crate::refs::IpldRefsError>>;

#[async_trait]
pub trait PinStore: Debug + Send + Sync + Unpin + 'static {
pub trait PinStore: Debug + Send + Sync {
async fn is_pinned(&self, block: &Cid) -> Result<bool, Error>;

async fn insert_direct_pin(&self, target: &Cid) -> Result<(), Error>;
Expand Down

0 comments on commit dcad6fb

Please sign in to comment.