Struct questdb::ingress::Sender

source ·
pub struct Sender { /* private fields */ }
Expand description

Connects to a QuestDB instance and inserts data via the ILP protocol.

Implementations§

source§

impl Sender

source

pub fn from_conf<T: AsRef<str>>(conf: T) -> Result<Self>

Create a new Sender instance from configuration string.

The format of the string is: "http::addr=host:port;key=value;...;".

Alongside "http" you can also specify "https", "tcp", and "tcps".

HTTP is recommended in most cases as is provides better error feedback allows controlling transactions. TCP can sometimes be faster in higher-latency networks, but misses out on a number of features.

The accepted set of keys and values is the same as for the opt’s API.

E.g. "https::addr=host:port;username=alice;password=secret;tls_ca=os_roots;".

For full list of keys and values, see the SenderBuilder documentation: The builder API and the configuration string API are equivalent.

If you prefer, you can also load the configuration from an environment variable. See Sender::from_env.

source

pub fn from_env() -> Result<Self>

Create a new Sender from the QDB_CLIENT_CONF environment variable. The format is the same as that taken by Sender::from_conf.

source

pub fn flush_and_keep_with_flags( &mut self, buf: &Buffer, transactional: bool ) -> Result<()>

Variant of .flush() that does not clear the buffer and allows for transactional flushes.

A transactional flush is simply a flush that ensures that all rows in the ILP buffer refer to the same table, thus allowing the server to treat the flush request as a single transaction.

This is because QuestDB does not support transactions spanning multiple tables.

Note that transactional flushes are only supported for ILP over HTTP.

source

pub fn flush_and_keep(&mut self, buf: &Buffer) -> Result<()>

Variant of .flush() that does not clear the buffer.

source

pub fn flush(&mut self, buf: &mut Buffer) -> Result<()>

Send buffer to the QuestDB server, clearing the buffer.

If sending over HTTP, flushing will send an HTTP request and wait for the response. If the server responds with an error, this function will return a descriptive error. In case of network errors, this function will retry.

If sending over TCP, this will block until the buffer is flushed to the network socket. Note that this does not guarantee that the buffer will be sent to the server or that the server has received it. In case of errors the server will disconnect: consult the server logs.

Prefer HTTP in most cases, but use TCP if you need to continuously data to the server at a high rate.

To improve HTTP performance, send larger buffers (with more rows), and consider parallelizing writes using multiple senders from multiple threads.

source

pub fn must_close(&self) -> bool

The sender is no longer usable and must be dropped.

This is caused if there was an earlier failure.

This method is specific to ILP/TCP and is not relevant for ILP/HTTP.

Trait Implementations§

source§

impl Debug for Sender

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Sender

§

impl !RefUnwindSafe for Sender

§

impl Send for Sender

§

impl Sync for Sender

§

impl Unpin for Sender

§

impl !UnwindSafe for Sender

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V