#![doc = include_str!("../README.md")]
mod error;
#[cfg(any(feature = "sync-sender-tcp", feature = "sync-sender-qwp-udp"))]
mod gai;
#[cfg(any(feature = "_sender-qwp-ws", feature = "_egress"))]
mod ws;
#[cfg(feature = "_keystore-roots")]
mod keystore_roots;
pub mod ingress;
#[cfg(feature = "_arrow")]
pub mod arrow_metadata;
#[cfg(feature = "_polars")]
#[doc(hidden)]
pub(crate) mod polars_ffi;
#[cfg(feature = "_egress")]
pub mod egress;
pub use error::*;
#[cfg(feature = "sync-sender-qwp-ws")]
mod db;
#[cfg(feature = "sync-sender-qwp-ws")]
pub use db::{BorrowedSender, ConnectHandlers, QuestDb};
#[cfg(feature = "sync-sender-qwp-ws")]
pub use db::{DbgPoolCount, DbgPoolCounts};
#[cfg(feature = "sync-sender-qwp-ws")]
#[doc(hidden)]
pub use db::BorrowedDirectColumnSender;
#[cfg(all(feature = "sync-sender-qwp-ws", feature = "_egress"))]
pub use db::BorrowedReader;
#[cfg(feature = "ffi-support")]
#[doc(hidden)]
pub use db::ffi_support;
#[cfg(all(test, any(feature = "_sender-qwp-udp", feature = "_sender-qwp-ws")))]
mod alloc_counter {
use std::alloc::{GlobalAlloc, Layout, System};
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
pub static COUNTING: AtomicBool = AtomicBool::new(false);
pub static ALLOC_COUNT: AtomicUsize = AtomicUsize::new(0);
pub struct CountingAllocator;
unsafe impl GlobalAlloc for CountingAllocator {
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
if COUNTING.load(Ordering::Relaxed) {
ALLOC_COUNT.fetch_add(1, Ordering::Relaxed);
}
unsafe { System.alloc(layout) }
}
unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) {
unsafe { System.dealloc(ptr, layout) }
}
unsafe fn realloc(&self, ptr: *mut u8, layout: Layout, new_size: usize) -> *mut u8 {
if COUNTING.load(Ordering::Relaxed) {
ALLOC_COUNT.fetch_add(1, Ordering::Relaxed);
}
unsafe { System.realloc(ptr, layout, new_size) }
}
}
pub fn start_counting() -> usize {
ALLOC_COUNT.store(0, Ordering::SeqCst);
COUNTING.store(true, Ordering::SeqCst);
0
}
pub fn stop_counting() -> usize {
COUNTING.store(false, Ordering::SeqCst);
ALLOC_COUNT.load(Ordering::SeqCst)
}
}
#[cfg(all(test, any(feature = "_sender-qwp-udp", feature = "_sender-qwp-ws")))]
#[global_allocator]
static GLOBAL: alloc_counter::CountingAllocator = alloc_counter::CountingAllocator;
#[cfg(test)]
mod tests;