radicle_protocol/worker/
fetch.rs

1pub mod error;
2
3use std::collections::HashSet;
4
5use radicle::crypto::PublicKey;
6use radicle::{identity::DocAt, storage::RefUpdate};
7
8#[derive(Debug, Clone)]
9pub struct FetchResult {
10    /// The set of updated references.
11    pub updated: Vec<RefUpdate>,
12    /// The set of remote namespaces that were updated.
13    pub namespaces: HashSet<PublicKey>,
14    /// The fetch was a full clone.
15    pub clone: bool,
16    /// Identity doc of fetched repo.
17    pub doc: DocAt,
18}
19
20impl FetchResult {
21    pub fn new(doc: DocAt) -> Self {
22        Self {
23            updated: vec![],
24            namespaces: HashSet::new(),
25            clone: false,
26            doc,
27        }
28    }
29}
30
31#[cfg(any(test, feature = "test"))]
32impl qcheck::Arbitrary for FetchResult {
33    fn arbitrary(g: &mut qcheck::Gen) -> Self {
34        FetchResult {
35            updated: vec![],
36            namespaces: HashSet::arbitrary(g),
37            clone: bool::arbitrary(g),
38            doc: DocAt::arbitrary(g),
39        }
40    }
41}