node: Remove namespaces from fetch request
It was unused..
This commit is contained in:
parent
f2fe0242e1
commit
6ff4efebed
|
|
@ -963,10 +963,7 @@ where
|
|||
refs_at: refs_at.clone(),
|
||||
subscribers: vec![],
|
||||
});
|
||||
let namespaces = self.policies.namespaces_for(&self.storage, &rid)?;
|
||||
|
||||
self.outbox
|
||||
.fetch(session, rid, namespaces, refs_at, timeout);
|
||||
self.outbox.fetch(session, rid, refs_at, timeout);
|
||||
|
||||
debug!(
|
||||
target: "service",
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ use radicle::storage::refs::RefsAt;
|
|||
use crate::prelude::*;
|
||||
use crate::service::session::Session;
|
||||
use crate::service::Link;
|
||||
use crate::storage::Namespaces;
|
||||
|
||||
use super::gossip;
|
||||
use super::message::{Announcement, AnnouncementMessage};
|
||||
|
|
@ -27,8 +26,6 @@ pub enum Io {
|
|||
rid: RepoId,
|
||||
/// Remote node being fetched from.
|
||||
remote: NodeId,
|
||||
/// Namespaces being fetched.
|
||||
namespaces: Namespaces,
|
||||
/// If the node is fetching specific `rad/sigrefs`.
|
||||
refs_at: Option<Vec<RefsAt>>,
|
||||
/// Fetch timeout.
|
||||
|
|
@ -125,7 +122,6 @@ impl Outbox {
|
|||
&mut self,
|
||||
remote: &mut Session,
|
||||
rid: RepoId,
|
||||
namespaces: Namespaces,
|
||||
refs_at: Vec<RefsAt>,
|
||||
timeout: time::Duration,
|
||||
) {
|
||||
|
|
@ -134,7 +130,6 @@ impl Outbox {
|
|||
let refs_at = (!refs_at.is_empty()).then_some(refs_at);
|
||||
self.io.push_back(Io::Fetch {
|
||||
rid,
|
||||
namespaces,
|
||||
refs_at,
|
||||
remote: remote.id,
|
||||
timeout,
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ use crate::service::policy::{Policy, Scope};
|
|||
use crate::service::*;
|
||||
use crate::storage::git::transport::remote;
|
||||
use crate::storage::Inventory;
|
||||
use crate::storage::{Namespaces, RemoteId, WriteStorage};
|
||||
use crate::storage::{RemoteId, WriteStorage};
|
||||
use crate::test::storage::MockStorage;
|
||||
use crate::test::{arbitrary, fixtures, simulator};
|
||||
use crate::wire::MessageType;
|
||||
|
|
@ -476,16 +476,10 @@ where
|
|||
}
|
||||
|
||||
/// Get a draining iterator over the peer's I/O outbox, which only returns fetches.
|
||||
pub fn fetches(&mut self) -> impl Iterator<Item = (RepoId, NodeId, Namespaces)> + '_ {
|
||||
pub fn fetches(&mut self) -> impl Iterator<Item = (RepoId, NodeId)> + '_ {
|
||||
iter::from_fn(|| self.service.outbox().next()).filter_map(|io| {
|
||||
if let Io::Fetch {
|
||||
rid,
|
||||
remote,
|
||||
namespaces,
|
||||
..
|
||||
} = io
|
||||
{
|
||||
Some((rid, remote, namespaces))
|
||||
if let Io::Fetch { rid, remote, .. } = io {
|
||||
Some((rid, remote))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
|||
|
|
@ -627,12 +627,7 @@ impl<S: WriteStorage + 'static, G: Signer> Simulation<S, G> {
|
|||
);
|
||||
}
|
||||
}
|
||||
Io::Fetch {
|
||||
rid,
|
||||
remote,
|
||||
namespaces,
|
||||
..
|
||||
} => {
|
||||
Io::Fetch { rid, remote, .. } => {
|
||||
log::info!(
|
||||
target: "sim",
|
||||
"{:05} {} ~> {} ({}): Fetch outgoing",
|
||||
|
|
@ -663,10 +658,7 @@ impl<S: WriteStorage + 'static, G: Signer> Simulation<S, G> {
|
|||
remote,
|
||||
Rc::new(Ok(fetch::FetchResult {
|
||||
updated: vec![],
|
||||
namespaces: match namespaces {
|
||||
Namespaces::Followed(hs) => hs,
|
||||
Namespaces::All => HashSet::new(),
|
||||
},
|
||||
namespaces: HashSet::new(),
|
||||
clone: true,
|
||||
doc: arbitrary::gen(1),
|
||||
})),
|
||||
|
|
|
|||
|
|
@ -1365,7 +1365,7 @@ fn test_queued_fetch_max_capacity() {
|
|||
alice.command(Command::Fetch(rid3, bob.id, DEFAULT_TIMEOUT, send3));
|
||||
|
||||
// The first fetch is initiated.
|
||||
assert_matches!(alice.fetches().next(), Some((rid, _, _)) if rid == rid1);
|
||||
assert_matches!(alice.fetches().next(), Some((rid, _)) if rid == rid1);
|
||||
// We shouldn't send out the 2nd, 3rd fetch while we're doing the 1st fetch.
|
||||
assert_matches!(alice.outbox().next(), None);
|
||||
|
||||
|
|
@ -1375,14 +1375,14 @@ fn test_queued_fetch_max_capacity() {
|
|||
// Finish the 1st fetch.
|
||||
alice.fetched(rid1, bob.id, Ok(fetch::FetchResult::new(doc.clone())));
|
||||
// Now the 1st fetch is done, the 2nd fetch is dequeued.
|
||||
assert_matches!(alice.fetches().next(), Some((rid, _, _)) if rid == rid2);
|
||||
assert_matches!(alice.fetches().next(), Some((rid, _)) if rid == rid2);
|
||||
// ... but not the third.
|
||||
assert_matches!(alice.fetches().next(), None);
|
||||
|
||||
// Finish the 2nd fetch.
|
||||
alice.fetched(rid2, bob.id, Ok(fetch::FetchResult::new(doc)));
|
||||
// Now the 2nd fetch is done, the 3rd fetch is dequeued.
|
||||
assert_matches!(alice.fetches().next(), Some((rid, _, _)) if rid == rid3);
|
||||
assert_matches!(alice.fetches().next(), Some((rid, _)) if rid == rid3);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -1421,7 +1421,7 @@ fn test_queued_fetch_from_ann_same_rid() {
|
|||
alice.receive(carol.id, carol.announcement(ann));
|
||||
|
||||
// The first fetch is initiated.
|
||||
assert_matches!(alice.fetches().next(), Some((rid_, nid_, _)) if rid_ == rid && nid_ == bob.id);
|
||||
assert_matches!(alice.fetches().next(), Some((rid_, nid_)) if rid_ == rid && nid_ == bob.id);
|
||||
// We shouldn't send out the 2nd, 3rd fetch while we're doing the 1st fetch.
|
||||
assert_matches!(alice.fetches().next(), None);
|
||||
|
||||
|
|
@ -1490,7 +1490,7 @@ fn test_queued_fetch_from_command_same_rid() {
|
|||
alice.command(Command::Fetch(rid1, carol.id, DEFAULT_TIMEOUT, send3));
|
||||
|
||||
// The first fetch is initiated.
|
||||
assert_matches!(alice.fetches().next(), Some((rid, nid, _)) if rid == rid1 && nid == bob.id);
|
||||
assert_matches!(alice.fetches().next(), Some((rid, nid)) if rid == rid1 && nid == bob.id);
|
||||
// We shouldn't send out the 2nd, 3rd fetch while we're doing the 1st fetch.
|
||||
assert_matches!(alice.outbox().next(), None);
|
||||
|
||||
|
|
@ -1500,14 +1500,14 @@ fn test_queued_fetch_from_command_same_rid() {
|
|||
// Finish the 1st fetch.
|
||||
alice.fetched(rid1, bob.id, Ok(arbitrary::gen::<fetch::FetchResult>(1)));
|
||||
// Now the 1st fetch is done, the 2nd fetch is dequeued.
|
||||
assert_matches!(alice.fetches().next(), Some((rid, nid, _)) if rid == rid1 && nid == eve.id);
|
||||
assert_matches!(alice.fetches().next(), Some((rid, nid)) if rid == rid1 && nid == eve.id);
|
||||
// ... but not the third.
|
||||
assert_matches!(alice.fetches().next(), None);
|
||||
|
||||
// Finish the 2nd fetch.
|
||||
alice.fetched(rid1, eve.id, Ok(arbitrary::gen::<fetch::FetchResult>(1)));
|
||||
// Now the 2nd fetch is done, the 3rd fetch is dequeued.
|
||||
assert_matches!(alice.fetches().next(), Some((rid, nid, _)) if rid == rid1 && nid == carol.id);
|
||||
assert_matches!(alice.fetches().next(), Some((rid, nid)) if rid == rid1 && nid == carol.id);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
|
|||
|
|
@ -964,7 +964,6 @@ where
|
|||
remote,
|
||||
timeout,
|
||||
refs_at,
|
||||
..
|
||||
} => {
|
||||
log::trace!(target: "wire", "Processing fetch for {rid} from {remote}..");
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue