new

Function new 

Source
pub async fn new<P: AsRef<Path>>(
    path: P,
    page_size: u32,
    max_pages: usize,
) -> Result<Producer, Error>
Expand description

Creates a new channel and returns the Producer for that channel.

Call Producer::subscribe() to create a Consumer for the channel.

Takes a page_size representing the maximum number of bytes per page and a max_pages for the number of pages to have on disk at any moment.

For example, if you want the channel to hold 4GB of data (~ 2^32 bytes) you can create a channel with a page_size of 2^28 bytes and 16 max_pages.

Note that all pages have a maximum number of 2^16 - 1 messages per page so you want to optimize the page_size to be approximately average message size * (2^16 - 1) and adjust max_pages to tune the amount of data stored.