Skip to content

Commit

Permalink
Merge branch 'libp2p-next' into refactor/borrow-type
Browse files Browse the repository at this point in the history
  • Loading branch information
dariusc93 authored Sep 28, 2024
2 parents 10f4752 + 3a48b8f commit 05f5688
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
4 changes: 1 addition & 3 deletions src/repo/datastore/flatfs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ use tokio_util::either::Either;
/// their indirect descendants. Pin files are separated by their file extensions.
///
/// When modifying, single lock is used.
///
/// For the [`crate::repo::PinStore`] implementation see `fs/pinstore.rs`.
#[derive(Debug)]
pub struct FsDataStore {
/// The base directory under which we have a sharded directory structure, and the individual
Expand Down Expand Up @@ -439,7 +437,7 @@ impl PinStore for FsDataStore {
async fn list(
&self,
requirement: Option<PinMode>,
) -> futures::stream::BoxStream<'static, Result<(Cid, PinMode), Error>> {
) -> BoxStream<'static, Result<(Cid, PinMode), Error>> {
// no locking, dirty reads are probably good enough until gc
let cids = self.list_pinfiles().await;

Expand Down
27 changes: 13 additions & 14 deletions src/repo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ pub trait Lock: Debug + Send + Sync {
fn try_exclusive(&self) -> Result<(), LockError>;
}

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

#[async_trait]
pub trait PinStore: Debug + Send + Sync {
Expand Down Expand Up @@ -303,12 +303,11 @@ pub enum PinKind<C: Borrow<Cid>> {

impl<C: Borrow<Cid>> PinKind<C> {
fn as_ref(&self) -> PinKind<&'_ Cid> {
use PinKind::*;
match self {
IndirectFrom(c) => PinKind::IndirectFrom(c.borrow()),
Direct => PinKind::Direct,
Recursive(count) => PinKind::Recursive(*count),
RecursiveIntention => PinKind::RecursiveIntention,
PinKind::IndirectFrom(c) => PinKind::IndirectFrom(c.borrow()),
PinKind::Direct => PinKind::Direct,
PinKind::Recursive(count) => PinKind::Recursive(*count),
PinKind::RecursiveIntention => PinKind::RecursiveIntention,
}
}
}
Expand Down Expand Up @@ -964,7 +963,7 @@ impl Repo {
pub async fn list_pins(
&self,
mode: impl Into<Option<PinMode>>,
) -> futures::stream::BoxStream<'static, Result<(Cid, PinMode), Error>> {
) -> BoxStream<'static, Result<(Cid, PinMode), Error>> {
let mode = mode.into();
self.inner.data_store.list(mode).await
}
Expand Down Expand Up @@ -1128,8 +1127,8 @@ impl RepoFetch {
}
}

impl std::future::IntoFuture for RepoFetch {
type Output = Result<(), anyhow::Error>;
impl IntoFuture for RepoFetch {
type Output = Result<(), Error>;

type IntoFuture = BoxFuture<'static, Self::Output>;

Expand Down Expand Up @@ -1257,8 +1256,8 @@ impl RepoInsertPin {
}
}

impl std::future::IntoFuture for RepoInsertPin {
type Output = Result<(), anyhow::Error>;
impl IntoFuture for RepoInsertPin {
type Output = Result<(), Error>;

type IntoFuture = BoxFuture<'static, Self::Output>;

Expand Down Expand Up @@ -1332,8 +1331,8 @@ impl RepoRemovePin {
}
}

impl std::future::IntoFuture for RepoRemovePin {
type Output = Result<(), anyhow::Error>;
impl IntoFuture for RepoRemovePin {
type Output = Result<(), Error>;

type IntoFuture = BoxFuture<'static, Self::Output>;

Expand Down Expand Up @@ -1363,7 +1362,7 @@ impl std::future::IntoFuture for RepoRemovePin {
.refs
.with_only_unique()
.with_existing_blocks()
.refs_of_resolved(&repo, vec![(cid, ipld.clone())])
.refs_of_resolved(&repo, vec![(cid, ipld)])
.map_ok(|crate::refs::Edge { destination, .. }| destination)
.into_stream()
.boxed();
Expand Down

0 comments on commit 05f5688

Please sign in to comment.