pub struct TrackProducer { /* private fields */ }Expand description
A producer for a track, used to create new groups.
Implementations§
Source§impl TrackProducer
impl TrackProducer
Sourcepub fn new(info: Track) -> Self
pub fn new(info: Track) -> Self
Build a producer for the given track metadata. Prefer Track::produce.
Sourcepub fn create_group(&mut self, info: Group) -> Result<GroupProducer>
pub fn create_group(&mut self, info: Group) -> Result<GroupProducer>
Create a new group with the given sequence number.
Sourcepub fn append_group(&mut self) -> Result<GroupProducer>
pub fn append_group(&mut self) -> Result<GroupProducer>
Create a new group with the next sequence number.
Sourcepub fn write_frame<B: Into<Bytes>>(&mut self, frame: B) -> Result<()>
pub fn write_frame<B: Into<Bytes>>(&mut self, frame: B) -> Result<()>
Create a group with a single frame.
Sourcepub fn finish(&mut self) -> Result<()>
pub fn finish(&mut self) -> Result<()>
Mark the track as finished after the last appended group.
Sets the final sequence to one past the current max_sequence. No new groups at or above this sequence can be appended. NOTE: Old groups with lower sequence numbers can still arrive.
Sourcepub fn finish_at(&mut self, sequence: u64) -> Result<()>
pub fn finish_at(&mut self, sequence: u64) -> Result<()>
Mark the track as finished at an exact final sequence.
The caller must pass the current max_sequence exactly. Freezes the final boundary at one past the current max_sequence. No new groups at or above that sequence can be created. NOTE: Old groups with lower sequence numbers can still arrive.
Sourcepub fn abort(&mut self, err: Error) -> Result<()>
pub fn abort(&mut self, err: Error) -> Result<()>
Abort the track with the given error.
Child groups are independent and must be aborted separately if desired; existing group consumers can still finish reading any groups that were already created.
Sourcepub fn consume(&self) -> TrackConsumer
pub fn consume(&self) -> TrackConsumer
Create a new consumer for the track, starting at the beginning.