-
Notifications
You must be signed in to change notification settings - Fork 9
feat(nodejs): protocol version option, binary protocol for doubles #49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces support for protocol version negotiation and binary serialization of double values in the QuestDB Node.js client. The main changes include making configuration parsing asynchronous to support HTTP endpoint queries, adding a new binary protocol (version 2) for more efficient double encoding, and restructuring the buffer implementation with version-specific classes.
- Adds
protocol_version
configuration option with support for 'auto', '1', and '2' values - Implements binary serialization for doubles in protocol version 2 vs text serialization in version 1
- Makes
Sender.fromConfig()
andSenderOptions.fromConfig()
async to support server version negotiation
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.
Show a summary per file
File | Description |
---|---|
test/util/mockhttp.ts | Adds settings endpoint mock and protocol version configuration support |
test/sender.transport.test.ts | Updates all test calls to use async Sender.fromConfig and adds protocol_version parameters |
test/sender.integration.test.ts | Converts Sender constructor calls to use SenderOptions.resolveAuto for proper version resolution |
test/sender.config.test.ts | Updates configuration tests to be async and adds protocol_version to all test cases |
test/sender.buffer.test.ts | Adds protocol_version parameter to all Sender constructor calls in tests |
test/options.test.ts | Extensive updates to test protocol version parsing, validation, and HTTP endpoint negotiation |
src/utils.ts | Adds fetchJson utility function for HTTP requests |
src/sender.ts | Makes fromConfig and fromEnv methods async, changes buffer creation to use factory pattern |
src/options.ts | Adds protocol version parsing, validation, and automatic resolution via HTTP settings endpoint |
src/buffer/index.ts | Refactors to interface-based design with factory function for version-specific buffer creation |
src/buffer/bufferv2.ts | Implements binary double serialization for protocol version 2 |
src/buffer/bufferv1.ts | Implements text-based serialization for protocol version 1 (existing behavior) |
src/buffer/base.ts | Moves common buffer functionality to abstract base class |
Support for sending doubles as binary, and resolving the protocol version option.