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