use dope_core::driver::{route::Identity, schedule::clock};
use crate::{
app::env,
client::{session, side},
network::client::{Connector, Engine, work::WorkGraph},
service::{discover, sync},
};
pub struct Prepared<
'q,
'h,
'p,
'w,
'd: 'w,
ID: Identity,
const MAX: usize,
N,
R,
I,
E,
const ENDPOINTS: usize,
> where
N: session::Target<'d, ID, MAX>,
E: env::Spec,
E::Transport: dope_net::Transport,
I: Eq,
R: sync::Policy,
{
pub(super) engine:
Engine<'q, 'h, 'p, 'w, 'd, ID, N, R, I, E, ENDPOINTS, discover::Notify, side::Disabled>,
}
impl<'q, 'h, 'p, 'w, 'd: 'w, ID: Identity, const MAX: usize, N, R, I, E, const ENDPOINTS: usize>
Prepared<'q, 'h, 'p, 'w, 'd, ID, MAX, N, R, I, E, ENDPOINTS>
where
N: session::Target<'d, ID, MAX>,
E: env::Spec,
E::Transport: dope_net::Transport,
I: Eq,
R: sync::Policy,
{
pub fn discover<D: discover::Output + discover::RefreshAt<'d>, O>(
self,
lookup: D,
watch: O,
at: clock::Moment<'d>,
) -> Connector<'q, 'h, 'p, 'w, 'd, ID, MAX, N, discover::Refreshing<'d, D>, R, I, O, E, ENDPOINTS>
{
Connector {
engine: self.engine,
discovery: discover::Refreshing::new(lookup, at),
observer: watch,
work: WorkGraph::new(),
}
}
}