Expand description
Rust bindings for clickhouse-c.
Crate reads and writes ClickHouse Native blocks and implements native TCP protocol. API has three layers:
sysexposes unsafe C API.BlockReader,BlockBuilder,Client, and related types provide safe block and protocol operations.PosixIo,AsyncClient, andtlsprovide transport adapters.
§Entry points
- Use
BlockReaderandBlockBuilderfor Native block streams over anyIoimplementation. - Use
Clientfor blocking native TCP protocol. - Use
IolessClientto process protocol bytes with caller-managed I/O. - Enable
tokiofeature and useAsyncClientfor asynchronous TCP. - Enable
tlsfeature and usetls::TlsIoorAsyncClient::connect_tlsfor rustls connections.
§Safety model
Safe API depends on invariants documented by bundled clickhouse-c revision,
available as UPSTREAM_REVISION. Slice lengths are bounded by owning C
values.
Decoding does not automatically validate relationships between nested
columns. Call Block::validate before using offsets or dictionary keys
from untrusted input as indexes.
Types containing self-references, including PosixIo, Codec, and
tls::TlsIo, return Pin<Box<Self>>. Owning handles implement Send.
Connection handles do not implement Sync.
Modules§
Structs§
- Allocator
- Allocator used for memory owned by clickhouse-c.
- Async
Client - Asynchronous ClickHouse native protocol client.
- Block
- Decoded Native block.
- Block
Builder - Native block assembled from borrowed column data.
- Block
Opts - Options that describe Native block framing.
- Block
Reader - Reads consecutive Native
Blockvalues from anIoimplementation. - Cancel
Token - Cooperative read cancellation for
PosixIo. - Client
- Active blocking ClickHouse connection.
- Client
Opts - Client settings sent during Hello handshake.
- Codec
- Compression callbacks used by clickhouse-c.
- Column
- Borrowed view of a block column.
- Column
Builder - Column descriptor over borrowed data.
- Error
- Error returned by this crate.
- Exception
- Exception returned by ClickHouse server.
- Ioless
Client - Native protocol client without transport I/O.
- LowCardinality
View - Borrowed parts of a LowCardinality column.
- PosixIo
- Blocking
Ioimplementation for a Unix file descriptor. - Profile
Info - Query totals reported near completion.
- Progress
- Incremental query counters. Each packet contains a delta.
- Query
Opts - Additional values sent by
Client::send_query_with. - Query
Param - Value for a
{name:Type}query parameter. - Query
Setting - Query setting sent to ClickHouse.
- Server
Info - Server information received during Hello handshake.
- SliceIo
- Read-only transport over a borrowed byte slice.
- TypeAst
- Parsed ClickHouse type.
- TypeRef
- Borrowed view of a ClickHouse type.
Enums§
- Column
Layout - Storage layout of a decoded column.
- Compression
- Compression algorithm used for native protocol frames.
- Error
Kind - Category corresponding to a clickhouse-c
CHC_ERR_*code. - Event
- Event received from server.
- Interval
Unit - Unit of an
Intervaltype. - Kind
- ClickHouse type kind.
- Packet
Kind - Server packet kind.
- Step
- Result of a protocol operation that may require more input.
Constants§
- UPSTREAM_
REVISION - Bundled clickhouse-c revision from
clickhouse-c/UPSTREAM.
Traits§
- Async
Transport - Asynchronous byte stream used by
AsyncClient. - Io
- Byte transport used by clickhouse-c.
Functions§
- cityhash128
- Calculates CityHash128 and returns low and high words in wire order.
Type Aliases§
- Boxed
Async Client AsyncClientwith transport type erased.- Result
- Result type used by this crate.