questdb 0.1.0-x86_64-linux-gnu

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +22 -0
  3. data/LICENSE.txt +201 -0
  4. data/README.md +170 -0
  5. data/SECURITY.md +19 -0
  6. data/THIRD_PARTY_NOTICES.md +242 -0
  7. data/docs/arrow.md +89 -0
  8. data/docs/configuration.md +61 -0
  9. data/docs/design.md +46 -0
  10. data/docs/ingestion.md +96 -0
  11. data/docs/performance.md +36 -0
  12. data/docs/python-parity.md +34 -0
  13. data/docs/querying.md +54 -0
  14. data/docs/release-infrastructure.md +70 -0
  15. data/docs/releasing.md +47 -0
  16. data/docs/troubleshooting.md +41 -0
  17. data/examples/basic.rb +32 -0
  18. data/examples/callbacks.rb +46 -0
  19. data/examples/columnar.rb +41 -0
  20. data/examples/independent_buffer.rb +39 -0
  21. data/examples/query.rb +28 -0
  22. data/examples/standalone.rb +33 -0
  23. data/examples/tls_auth.rb +33 -0
  24. data/lib/questdb/arrow.rb +250 -0
  25. data/lib/questdb/client.rb +308 -0
  26. data/lib/questdb/column_vector.rb +91 -0
  27. data/lib/questdb/config.rb +161 -0
  28. data/lib/questdb/connection_event.rb +60 -0
  29. data/lib/questdb/direct_ingestion.rb +440 -0
  30. data/lib/questdb/event_inbox.rb +60 -0
  31. data/lib/questdb/ingress/buffer.rb +104 -0
  32. data/lib/questdb/ingress/error.rb +43 -0
  33. data/lib/questdb/ingress/float64_array.rb +60 -0
  34. data/lib/questdb/ingress/native.rb +40 -0
  35. data/lib/questdb/ingress/timestamp.rb +53 -0
  36. data/lib/questdb/ingress.rb +77 -0
  37. data/lib/questdb/native/3.1/questdb_ingress.so +0 -0
  38. data/lib/questdb/native/3.2/questdb_ingress.so +0 -0
  39. data/lib/questdb/native/3.3/questdb_ingress.so +0 -0
  40. data/lib/questdb/native/3.4/questdb_ingress.so +0 -0
  41. data/lib/questdb/pooled_sender.rb +215 -0
  42. data/lib/questdb/query.rb +429 -0
  43. data/lib/questdb/sender.rb +436 -0
  44. data/lib/questdb/sender_error.rb +49 -0
  45. data/lib/questdb/types.rb +198 -0
  46. data/lib/questdb/version.rb +27 -0
  47. data/lib/questdb.rb +22 -0
  48. data/questdb.gemspec +69 -0
  49. data/sig/questdb-arrow.rbs +46 -0
  50. data/sig/questdb.rbs +337 -0
  51. metadata +188 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 552b130661804f60d094bdbc1cdcabfd24c06e26c08c6aa740b3e9af0e32e5b1
4
+ data.tar.gz: 642ac1943fc3d7e280e771b3853b0ad64dfce9a27c0a94b4eb7cbc85b174dec1
5
+ SHA512:
6
+ metadata.gz: 543c087ac0505a2cc2f5496152c7c53729867b09de9f4b25b0ed234204cc4047112f8cb572bbe7ea8700452774c84bae42c101c277fe02bd190f405a43a20e02
7
+ data.tar.gz: 88c31e5c3bdfbb0ce431fed1a22cb9a81a77bfca64053b9ee845111e53e91b3a969820db0592ef3b3178c19224b7cb0934d0de27bae576deec8b2338d95bbd73
data/CHANGELOG.md ADDED
@@ -0,0 +1,22 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 (2026-10-19)
4
+
5
+ Initial pre-1.0 release for early adopters. Public APIs may evolve before 1.0; delivery and acknowledgement semantics are intentional compatibility commitments and changes will be documented here.
6
+
7
+ - Added a QWP/WebSocket-only deployment client backed by `c-questdb-client` 7.1.0.
8
+ - Added one shared native pool with thread-safe sender borrowing and thread-affine pooled sender leases.
9
+ - Added atomic typed row buffering, publish/ACK barriers, FSN tracking, structured diagnostics, native error codes, and delivery-ambiguity reporting.
10
+ - Added native reconnect, failover, TLS/authentication, and store-and-forward connect-string pass-through.
11
+ - Added pooled QWP readers, positional binds, streaming `QueryResult`/`ResultBatch`/`Row` APIs, cancellation, server-info snapshots, and portable little-endian v7 scalar plus DOUBLE-array decoding.
12
+ - Preserved signed pre-epoch query timestamps, made cancellation failures drop their reader lease, and reject unprojectable LONG_ARRAY/unknown result kinds explicitly.
13
+ - Added pooled direct columnar QWP ingestion with immutable `ColumnVector` descriptors, conservative Array inference, native-owned staging and validity maps, dictionary symbols, checked multi-batch commits, and partial-completion/in-doubt safeguards.
14
+ - Added pool-wide connection and server-rejection handlers with immutable deep-copied values, dedicated Ruby dispatcher threads, bounded drop-oldest bridge queues, manual polling copies, safe callback-triggered close, and additive delivery/drop counters.
15
+ - Added standalone QWP `ws`/`wss` senders with manual progress, ACK/FSN APIs, safely queued callbacks, Python-parity WebSocket auto-flush defaults, and checked close-drain.
16
+ - Added structured sender diagnostics on raised errors, a terminal rejection subclass, pooled/standalone sender direct-ingestion convenience, and end-to-end performance regression benchmarks.
17
+ - Reduced hot-path row and direct-ingestion allocations, removed transient direct-column copies, indexed `Row` name lookup, and added low-allocation `QueryResult#each_values` streaming.
18
+ - Added an optional `questdb/arrow` module for native Arrow C Stream ingestion and query export across Nanoarrow, Polars, and Red Arrow without mandatory dataframe dependencies.
19
+ - Added versioned precompiled gems for standard Linux, macOS, and Windows platforms while retaining a checksum-complete offline source gem.
20
+ - Vendored Cargo sources for offline source-gem installation.
21
+ - Known issue: `c-questdb-client` 7.1.0 locks rustls 0.23.41, which is affected by RUSTSEC-2026-0285, RUSTSEC-2026-0346, RUSTSEC-2026-0348 and RUSTSEC-2026-0349. These advisories are temporarily ignored in `cargo audit` (`.cargo/audit.toml`); a patch release will move to rustls 0.23.46 or newer.
22
+ - Legacy ILP transports, QWP/UDP, and transaction APIs are intentionally unsupported.
data/LICENSE.txt ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
data/README.md ADDED
@@ -0,0 +1,170 @@
1
+ # QuestDB Ruby client
2
+
3
+ `questdb` is an MRI Ruby client for QuestDB's native **QuestDB Wire Protocol (QWP)** over WebSocket. It is backed by the official `c-questdb-client` 7.1.0 C ABI and does not implement the protocol, networking, TLS, authentication, failover, or store-and-forward in Ruby.
4
+
5
+ The client provides a deployment-level connection pool, pooled row and direct columnar ingestion, streaming SQL queries, safe Ruby dispatch for lifecycle/rejection callbacks, and standalone QWP WebSocket senders. Query batches and callback values are copied into ordinary Ruby objects before borrowed native data expires. Legacy ILP transports are intentionally not part of this client.
6
+
7
+ > [!NOTE]
8
+ > `0.1.x` is the initial pre-1.0 release line. It is intended for early adopters and may make API changes before 1.0, with changes recorded in the changelog. Delivery, acknowledgement, and `in_doubt?` semantics are explicit and should not be treated as experimental shortcuts.
9
+
10
+ ## Installation
11
+
12
+ With Bundler:
13
+
14
+ ```ruby
15
+ gem "questdb", "~> 0.1.0"
16
+ ```
17
+
18
+ Or directly:
19
+
20
+ ```sh
21
+ gem install questdb
22
+ ```
23
+
24
+ RubyGems selects a precompiled package for supported platforms. Force a source build with `gem install questdb --platform ruby`; source builds require the toolchain listed below.
25
+
26
+ ## Requirements
27
+
28
+ - QuestDB 10.0 or newer
29
+ - MRI Ruby 3.1–3.4
30
+
31
+ Release builds provide precompiled gems for x86-64 and ARM64 Linux (glibc 2.28+ and musl), x86-64 and ARM64 macOS, and x64 Windows UCRT. Flavor-specific Linux gems require RubyGems 3.3.22+; musl users should use Bundler 2.5.6+. Source installation requires Rust 1.91.1 or newer, a C compiler, and Make. All Cargo sources are vendored in the source gem, so compilation can run offline without downloading native dependencies.
32
+
33
+ ## Quick start
34
+
35
+ ```ruby
36
+ require "questdb"
37
+
38
+ QuestDB.connect(host: "localhost") do |client|
39
+ client.sender do |sender|
40
+ sender.row("trades",
41
+ symbols: { symbol: "ETH-USD", side: "sell" },
42
+ columns: { price: 2615.54, amount: 0.00044 },
43
+ at: QuestDB::TimestampNanos.now)
44
+
45
+ # Explicit server-acceptance barrier. Ordinary flush is publish-only.
46
+ sender.flush(wait: true)
47
+ end
48
+ end
49
+ ```
50
+
51
+ The equivalent connection-string form is:
52
+
53
+ ```ruby
54
+ QuestDB.connect("ws::addr=localhost:9000;") { |client| ... }
55
+ ```
56
+
57
+ Use `wss::` for TLS. `QuestDB::Client.from_env` reads `QDB_CLIENT_CONF`.
58
+
59
+ ## Standalone WebSocket
60
+
61
+ Use the deployment-level `Client` for pooled ingestion and queries. `QuestDB::Sender` is the connection-level API for manual WebSocket progress and explicit buffer control:
62
+
63
+ ```ruby
64
+ QuestDB::Sender.from_conf("ws::addr=localhost:9000;auto_flush=off;").open do |sender|
65
+ sender.row("metrics", columns: { value: 1 }, at: QuestDB::TimestampNanos.now)
66
+ sender.flush(wait: true)
67
+ end
68
+ ```
69
+
70
+ Standalone `ws`/`wss` senders expose FSNs, ACK waits, diagnostics, `drive_once` for `qwp_ws_progress=manual`, checked close-drain, direct columnar loads, and the same safely queued `connection_listener` / `error_handler` callbacks as the pool. `QuestDB::Sender` rejects UDP and all ILP schemes. Standalone auto-flush follows the Python WebSocket client defaults: 600 rows and 1,000 ms.
71
+
72
+ ## Direct columnar ingestion
73
+
74
+ ```ruby
75
+ QuestDB.connect("ws::addr=localhost:9000;") do |client|
76
+ client.ingest_columns(
77
+ "trades",
78
+ columns: {
79
+ price: [2615.54, 2616.10],
80
+ amount: QuestDB::ColumnVector.double([0.00044, nil])
81
+ },
82
+ symbols: { symbol: ["ETH-USD", "BTC-USD"] },
83
+ at: [QuestDB::TimestampNanos.now, QuestDB::TimestampNanos.now],
84
+ max_rows_per_batch: 16_384,
85
+ ack: :ok
86
+ )
87
+ end
88
+ ```
89
+
90
+ Arrays are conservatively inferred; `ColumnVector` supplies an explicit kind for all-null or narrow columns. Inputs are synchronously normalized and copied to native staging before the GVL is released. Do not mutate Arrays or strings concurrently merely because the method has started; they are safe to mutate after `ingest_columns` returns (or after a `ColumnVector` constructor has copied them). Direct chunks are pipelined and committed once at the selected `:ok` or `:durable` boundary. This path deliberately bypasses row ingestion's store-and-forward queue: it has no FSNs and no ordering relationship with row writes, even through the same `Client`. `PooledSender#ingest_columns` forwards to its client; standalone `ws`/`wss` senders open a separate poolless direct connection carrying the same auth/TLS configuration. An `in_doubt?` error after a flushed batch must not be retried wholesale without deduplication.
91
+
92
+ ## Optional Arrow integration
93
+
94
+ ```ruby
95
+ require "questdb/arrow"
96
+
97
+ client.ingest_arrow("trades", polars_frame, at: :timestamp, symbols: ["symbol"])
98
+ result = client.query("SELECT * FROM trades")
99
+ frame = result.to_polars
100
+ ```
101
+
102
+ The optional adapter accepts the Arrow C Stream protocol used by Nanoarrow and Polars, plus Red Arrow tables and readers. It introduces no mandatory dataframe gem dependency. Query results can be consumed through `arrow_c_stream`, `to_nanoarrow`, `to_polars`, or `to_red_arrow_table`. The c-client's Arrow implementation is compiled into official native gems so `require "questdb/arrow"` works without rebuilding; “optional” refers to the Ruby API and dataframe dependencies, not a separately downloaded native binary. See [Arrow integration](docs/arrow.md) for ownership, type overrides, and memory behavior.
103
+
104
+ ## Querying
105
+
106
+ ```ruby
107
+ QuestDB.connect("ws::addr=localhost:9000;") do |client|
108
+ client.execute("CREATE TABLE IF NOT EXISTS events (ts TIMESTAMP, id LONG) TIMESTAMP(ts) WAL")
109
+
110
+ client.query("SELECT id, ts FROM events WHERE id > $1", binds: [10]) do |result|
111
+ result.each { |row| puts "#{row["id"]}: #{row["ts"].value}" }
112
+ end
113
+ end
114
+ ```
115
+
116
+ `Client#query` returns a single-use `QueryResult`. It implements `Enumerable`, streams native result batches, and eagerly copies every value before requesting the next batch. `Row` supports integer indexing and first-match name lookup while preserving duplicate names; `Row#to_h` is intentionally lossy when names repeat. `Client#reader` lends a thread-affine reader for sequential queries on one pooled connection. Fully drain, cancel, or close every result. Closing a partial result terminates its reader lease so an undrained connection is never recycled.
117
+
118
+ Positional binds accept `nil`, booleans, signed 64-bit integers, floats, UTF-8 strings, `Time`, timestamps, and explicit wrappers for UUID, binary, IPv4, date, geohash, decimal, LONG256, CHAR, and typed NULL values. Result decoding covers all scalar QWP v7 kinds and ragged `DOUBLE[]` values while preserving nulls and decimal precision.
119
+
120
+ ## Pool and lease lifecycle
121
+
122
+ A `QuestDB::Client` owns one native `questdb_db` pool. It is safe to borrow senders and readers from multiple Ruby threads. Each pooled sender, reader, and query result is a short-lived, thread-affine lease and must be used on the thread that created it. Block forms return leases exactly once:
123
+
124
+ ```ruby
125
+ client = QuestDB.connect("ws::addr=node-a:9000,node-b:9000;sender_pool_max=4;")
126
+ client.sender { |sender| sender.row("metrics", columns: { value: 1 }, at: QuestDB::SERVER_TIMESTAMP) }
127
+ client.close
128
+ ```
129
+
130
+ `Client#close` is idempotent and refuses to close while any sender or reader lease remains active. Neither clients nor leases may be reused after close or after `fork`.
131
+
132
+ ## Delivery semantics
133
+
134
+ `PooledSender#flush` publishes the current QWP frame to the native local store-and-forward queue and returns without waiting for QuestDB. Use:
135
+
136
+ - `flush(wait: true)` for an `OK` acknowledgement barrier;
137
+ - `wait(timeout_millis: ...)` to wait for everything published by the lease;
138
+ - `flush_and_get_fsn`, `published_fsn`, `acked_fsn`, and `await_acked_fsn` for frame-sequence tracking;
139
+ - `ack: :durable` only with Enterprise and `request_durable_ack=on`;
140
+ - `poll_error` for structured per-lease server diagnostics.
141
+
142
+ An `OK` acknowledgement means the server accepted the frame; WAL application and query visibility remain asynchronous. QWP replay is at-least-once. `QuestDB::Error#in_doubt?` identifies failures where replaying input may duplicate rows, and `#sender_error` carries the structured WebSocket diagnostic when the native error includes one. Terminal QWP rejection errors use the `QuestDB::ServerRejectionError` subclass. Use QuestDB deduplication when retries must be safe.
143
+
144
+ Without an explicit Ruby error handler, the native client logs every pool-wide server rejection; errors are not silently discarded. Pool and lease dropped/delivered counters are exposed.
145
+
146
+ ## Pool callbacks
147
+
148
+ ```ruby
149
+ client = QuestDB.connect(
150
+ host: "localhost",
151
+ connection_listener: ->(event) { warn("QWP #{event.kind} #{event.host}:#{event.port}") },
152
+ error_handler: ->(error) { warn("QWP rejected #{error.from_fsn}-#{error.to_fsn}: #{error.message}") },
153
+ connection_event_inbox_capacity: 64,
154
+ error_event_inbox_capacity: 64
155
+ )
156
+ ```
157
+
158
+ Handlers run on dedicated Ruby threads, never on c-client producer/I/O threads. Their arguments (`ConnectionEvent` and `SenderError`) are immutable deep copies. Handler exceptions are warned and dispatch continues. `poll_connection_event` and `poll_error` return nonblocking copies of callback values for deterministic diagnostic consumers. Both native and Ruby bridge inboxes are bounded, use drop-oldest overflow, and contribute to the documented delivered/dropped counters; `0` selects the default capacity of 64.
159
+
160
+ Callbacks are lifecycle/diagnostic signals, not data ACK or WAL-visibility barriers. A returned pooled sender may already be closed when its pool-wide rejection arrives. A handler may call `client.close`; self-join is avoided. If a handler captures its client, close it explicitly because that reference intentionally keeps the client alive.
161
+
162
+ ## Values
163
+
164
+ Rows support symbols (`String` or `nil`) and columns containing `nil`, booleans, signed 64-bit integers, floats, UTF-8 strings, `Time`, `TimestampMicros`, `TimestampNanos`, `BigDecimal`, and explicit `Float64Array` values. `SERVER_TIMESTAMP` requests a server-assigned designated timestamp.
165
+
166
+ Direct columns support BYTE/SHORT/INT/LONG, FLOAT/DOUBLE, BOOLEAN, VARCHAR, BINARY, UUID, LONG256, IPv4, TIMESTAMP/TIMESTAMP_NANOS/DATE, CHAR, GEOHASH, DECIMAL64/128/256, DOUBLE_ARRAY, and dictionary SYMBOL columns. QuestDB BYTE, SHORT, BOOLEAN, and CHAR cannot distinguish SQL NULL from their zero value; direct vectors reject `nil` for those kinds rather than silently changing it. Nullable kinds use validity bitmaps.
167
+
168
+ A row append is atomic: validation or native failure rewinds the entire row. Native error codes, messages, and delivery ambiguity are preserved.
169
+
170
+ See [configuration](docs/configuration.md), [ingestion](docs/ingestion.md), [querying](docs/querying.md), [Python QWP parity](docs/python-parity.md), [design](docs/design.md), [performance](docs/performance.md), [releasing](docs/releasing.md), and [troubleshooting](docs/troubleshooting.md).
data/SECURITY.md ADDED
@@ -0,0 +1,19 @@
1
+ # Security
2
+
3
+ Report suspected vulnerabilities privately to [security@questdb.io](mailto:security@questdb.io). Do not open a public issue for an unpatched vulnerability, and never publish credentials, private keys, trust stores, or configuration strings containing secrets.
4
+
5
+ ## Supported versions
6
+
7
+ Until the first public release, only the current `main` branch receives security fixes. After release, this document will list supported release lines and their end-of-support dates.
8
+
9
+ ## Release requirements
10
+
11
+ A release candidate must pass security qualification on approved QuestDB release infrastructure:
12
+
13
+ - Ruby dependency audit;
14
+ - RustSec audit of the pinned c-client lockfile;
15
+ - native lifecycle memory-access checks under Valgrind;
16
+ - SPDX SBOM generation;
17
+ - repository secret/path scanning and package verification performed by the release checklist.
18
+
19
+ Known advisories are release blockers unless QuestDB security explicitly documents an assessment and time-bounded exception. Release artifacts include SHA-256 checksums; publishing credentials remain only in an approved publisher's protected user-level RubyGems credentials file or the organization's release secret store and are never included in source, logs, or artifacts.
@@ -0,0 +1,242 @@
1
+ # Third-party notices
2
+
3
+ This gem statically links the pinned QuestDB C/Rust client at the revision recorded in `vendor/c-questdb-client.version`. QuestDB's `questdb-rs`, `questdb-rs-ffi`, and C interface are licensed under Apache-2.0; the upstream license is preserved at `vendor/c-questdb-client/LICENSE`.
4
+
5
+ The inventory below is the complete resolved dependency graph for the enabled `questdb-rs-ffi` features in the pinned `Cargo.lock`, including target-conditional packages. It was generated with:
6
+
7
+ ```sh
8
+ cargo metadata --offline --locked --features insecure-skip-verify,arrow --format-version 1 \
9
+ --manifest-path vendor/c-questdb-client/questdb-rs-ffi/Cargo.toml
10
+ ```
11
+
12
+ Package | Version | Declared license
13
+ --- | --- | ---
14
+ aes | 0.8.4 | MIT OR Apache-2.0
15
+ ahash | 0.8.12 | MIT OR Apache-2.0
16
+ aho-corasick | 1.1.4 | Unlicense OR MIT
17
+ aligned-vec | 0.6.4 | MIT
18
+ android_system_properties | 0.1.5 | MIT/Apache-2.0
19
+ arrow | 59.0.0 | Apache-2.0
20
+ arrow-arith | 59.0.0 | Apache-2.0
21
+ arrow-array | 59.0.0 | Apache-2.0 AND MIT
22
+ arrow-buffer | 59.0.0 | Apache-2.0
23
+ arrow-cast | 59.0.0 | Apache-2.0
24
+ arrow-data | 59.0.0 | Apache-2.0
25
+ arrow-ord | 59.0.0 | Apache-2.0
26
+ arrow-row | 59.0.0 | Apache-2.0
27
+ arrow-schema | 59.0.0 | Apache-2.0
28
+ arrow-select | 59.0.0 | Apache-2.0
29
+ arrow-string | 59.0.0 | Apache-2.0
30
+ asn1-rs | 0.5.2 | MIT/Apache-2.0
31
+ asn1-rs | 0.7.2 | MIT OR Apache-2.0
32
+ asn1-rs-derive | 0.4.0 | MIT/Apache-2.0
33
+ asn1-rs-derive | 0.6.0 | MIT OR Apache-2.0
34
+ asn1-rs-impl | 0.1.0 | MIT/Apache-2.0
35
+ asn1-rs-impl | 0.2.0 | MIT/Apache-2.0
36
+ atoi | 2.0.0 | MIT
37
+ autocfg | 1.5.1 | Apache-2.0 OR MIT
38
+ base64 | 0.22.1 | MIT OR Apache-2.0
39
+ base64ct | 1.8.3 | Apache-2.0 OR MIT
40
+ bitflags | 2.13.0 | MIT OR Apache-2.0
41
+ block-buffer | 0.10.4 | MIT OR Apache-2.0
42
+ block-padding | 0.3.3 | MIT OR Apache-2.0
43
+ bumpalo | 3.20.3 | MIT OR Apache-2.0
44
+ bytes | 1.12.0 | MIT
45
+ cbc | 0.1.2 | MIT OR Apache-2.0
46
+ cc | 1.2.65 | MIT OR Apache-2.0
47
+ cfg-if | 1.0.4 | MIT OR Apache-2.0
48
+ chacha20 | 0.10.1 | MIT OR Apache-2.0
49
+ chrono | 0.4.45 | MIT OR Apache-2.0
50
+ chrono-tz | 0.10.4 | MIT OR Apache-2.0
51
+ cipher | 0.4.4 | MIT OR Apache-2.0
52
+ cms | 0.2.3 | Apache-2.0 OR MIT
53
+ const-oid | 0.9.6 | Apache-2.0 OR MIT
54
+ const-random | 0.1.18 | MIT OR Apache-2.0
55
+ const-random-macro | 0.1.16 | MIT OR Apache-2.0
56
+ core-foundation | 0.10.1 | MIT OR Apache-2.0
57
+ core-foundation-sys | 0.8.7 | MIT OR Apache-2.0
58
+ cpufeatures | 0.2.17 | MIT OR Apache-2.0
59
+ cpufeatures | 0.3.0 | MIT OR Apache-2.0
60
+ crc32c | 0.6.8 | Apache-2.0/MIT
61
+ crunchy | 0.2.4 | MIT
62
+ crypto-common | 0.1.7 | MIT OR Apache-2.0
63
+ data-encoding | 2.11.0 | MIT
64
+ der | 0.7.10 | Apache-2.0 OR MIT
65
+ der-parser | 10.0.0 | MIT OR Apache-2.0
66
+ der_derive | 0.7.3 | Apache-2.0 OR MIT
67
+ deranged | 0.5.8 | MIT OR Apache-2.0
68
+ des | 0.8.1 | MIT OR Apache-2.0
69
+ digest | 0.10.7 | MIT OR Apache-2.0
70
+ displaydoc | 0.2.6 | MIT OR Apache-2.0
71
+ dns-lookup | 3.0.1 | MIT/Apache-2.0
72
+ equator | 0.4.2 | MIT
73
+ equator-macro | 0.4.2 | MIT
74
+ find-msvc-tools | 0.1.9 | MIT OR Apache-2.0
75
+ flagset | 0.4.7 | Apache-2.0
76
+ futures-core | 0.3.32 | MIT OR Apache-2.0
77
+ futures-task | 0.3.32 | MIT OR Apache-2.0
78
+ futures-util | 0.3.32 | MIT OR Apache-2.0
79
+ generic-array | 0.14.7 | MIT
80
+ getrandom | 0.2.17 | MIT OR Apache-2.0
81
+ getrandom | 0.3.4 | MIT OR Apache-2.0
82
+ getrandom | 0.4.3 | MIT OR Apache-2.0
83
+ half | 2.7.1 | MIT OR Apache-2.0
84
+ hashbrown | 0.17.1 | MIT OR Apache-2.0
85
+ hex | 0.4.3 | MIT OR Apache-2.0
86
+ hmac | 0.12.1 | MIT OR Apache-2.0
87
+ http | 1.4.2 | MIT OR Apache-2.0
88
+ httparse | 1.10.1 | MIT OR Apache-2.0
89
+ iana-time-zone | 0.1.65 | MIT OR Apache-2.0
90
+ iana-time-zone-haiku | 0.1.2 | MIT OR Apache-2.0
91
+ indoc | 2.0.7 | MIT OR Apache-2.0
92
+ inout | 0.1.4 | MIT OR Apache-2.0
93
+ itoa | 1.0.18 | MIT OR Apache-2.0
94
+ jks | 0.3.3 | MIT
95
+ jobserver | 0.1.34 | MIT OR Apache-2.0
96
+ js-sys | 0.3.103 | MIT OR Apache-2.0
97
+ lazy_static | 1.5.0 | MIT OR Apache-2.0
98
+ lexical-core | 1.0.6 | MIT/Apache-2.0
99
+ lexical-parse-float | 1.0.6 | MIT/Apache-2.0
100
+ lexical-parse-integer | 1.0.6 | MIT/Apache-2.0
101
+ lexical-util | 1.0.7 | MIT/Apache-2.0
102
+ lexical-write-float | 1.0.6 | MIT/Apache-2.0
103
+ lexical-write-integer | 1.0.6 | MIT/Apache-2.0
104
+ libc | 0.2.186 | MIT OR Apache-2.0
105
+ libm | 0.2.16 | MIT
106
+ log | 0.4.33 | MIT OR Apache-2.0
107
+ memchr | 2.8.2 | Unlicense OR MIT
108
+ memmap2 | 0.9.11 | MIT OR Apache-2.0
109
+ minimal-lexical | 0.2.1 | MIT/Apache-2.0
110
+ nom | 7.1.3 | MIT
111
+ num-bigint | 0.4.6 | MIT OR Apache-2.0
112
+ num-complex | 0.4.6 | MIT OR Apache-2.0
113
+ num-conv | 0.2.2 | MIT OR Apache-2.0
114
+ num-integer | 0.1.46 | MIT OR Apache-2.0
115
+ num-traits | 0.2.19 | MIT OR Apache-2.0
116
+ oid-registry | 0.8.1 | MIT OR Apache-2.0
117
+ once_cell | 1.21.4 | MIT OR Apache-2.0
118
+ openssl-probe | 0.2.1 | MIT OR Apache-2.0
119
+ p12-keystore | 0.2.1 | MIT/Apache-2.0
120
+ pbkdf2 | 0.12.2 | MIT OR Apache-2.0
121
+ pem-rfc7468 | 0.7.0 | Apache-2.0 OR MIT
122
+ percent-encoding | 2.3.2 | MIT OR Apache-2.0
123
+ phf | 0.12.1 | MIT
124
+ phf_shared | 0.12.1 | MIT
125
+ pin-project-lite | 0.2.17 | Apache-2.0 OR MIT
126
+ pkcs12 | 0.1.0 | Apache-2.0 OR MIT
127
+ pkcs5 | 0.7.1 | Apache-2.0 OR MIT
128
+ pkg-config | 0.3.33 | MIT OR Apache-2.0
129
+ powerfmt | 0.2.0 | MIT OR Apache-2.0
130
+ ppv-lite86 | 0.2.21 | MIT OR Apache-2.0
131
+ proc-macro2 | 1.0.106 | MIT OR Apache-2.0
132
+ questdb-confstr | 0.1.1 | Apache-2.0
133
+ questdb-rs | 7.1.0 | Apache-2.0
134
+ questdb-rs-ffi | 7.1.0 | Apache-2.0 (upstream workspace license)
135
+ quote | 1.0.46 | MIT OR Apache-2.0
136
+ r-efi | 5.3.0 | MIT OR Apache-2.0 OR LGPL-2.1-or-later
137
+ r-efi | 6.0.0 | MIT OR Apache-2.0 OR LGPL-2.1-or-later
138
+ rand | 0.10.1 | MIT OR Apache-2.0
139
+ rand | 0.9.4 | MIT OR Apache-2.0
140
+ rand_chacha | 0.9.0 | MIT OR Apache-2.0
141
+ rand_core | 0.10.1 | MIT OR Apache-2.0
142
+ rand_core | 0.9.5 | MIT OR Apache-2.0
143
+ rc2 | 0.8.1 | MIT OR Apache-2.0
144
+ regex | 1.12.4 | MIT OR Apache-2.0
145
+ regex-automata | 0.4.14 | MIT OR Apache-2.0
146
+ regex-syntax | 0.8.11 | MIT OR Apache-2.0
147
+ ring | 0.17.14 | Apache-2.0 AND ISC
148
+ rustc_version | 0.4.1 | MIT OR Apache-2.0
149
+ rusticata-macros | 4.1.0 | MIT/Apache-2.0
150
+ rustls | 0.23.41 | Apache-2.0 OR ISC OR MIT
151
+ rustls-native-certs | 0.8.4 | Apache-2.0 OR ISC OR MIT
152
+ rustls-pki-types | 1.15.0 | MIT OR Apache-2.0
153
+ rustls-webpki | 0.103.13 | ISC
154
+ rustversion | 1.0.22 | MIT OR Apache-2.0
155
+ ryu | 1.0.23 | Apache-2.0 OR BSL-1.0
156
+ salsa20 | 0.10.2 | MIT OR Apache-2.0
157
+ schannel | 0.1.29 | MIT
158
+ scrypt | 0.11.0 | MIT OR Apache-2.0
159
+ security-framework | 3.7.0 | MIT OR Apache-2.0
160
+ security-framework-sys | 2.17.0 | MIT OR Apache-2.0
161
+ semver | 1.0.28 | MIT OR Apache-2.0
162
+ serde | 1.0.228 | MIT OR Apache-2.0
163
+ serde_core | 1.0.228 | MIT OR Apache-2.0
164
+ serde_derive | 1.0.228 | MIT OR Apache-2.0
165
+ serde_json | 1.0.150 | MIT OR Apache-2.0
166
+ sha1 | 0.10.6 | MIT OR Apache-2.0
167
+ sha2 | 0.10.9 | MIT OR Apache-2.0
168
+ shlex | 2.0.1 | MIT OR Apache-2.0
169
+ siphasher | 1.0.3 | MIT/Apache-2.0
170
+ slab | 0.4.12 | MIT
171
+ slugify | 0.1.0 | MIT
172
+ socket2 | 0.6.4 | MIT OR Apache-2.0
173
+ spki | 0.7.3 | Apache-2.0 OR MIT
174
+ subtle | 2.6.1 | BSD-3-Clause
175
+ syn | 1.0.109 | MIT OR Apache-2.0
176
+ syn | 2.0.118 | MIT OR Apache-2.0
177
+ synstructure | 0.12.6 | MIT
178
+ synstructure | 0.13.2 | MIT
179
+ thiserror | 1.0.69 | MIT OR Apache-2.0
180
+ thiserror | 2.0.18 | MIT OR Apache-2.0
181
+ thiserror-impl | 1.0.69 | MIT OR Apache-2.0
182
+ thiserror-impl | 2.0.18 | MIT OR Apache-2.0
183
+ time | 0.3.53 | MIT OR Apache-2.0
184
+ time-core | 0.1.9 | MIT OR Apache-2.0
185
+ time-macros | 0.2.31 | MIT OR Apache-2.0
186
+ tiny-keccak | 2.0.2 | CC0-1.0
187
+ typenum | 1.20.1 | MIT OR Apache-2.0
188
+ unicode-ident | 1.0.24 | (MIT OR Apache-2.0) AND Unicode-3.0
189
+ unicode-xid | 0.2.6 | MIT OR Apache-2.0
190
+ unidecode | 0.3.0 | BSD-3-Clause
191
+ untrusted | 0.9.0 | ISC
192
+ ureq | 3.1.4 | MIT OR Apache-2.0
193
+ ureq-proto | 0.5.3 | MIT OR Apache-2.0
194
+ utf-8 | 0.7.6 | MIT OR Apache-2.0
195
+ version_check | 0.9.5 | MIT/Apache-2.0
196
+ wasi | 0.11.1+wasi-snapshot-preview1 | Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
197
+ wasip2 | 1.0.4+wasi-0.2.12 | Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
198
+ wasm-bindgen | 0.2.126 | MIT OR Apache-2.0
199
+ wasm-bindgen-macro | 0.2.126 | MIT OR Apache-2.0
200
+ wasm-bindgen-macro-support | 0.2.126 | MIT OR Apache-2.0
201
+ wasm-bindgen-shared | 0.2.126 | MIT OR Apache-2.0
202
+ webpki-roots | 1.0.8 | CDLA-Permissive-2.0
203
+ windows-core | 0.62.2 | MIT OR Apache-2.0
204
+ windows-implement | 0.60.2 | MIT OR Apache-2.0
205
+ windows-interface | 0.59.3 | MIT OR Apache-2.0
206
+ windows-link | 0.2.1 | MIT OR Apache-2.0
207
+ windows-result | 0.4.1 | MIT OR Apache-2.0
208
+ windows-strings | 0.5.1 | MIT OR Apache-2.0
209
+ windows-sys | 0.52.0 | MIT OR Apache-2.0
210
+ windows-sys | 0.60.2 | MIT OR Apache-2.0
211
+ windows-sys | 0.61.2 | MIT OR Apache-2.0
212
+ windows-targets | 0.52.6 | MIT OR Apache-2.0
213
+ windows-targets | 0.53.5 | MIT OR Apache-2.0
214
+ windows_aarch64_gnullvm | 0.52.6 | MIT OR Apache-2.0
215
+ windows_aarch64_gnullvm | 0.53.1 | MIT OR Apache-2.0
216
+ windows_aarch64_msvc | 0.52.6 | MIT OR Apache-2.0
217
+ windows_aarch64_msvc | 0.53.1 | MIT OR Apache-2.0
218
+ windows_i686_gnu | 0.52.6 | MIT OR Apache-2.0
219
+ windows_i686_gnu | 0.53.1 | MIT OR Apache-2.0
220
+ windows_i686_gnullvm | 0.52.6 | MIT OR Apache-2.0
221
+ windows_i686_gnullvm | 0.53.1 | MIT OR Apache-2.0
222
+ windows_i686_msvc | 0.52.6 | MIT OR Apache-2.0
223
+ windows_i686_msvc | 0.53.1 | MIT OR Apache-2.0
224
+ windows_x86_64_gnu | 0.52.6 | MIT OR Apache-2.0
225
+ windows_x86_64_gnu | 0.53.1 | MIT OR Apache-2.0
226
+ windows_x86_64_gnullvm | 0.52.6 | MIT OR Apache-2.0
227
+ windows_x86_64_gnullvm | 0.53.1 | MIT OR Apache-2.0
228
+ windows_x86_64_msvc | 0.52.6 | MIT OR Apache-2.0
229
+ windows_x86_64_msvc | 0.53.1 | MIT OR Apache-2.0
230
+ wit-bindgen | 0.57.1 | Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT
231
+ x509-cert | 0.2.5 | Apache-2.0 OR MIT
232
+ x509-parser | 0.18.1 | MIT OR Apache-2.0
233
+ zerocopy | 0.8.52 | BSD-2-Clause OR Apache-2.0 OR MIT
234
+ zerocopy-derive | 0.8.52 | BSD-2-Clause OR Apache-2.0 OR MIT
235
+ zeroize | 1.9.0 | Apache-2.0 OR MIT
236
+ zmij | 1.0.21 | MIT
237
+ zstd | 0.13.3 | MIT
238
+ zstd-safe | 7.2.4 | MIT OR Apache-2.0
239
+ zstd-sys | 2.0.16+zstd.1.5.7 | MIT/Apache-2.0
240
+
241
+
242
+ The corresponding upstream license files remain under `vendor/rust-dependencies`; this notice supplements rather than replaces them.