Struct Sequence
pub struct Sequence { /* private fields */ }Expand description
FCO’s per-Lyquid handle for the backend to provide slot information.
Implementations§
§impl Sequence
impl Sequence
pub async fn fill_slots(&self, slots: Vec<Slot>) -> Result<(), Error>
pub async fn fill_slots(&self, slots: Vec<Slot>) -> Result<(), Error>
Submit some slots discovered by the backend. This function should be typically invoked by the backend upon block (or on-chain event) discovery.
The first slot of the first invocation of this function will determine the starting point of the stream of backend slots (the first SlotNumber seen will be used as the smallest index). After that, Sequence will defer the processing of the filled slots until there is no “gap” in-between them. So FCO consider the “ready” slots as a continous flow of slots starting from the first slot without any gaps.
After the first slot, all slots filled with this function don’t have to continuously follow the previous slots (although it’s encouraged so to have better efficiency).
pub async fn next_block(&self) -> Result<u64, Error>
pub async fn next_block(&self) -> Result<u64, Error>
Get the starting position to look for slots.
Typically, a backend may be a chain that carries Lyquid slots in some of its blocks. This means the slots are not necessarily continuous blocks in the sequencing backend. The backend can use this method to know where to continue scanning for new slots.
pub async fn set_next_block(&self, bn: u64) -> Result<(), Error>
pub async fn set_next_block(&self, bn: u64) -> Result<(), Error>
Tell FCO that all slots are submitted prior to the given block.
When called, the backend is telling FCO that all blocks prior to the given block have been filled in with Self::fill_slots. FCO can then consider to schedule the slots to be later executed, without any omission. The backend should still invoke this function if no slots are found up to its current sync progress of the chain.
As a sanity check, FCO will refrain from considering the slots if any gaps in SlotNumber still present. However, FCO can’t effectively detect omission if the backend invokes this method too early where there are still some slots to be filled prior to the block. Thus backend has to ensure this function is called after all slots are filled properly.
pub fn flow_control(&self) -> &Arc<FlowControl>
pub fn flow_control(&self) -> &Arc<FlowControl>
Get the flow control handle.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sequence
impl !RefUnwindSafe for Sequence
impl Send for Sequence
impl Sync for Sequence
impl Unpin for Sequence
impl !UnwindSafe for Sequence
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<'de, F, T> Deserialize<'de, As<F>> for Twhere
F: BareFormula + ?Sized,
T: Deserialize<'de, F>,
impl<'de, F, T> Deserialize<'de, As<F>> for Twhere
F: BareFormula + ?Sized,
T: Deserialize<'de, F>,
§fn deserialize(deserializer: Deserializer<'de>) -> Result<T, DeserializeError>
fn deserialize(deserializer: Deserializer<'de>) -> Result<T, DeserializeError>
§fn deserialize_in_place(
&mut self,
deserializer: Deserializer<'de>,
) -> Result<(), DeserializeError>
fn deserialize_in_place( &mut self, deserializer: Deserializer<'de>, ) -> Result<(), DeserializeError>
self with data from the input. Read more§impl<'de, F, T> Deserialize<'de, Ref<F>> for T
impl<'de, F, T> Deserialize<'de, Ref<F>> for T
§fn deserialize(de: Deserializer<'de>) -> Result<T, DeserializeError>
fn deserialize(de: Deserializer<'de>) -> Result<T, DeserializeError>
§fn deserialize_in_place(
&mut self,
de: Deserializer<'de>,
) -> Result<(), DeserializeError>
fn deserialize_in_place( &mut self, de: Deserializer<'de>, ) -> Result<(), DeserializeError>
self with data from the input. Read more§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more