Skip to content
This repository was archived by the owner on Oct 23, 2022. It is now read-only.

Commit e358030

Browse files
bors[bot]Joonas Koivunen
andauthored
Merge #397
397: Prepare bitswap release r=koivunej a=koivunej Renames `bitswap` crate for `ipfs-bitswap` and format fallout for the change. To help with upcoming work I changed the ```diff -use bitswap::Block; +use crate::Block; ``` Co-authored-by: Joonas Koivunen <joonas@equilibrium.co>
2 parents ea9fa68 + e9d41e4 commit e358030

File tree

10 files changed

+48
-38
lines changed

10 files changed

+48
-38
lines changed

Cargo.lock

Lines changed: 19 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ anyhow = { default-features = false, version = "1.0" }
1515
async-stream = { default-features = false, version = "0.3" }
1616
async-trait = { default-features = false, version = "0.1" }
1717
base64 = { default-features = false, features = ["alloc"], version = "0.12" }
18-
bitswap = { path = "bitswap" }
18+
ipfs-bitswap = { path = "bitswap" }
1919
byteorder = { default-features = false, version = "1.3" }
2020
bytes = { default-features = false, version = "0.5" }
2121
cid = { default-features = false, version = "0.5" }

bitswap/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
authors = ["Rust-IPFS contributors"]
33
edition = "2018"
4-
name = "bitswap"
4+
name = "ipfs-bitswap"
55
version = "0.1.0"
66

77
[build-dependencies]

src/dag.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ use crate::error::Error;
44
use crate::ipld::{decode_ipld, encode_ipld, Ipld};
55
use crate::path::{IpfsPath, SlashedPath};
66
use crate::repo::RepoTypes;
7-
use crate::Ipfs;
8-
use bitswap::Block;
7+
use crate::{Block, Ipfs};
98
use cid::{Cid, Codec, Version};
109
use ipfs_unixfs::{
1110
dagpb::{wrap_node_data, NodeData},

src/lib.rs

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ pub use self::{
8181
path::IpfsPath,
8282
repo::{PinKind, PinMode, RepoTypes},
8383
};
84-
pub use bitswap::Block;
8584
pub use cid::Cid;
85+
pub use ipfs_bitswap::Block;
8686
pub use libp2p::{
8787
core::{connection::ListenerId, multiaddr::Protocol, Multiaddr, PeerId, PublicKey},
8888
identity::Keypair,
@@ -260,7 +260,10 @@ enum IpfsEvent {
260260
PubsubPublish(String, Vec<u8>, OneshotSender<()>),
261261
PubsubPeers(Option<String>, OneshotSender<Vec<PeerId>>),
262262
PubsubSubscribed(OneshotSender<Vec<String>>),
263-
WantList(Option<PeerId>, OneshotSender<Vec<(Cid, bitswap::Priority)>>),
263+
WantList(
264+
Option<PeerId>,
265+
OneshotSender<Vec<(Cid, ipfs_bitswap::Priority)>>,
266+
),
264267
BitswapStats(OneshotSender<BitswapStats>),
265268
AddListeningAddress(Multiaddr, Channel<Multiaddr>),
266269
RemoveListeningAddress(Multiaddr, Channel<()>),
@@ -809,7 +812,7 @@ impl<Types: IpfsTypes> Ipfs<Types> {
809812
pub async fn bitswap_wantlist(
810813
&self,
811814
peer: Option<PeerId>,
812-
) -> Result<Vec<(Cid, bitswap::Priority)>, Error> {
815+
) -> Result<Vec<(Cid, ipfs_bitswap::Priority)>, Error> {
813816
async move {
814817
let (tx, rx) = oneshot_channel();
815818

@@ -1568,12 +1571,22 @@ pub struct BitswapStats {
15681571
/// The current peers
15691572
pub peers: Vec<PeerId>,
15701573
/// The wantlist of the local node
1571-
pub wantlist: Vec<(Cid, bitswap::Priority)>,
1574+
pub wantlist: Vec<(Cid, ipfs_bitswap::Priority)>,
15721575
}
15731576

1574-
impl From<(bitswap::Stats, Vec<PeerId>, Vec<(Cid, bitswap::Priority)>)> for BitswapStats {
1577+
impl
1578+
From<(
1579+
ipfs_bitswap::Stats,
1580+
Vec<PeerId>,
1581+
Vec<(Cid, ipfs_bitswap::Priority)>,
1582+
)> for BitswapStats
1583+
{
15751584
fn from(
1576-
(stats, peers, wantlist): (bitswap::Stats, Vec<PeerId>, Vec<(Cid, bitswap::Priority)>),
1585+
(stats, peers, wantlist): (
1586+
ipfs_bitswap::Stats,
1587+
Vec<PeerId>,
1588+
Vec<(Cid, ipfs_bitswap::Priority)>,
1589+
),
15771590
) -> Self {
15781591
BitswapStats {
15791592
blocks_sent: stats.sent_blocks.load(Ordering::Relaxed),

src/p2p/behaviour.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ use crate::repo::{BlockPut, Repo};
66
use crate::subscription::{SubscriptionFuture, SubscriptionRegistry};
77
use crate::IpfsTypes;
88
use anyhow::anyhow;
9-
use bitswap::{Bitswap, BitswapEvent};
109
use cid::Cid;
10+
use ipfs_bitswap::{Bitswap, BitswapEvent};
1111
use libp2p::core::{Multiaddr, PeerId};
1212
use libp2p::identify::{Identify, IdentifyEvent};
1313
use libp2p::kad::record::{store::MemoryStore, Key, Record};

src/repo/fs/blocks.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ use super::{block_path, filestem_to_block_cid};
22
use super::{BlockRm, BlockRmError, RepoCid};
33
use crate::error::Error;
44
use crate::repo::{BlockPut, BlockStore};
5+
use crate::Block;
56
use async_trait::async_trait;
6-
use bitswap::Block;
77
use cid::Cid;
88
use std::collections::HashMap;
99
use std::hash::Hash;
@@ -434,7 +434,7 @@ fn write_through_tempfile(
434434
#[cfg(test)]
435435
mod tests {
436436
use super::*;
437-
use bitswap::Block;
437+
use crate::Block;
438438
use cid::{Cid, Codec};
439439
use hex_literal::hex;
440440
use multihash::Sha2_256;

src/repo/mem.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
//! Volatile memory backed repo
22
use crate::error::Error;
33
use crate::repo::{BlockPut, BlockStore, Column, DataStore, PinKind, PinMode, PinStore};
4+
use crate::Block;
45
use async_trait::async_trait;
5-
use bitswap::Block;
66
use cid::Cid;
77
use std::convert::TryFrom;
88
use std::path::PathBuf;
@@ -654,7 +654,7 @@ crate::pinstore_interface_tests!(common_tests, crate::repo::mem::MemDataStore::n
654654
#[cfg(test)]
655655
mod tests {
656656
use super::*;
657-
use bitswap::Block;
657+
use crate::Block;
658658
use cid::{Cid, Codec};
659659
use multihash::Sha2_256;
660660
use std::env::temp_dir;

src/repo/mod.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,8 @@ use crate::error::Error;
33
use crate::p2p::KadResult;
44
use crate::path::IpfsPath;
55
use crate::subscription::{RequestKind, SubscriptionFuture, SubscriptionRegistry};
6-
use crate::IpfsOptions;
6+
use crate::{Block, IpfsOptions};
77
use async_trait::async_trait;
8-
use bitswap::Block;
98
use cid::{self, Cid};
109
use core::convert::TryFrom;
1110
use core::fmt::Debug;

src/unixfs/cat.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
use crate::{
22
dag::{ResolveError, UnexpectedResolved},
3-
Error, Ipfs, IpfsTypes,
3+
Block, Error, Ipfs, IpfsTypes,
44
};
55
use async_stream::stream;
6-
use bitswap::Block;
76
use cid::Cid;
87
use futures::stream::Stream;
98
use ipfs_unixfs::file::{visit::IdleFileVisit, FileReadFailed};

0 commit comments

Comments
 (0)