Skip to content

Commit

Permalink
API Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ypo committed Mar 15, 2024
1 parent a8f138f commit 695806c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
1 change: 0 additions & 1 deletion src/common/oti.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ impl Oti {
///
/// * `maximum_source_block_length`: A `u16` value representing the maximum length of a source block in bytes.
/// A source block is a contiguous portion of the original data that is encoded using the FEC Scheme.
pub fn new_no_code(encoding_symbol_length: u16, maximum_source_block_length: u16) -> Oti {
Oti {
fec_encoding_id: FECEncodingID::NoCode,
Expand Down
30 changes: 26 additions & 4 deletions src/sender/sender.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl PriorityQueue {
pub struct Config {
/// Max duration of the FDT before expiration.
pub fdt_duration: std::time::Duration,
/// Repeat duration of the FDT in the carousel
/// Repeat rate of the FDT in the carousel
pub fdt_carousel: std::time::Duration,
/// First FDT ID.
pub fdt_start_id: u32,
Expand Down Expand Up @@ -288,16 +288,38 @@ impl Sender {
///
/// After calling this function, a call to `publish()` to publish your modifications
///
/// Warning, if the object is being transferred, the transfer is not canceled
/// Warning, if the object has not been transferred at least once and is being transferred
/// the transfer is not canceled
///
/// # Arguments
///
/// * `toi` - TOI of the Object.
///
/// # Returns
///
/// `true`if the object has been removed from the FDT
pub fn remove_object(&mut self, toi: u128) -> bool {
self.fdt.remove_object(toi)
}

/// Number of objects signalled in the FDT
/// Return the number of times an object has been transferred,
/// or None if the object is not in the FDT anymore.
///
/// # Arguments
///
/// * `toi` - TOI of the Object.
///
/// # Returns
///
/// * `Some(count)` - The number of times the object has been transferred, if it is found in the FDT.
/// * `None` - If the object with the specified `toi` is not present in the FDT.
///
pub fn nb_transfers(&mut self, toi: u128) -> Option<u64> {
self.fdt.nb_transfers(toi)
}


/// Number of objects available in the FDT
pub fn nb_objects(&self) -> usize {
self.fdt.nb_objects()
}
Expand All @@ -311,7 +333,7 @@ impl Sender {

/// Inform that the FDT is complete, no new object should be added after this call
/// You must not call `add_object()`after
/// After calling this function, a call to `publish()` to publish your modifications
/// After calling this function, a call to `publish()` is required to publish your modifications
pub fn set_complete(&mut self) {
self.fdt.set_complete();
}
Expand Down

0 comments on commit 695806c

Please sign in to comment.