edenapi/types: add types for the new fast pull API

Summary:
Instead of passing just the old and new master nodes. Pass a list to support
more complicated cases.

Reviewed By: DurhamG

Differential Revision: D33594530

fbshipit-source-id: 2087d4fce79eb5cff3c1d381cfc82f9bd6ad89c4
This commit is contained in:
Jun Wu 2022-01-19 16:35:42 -08:00 committed by Facebook GitHub Bot
parent 19342c116d
commit 360dbdf66d
2 changed files with 27 additions and 0 deletions

View File

@ -19,6 +19,16 @@ pub struct PullFastForwardRequest {
pub new_master: HgId,
}
/// Pull `missing % common` in the master group.
#[auto_wire]
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct PullLazyRequest {
#[id(1)]
pub common: Vec<HgId>,
#[id(2)]
pub missing: Vec<HgId>,
}
#[cfg(any(test, feature = "for-tests"))]
impl Arbitrary for PullFastForwardRequest {
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
@ -29,10 +39,21 @@ impl Arbitrary for PullFastForwardRequest {
}
}
#[cfg(any(test, feature = "for-tests"))]
impl Arbitrary for PullLazyRequest {
fn arbitrary(g: &mut quickcheck::Gen) -> Self {
Self {
common: Arbitrary::arbitrary(g),
missing: Arbitrary::arbitrary(g),
}
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::wire::tests::auto_wire_tests;
auto_wire_tests!(WirePullFastForwardRequest);
auto_wire_tests!(WirePullLazyRequest);
}

View File

@ -0,0 +1,6 @@
---
source: pull.rs
expression: "WirePullLazyRequest::arbitrary(&mut g)"
---
{"1":[[136,231,250,132,19,212,76,218,174,127,211,79,1,180,239,159,71,129,237,47]],"2":[[59,183,155,157,133,85,4,46,38,85,25,36,58,55,101,239,1,100,81,21],[29,1,4,212,7,211,178,104,186,230,81,160,133,254,52,10,95,232,130,59]]}