Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Initial implementation of per-key-TTL for KV #703

Merged
merged 6 commits into from
Feb 7, 2025

Conversation

stebet
Copy link
Collaborator

@stebet stebet commented Jan 7, 2025

Note

  • Adds support to set the AllowMsgTTL flag for KV streams
  • Adds a Timestamp ttl optional parameter to the PutAsync<T> method on INatsKVStore
    • Note that this does break API backwards compatibility if users are using their own serializers, but that's seems to be how it's done in Go client, so it's up to you if you want to create a separate overload for each method that can accept a TTL value
  • Added a single test to test the TTL functionality. This currently requires the tests to have access to the latest nightly binary

TODO:

  • More exhaustive tests
  • Add support to the CreateAsync/UpdateAsync API methods

see also ADR-43

@stebet stebet requested a review from mtmk January 7, 2025 15:55
@stebet stebet force-pushed the message-ttl branch 3 times, most recently from 74d3cf9 to d234060 Compare January 8, 2025 16:15
@mtmk mtmk added this to the server 2.11 milestone Jan 27, 2025
@mtmk mtmk changed the base branch from main to server-2.11-features February 3, 2025 09:06
@mtmk
Copy link
Collaborator

mtmk commented Feb 4, 2025

we're hoping to merge this into server 2.11 branch before server release #733

@jodydonetti
Copy link

Can't wait for per-key TTL, it will allow usage of NATS in FusionCache too.

Thanks for all the hard work!

…ts. Those implementing the interface will still need to make changes.
@stebet stebet marked this pull request as ready for review February 6, 2025 16:40
Copy link
Collaborator

@mtmk mtmk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM thanks @stebet

There are still details to be worked out e.g. around SubjectDeleteMarkerTTL but this PR introduces support for per-message/key TTL feature for new server 2.11 soon to be released. We can have follow up PRs into the server-2.11-features branch when we have more implementation details available.

@mtmk mtmk merged commit f053bde into nats-io:server-2.11-features Feb 7, 2025
10 checks passed
mtmk added a commit that referenced this pull request Feb 27, 2025
* Initial implementation of per-key-TTL for KV (#703)
@mtmk mtmk mentioned this pull request Feb 27, 2025
mtmk added a commit that referenced this pull request Feb 27, 2025
* Initial implementation of per-key-TTL for KV (#703)
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants