pub trait VrpSource: Clone + Sync + Send + 'static {
type FullIter: Iterator<Item = Payload> + Sync + Send + 'static;
type DiffIter: Iterator<Item = (Action, Payload)> + Sync + Send + 'static;
fn ready(&self) -> bool;
fn notify(&self) -> State;
fn full(&self) -> (State, Self::FullIter);
fn diff(&self, state: State) -> Option<(State, Self::DiffIter)>;
fn timing(&self) -> Timing;
}
Expand description
A source of VRPs for an RTR server.
A type implementing this trait can be used by the Server
as a source
for VRPs. The server needs four things from such a source:
- the current state of the source through the
notify
method, - an iterator over the full set of VRPs via the
full
method, - an iterator over the difference of the data between the given state
and the current state via the
diff
method, and - the current timing values via the
timing
method.
The server will never ask for any of these things unless the ready
method returns true
. This allows the source to finish its initial
validation.
Required Associated Types
An iterator over the complete set of VRPs.
Required Methods
Returns the current state of the source.
This is used by the source when sending out a serial notify .
Returns the current state and an iterator over the full set of VRPs.
Returns the current state and an interator over differences in VPRs.
The difference is between the state given in state
and the current
state. If the source cannot provide this difference, for instance
because the serial is too old, it returns None
instead.