Struct pravega_client::event::reader_group_state::ReaderGroupState
source · pub struct ReaderGroupState { /* private fields */ }
Expand description
ReaderGroupState encapsulates all readers states.
Implementations§
source§impl ReaderGroupState
impl ReaderGroupState
sourcepub async fn add_reader(
&mut self,
reader: &Reader
) -> Result<(), ReaderGroupStateError>
pub async fn add_reader( &mut self, reader: &Reader ) -> Result<(), ReaderGroupStateError>
Adds a reader to the reader group state.
pub async fn check_online(&mut self, reader: &Reader) -> bool
sourcepub async fn get_online_readers(&mut self) -> Vec<Reader>
pub async fn get_online_readers(&mut self) -> Vec<Reader>
Returns the active readers in a vector.
sourcepub async fn compute_segments_to_acquire_or_release(
&mut self,
reader: &Reader
) -> Result<isize, ReaderGroupStateError>
pub async fn compute_segments_to_acquire_or_release( &mut self, reader: &Reader ) -> Result<isize, ReaderGroupStateError>
Compute the number of segments to acquire.
sourcepub async fn get_segments(&mut self) -> HashSet<ScopedSegment>
pub async fn get_segments(&mut self) -> HashSet<ScopedSegment>
Return the list of all segments.
sourcepub async fn get_streamcut(&mut self) -> HashMap<ScopedSegment, Offset>
pub async fn get_streamcut(&mut self) -> HashMap<ScopedSegment, Offset>
get all assigned and unassigned segments to offset map in ReaderGroup. This is used to construct StreamCut
sourcepub async fn assign_segment_to_reader(
&mut self,
reader: &Reader
) -> Result<Option<ScopedSegment>, ReaderGroupStateError>
pub async fn assign_segment_to_reader( &mut self, reader: &Reader ) -> Result<Option<ScopedSegment>, ReaderGroupStateError>
Assign an unassigned segment to a given reader
sourcepub async fn get_segments_for_reader(
&mut self,
reader: &Reader
) -> Result<HashSet<(ScopedSegment, Offset)>, SynchronizerError>
pub async fn get_segments_for_reader( &mut self, reader: &Reader ) -> Result<HashSet<(ScopedSegment, Offset)>, SynchronizerError>
Return the list of segments assigned to the requested reader.
sourcepub async fn release_segment(
&mut self,
reader: &Reader,
segment: &ScopedSegment,
offset: &Offset
) -> Result<(), ReaderGroupStateError>
pub async fn release_segment( &mut self, reader: &Reader, segment: &ScopedSegment, offset: &Offset ) -> Result<(), ReaderGroupStateError>
Release a currently assigned segment from the given reader.
sourcepub async fn segment_completed(
&mut self,
reader: &Reader,
segment_completed: &ScopedSegment,
successors_mapped_to_their_predecessors: &HashMap<SegmentWithRange, Vec<Segment>>
) -> Result<(), ReaderGroupStateError>
pub async fn segment_completed( &mut self, reader: &Reader, segment_completed: &ScopedSegment, successors_mapped_to_their_predecessors: &HashMap<SegmentWithRange, Vec<Segment>> ) -> Result<(), ReaderGroupStateError>
Remove the completed segments and add its successors for next to read. This should be called by the reader who’s reading the current segment. Since a segment cannot be read by multiple readers, we can assume this won’t be called by multiple processors at the same time.
Auto Trait Implementations§
impl !Freeze for ReaderGroupState
impl !RefUnwindSafe for ReaderGroupState
impl Send for ReaderGroupState
impl Sync for ReaderGroupState
impl Unpin for ReaderGroupState
impl !UnwindSafe for ReaderGroupState
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
Mutably borrows from an owned value. 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> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request