node: Add track/untrack support

Signed-off-by: Slack Coder <slackcoder@server.ky>
This commit is contained in:
Slack Coder
2022-09-13 10:16:05 +02:00
committed by Alexis Sellier
parent 8fbcb51963
commit d273cd0247
5 changed files with 117 additions and 7 deletions
+9 -1
View File
@@ -86,9 +86,11 @@ pub enum FetchResult {
/// Commands sent to the protocol by the operator.
#[derive(Debug)]
pub enum Command {
AnnounceRefsUpdate(ProjId),
Connect(net::SocketAddr),
Fetch(ProjId, chan::Sender<FetchLookup>),
AnnounceRefsUpdate(ProjId),
Track(ProjId, chan::Sender<bool>),
Untrack(ProjId, chan::Sender<bool>),
}
/// Command-related errors.
@@ -412,6 +414,12 @@ where
}
}
}
Command::Track(proj, resp) => {
resp.send(self.track(proj)).ok();
}
Command::Untrack(proj, resp) => {
resp.send(self.untrack(proj)).ok();
}
Command::AnnounceRefsUpdate(proj) => {
let user = *self.storage.user_id();
let repo = self.storage.repository(&proj).unwrap();