Skip to content

Refactor nanots API for composite key support and format changes#10

Merged
dicroce merged 4 commits into
mainfrom
sequence
May 26, 2026
Merged

Refactor nanots API for composite key support and format changes#10
dicroce merged 4 commits into
mainfrom
sequence

Conversation

@dicroce
Copy link
Copy Markdown
Owner

@dicroce dicroce commented May 26, 2026

This pull request introduces a major upgrade to the NanoTS time-series database, focusing on a new on-disk format (v2) and support for composite (timestamp, secondary_key) ordering. The changes are reflected in both the codebase (amalgamated_src/nanots.h) and documentation (README.md), enabling advanced use cases where timestamps may not be unique. The API is expanded to support composite-key operations throughout writing, reading, seeking, and deletion. The new format is not backward-compatible with v1.

dicroce added 4 commits May 25, 2026 19:52
- Removed secondary key mismatch error codes and related checks, as the composite key semantics now encompass previous secondary key behaviors.
- Updated the `nanots_writer` and `nanots_iterator` classes to handle composite keys (timestamp, secondary_key) for ordering and searching.
- Modified tests to reflect the new composite key logic, including duplicate timestamps and default secondary key behavior.
- Adjusted C API functions to align with the new iterator find functionality that accepts both timestamp and secondary key.
- Updated `nanots_writer::free_blocks` to accept a secondary key range for block deletion, allowing for more granular control over which blocks to remove based on both timestamp and secondary key.
- Modified `nanots_reader::read`, `query_stream_tags`, and `query_contiguous_segments` methods to include secondary key parameters, enabling reads and queries to consider both timestamp and secondary key ranges.
- Adjusted the corresponding C API functions to match the new method signatures and behavior.
- Updated unit tests to validate the new functionality, ensuring that both timestamp and secondary key ranges are correctly handled in various scenarios.
- Enhanced documentation to reflect the changes in method signatures and usage patterns for the new composite key functionality.
@dicroce dicroce merged commit a0cfded into main May 26, 2026
6 checks passed
@dicroce dicroce deleted the sequence branch May 27, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant