[][src]Struct aeron_rs::publication::Publication

pub struct Publication { /* fields omitted */ }

@example basic_publisher.rs Aeron Publisher API for sending messages to subscribers of a given channel and stream_id pair. Publishers are created via an {@link Aeron} object, and messages are sent via an offer method or a claim and commit method combination.

The APIs used to send are all non-blocking.

Note: Publication instances are threadsafe and can be shared between publisher threads. @see Aeron#add_publication @see Aeron#findPublication

Methods

impl Publication[src]

pub fn new(
    conductor: Arc<Mutex<ClientConductor>>,
    channel: CString,
    registration_id: i64,
    original_registration_id: i64,
    stream_id: i32,
    session_id: i32,
    publication_limit: UnsafeBufferPosition,
    channel_status_id: i32,
    log_buffers: Arc<LogBuffers>
) -> Self
[src]

pub fn channel(&self) -> CString[src]

Media address for delivery to the channel.

@ Media address for delivery to the channel.

pub fn stream_id(&self) -> i32[src]

Stream identity for scoping within the channel media address.

@ Stream identity for scoping within the channel media address.

pub fn session_id(&self) -> i32[src]

Session under which messages are published. Identifies this Publication instance.

@ the session id for this publication.

pub fn initial_term_id(&self) -> i32[src]

The initial term id assigned when this Publication was created. This can be used to determine how many terms have passed since creation.

@ the initial term id.

pub fn original_registration_id(&self) -> i64[src]

Get the original registration used to register this Publication with the media driver by the first publisher.

@ the original registration_id of the publication.

pub fn registration_id(&self) -> i64[src]

Registration Id returned by Aeron::add_publication when this Publication was added.

@ the registration_id of the publication.

pub fn is_original(&self) -> bool[src]

Is this Publication the original instance added to the driver? If not then it was added after another client has already added the publication.

@ true if this instance is the first added otherwise false.

pub fn max_message_length(&self) -> Index[src]

Maximum message length supported in bytes.

@ maximum message length supported in bytes.

pub fn max_payload_length(&self) -> Index[src]

Maximum length of a message payload that fits within a message fragment.

This is he MTU length minus the message fragment header length.

@ maximum message fragment payload length.

pub fn term_buffer_length(&self) -> i32[src]

Get the length in bytes for each term partition in the log buffer.

@ the length in bytes for each term partition in the log buffer.

pub fn position_bits_to_shift(&self) -> i32[src]

Number of bits to right shift a position to get a term count for how far the stream has progressed.

@ of bits to right shift a position to get a term count for how far the stream has progressed.

pub fn is_connected(&self) -> bool[src]

Has this Publication seen an active subscriber recently?

@ true if this Publication has seen an active subscriber recently.

pub fn is_closed(&self) -> bool[src]

Has this object been closed and should no longer be used?

@ true if it has been closed otherwise false.

pub fn position(&self) -> i64[src]

Get the current position to which the publication has advanced for this stream.

@ the current position to which the publication has advanced for this stream or {@link CLOSED}.

pub fn publication_limit(&self) -> i64[src]

Get the position limit beyond which this {@link Publication} will be back pressured.

This should only be used as a guide to determine when back pressure is likely to be applied.

@ the position limit beyond which this {@link Publication} will be back pressured.

pub fn publication_limit_id(&self) -> i32[src]

Get the counter id used to represent the publication limit.

@ the counter id used to represent the publication limit.

pub fn available_window(&self) -> i64[src]

Available window for offering into a publication before the {@link #positionLimit(&self)} is reached.

@ window for offering into a publication before the {@link #positionLimit(&self)} is reached. If the publication is closed then {@link #CLOSED} will be returned.

pub fn channel_status_id(&self) -> i32[src]

Get the counter id used to represent the channel status.

@ the counter id used to represent the channel status.

pub fn offer_opt(
    &self,
    buffer: AtomicBuffer,
    offset: Index,
    length: Index,
    reserved_value_supplier: OnReservedValueSupplier
) -> Result<i64, AeronError>
[src]

Non-blocking publish of a buffer containing a message.

@param buffer containing message. @param offset offset in the buffer at which the encoded message begins. @param length in bytes of the encoded message. @param reserved_value_supplier for the frame. @ The new stream position, otherwise {@link #NOT_CONNECTED}, {@link #BACK_PRESSURED}, {@link #ADMIN_ACTION} or {@link #CLOSED}.

pub fn offer_part(
    &self,
    buffer: AtomicBuffer,
    offset: Index,
    length: Index
) -> Result<i64, AeronError>
[src]

Non-blocking publish of a buffer containing a message.

@param buffer containing message. @param offset offset in the buffer at which the encoded message begins. @param length in bytes of the encoded message. @ The new stream position, otherwise {@link #NOT_CONNECTED}, {@link #BACK_PRESSURED}, {@link #ADMIN_ACTION} or {@link #CLOSED}.

pub fn offer(&self, buffer: AtomicBuffer) -> Result<i64, AeronError>[src]

Non-blocking publish of a buffer containing a message.

@param buffer containing message. @ The new stream position on success, otherwise {@link BACK_PRESSURED} or {@link NOT_CONNECTED}.

pub fn offer_bulk(
    &mut self,
    buffers: Vec<AtomicBuffer>,
    reserved_value_supplier: OnReservedValueSupplier
) -> Result<i64, AeronError>
[src]

Non-blocking publish of buffers containing a message.

@param startBuffer containing part of the message. @param lastBuffer after the message. @param reserved_value_supplier for the frame. @ The new stream position, otherwise {@link #NOT_CONNECTED}, {@link #BACK_PRESSURED}, {@link #ADMIN_ACTION} or {@link #CLOSED}. Non-blocking publish of array of buffers containing a message.

@param buffers containing parts of the message. @param length of the array of buffers. @param reserved_value_supplier for the frame. @ The new stream position, otherwise {@link #NOT_CONNECTED}, {@link #BACK_PRESSURED}, {@link #ADMIN_ACTION} or {@link #CLOSED}. Non-blocking publish of array of buffers containing a message. The buffers are in vector and will be appended to the log file in the sequence they appear in the vec.

@param buffers containing parts of the message. @param reserved_value_supplier for the frame. @ The new stream position, otherwise {@link #NOT_CONNECTED}, {@link #BACK_PRESSURED}, {@link #ADMIN_ACTION} or {@link #CLOSED}.

pub fn try_claim(
    &mut self,
    length: Index,
    buffer_claim: &mut BufferClaim
) -> Result<i64, AeronError>
[src]

Try to claim a range in the publication log into which a message can be written with zero copy semantics. Once the message has been written then {@link BufferClaim#commit(&self)} should be called thus making it available.

Note: This method can only be used for message lengths less than MTU length minus header.

@param length of the range to claim, in bytes.. @param buffer_claim to be populate if the claim succeeds. @ The new stream position, otherwise {@link #NOT_CONNECTED}, {@link #BACK_PRESSURED}, {@link #ADMIN_ACTION} or {@link #CLOSED}. @throws IllegalArgumentException if the length is greater than max payload length within an MTU. @see BufferClaim::commit

pub fn add_destination(
    &mut self,
    endpoint_channel: CString
) -> Result<i64, AeronError>
[src]

Add a destination manually to a multi-destination-cast Publication.

@param endpoint_channel for the destination to add @ correlation id for the add command

pub fn remove_destination(
    &mut self,
    endpoint_channel: CString
) -> Result<i64, AeronError>
[src]

Remove a previously added destination manually from a multi-destination-cast Publication.

@param endpoint_channel for the destination to remove @ correlation id for the remove command

pub fn find_destination_response(
    &mut self,
    correlation_id: i64
) -> Result<bool, AeronError>
[src]

Retrieve the status of the associated add or remove destination operation with the given correlation_id.

This method is non-blocking.

The value returned is dependent on what has occurred with respect to the media driver:

  • If the correlation_id is unknown, then an exception is thrown.
  • If the media driver has not answered the add/remove command, then a false is returned.
  • If the media driver has successfully added or removed the destination then true is returned.
  • If the media driver has returned an error, this method will throw the error returned.

@see Publication::add_destination @see Publication::remove_destination

@param correlation_id of the add/remove command returned by Publication::add_destination or Publication::remove_destination @ true for added or false if not.

pub fn channel_status(&self) -> i64[src]

Get the status for the channel of this {@link Publication}

@ status code for this channel

pub fn close(&self)[src]

Trait Implementations

impl Drop for Publication[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.