Skip to content
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

Kv parity issues 94, 95, 96 #599

Merged
merged 22 commits into from Mar 8, 2022
Merged

Kv parity issues 94, 95, 96 #599

merged 22 commits into from Mar 8, 2022

Conversation

scottf
Copy link
Contributor

@scottf scottf commented Feb 16, 2022

nats-io/nats-architecture-and-design#94 Items 1 and 3
nats-io/nats-architecture-and-design#95
nats-io/nats-architecture-and-design#96

@scottf scottf requested a review from aricart February 16, 2022 23:58
@scottf scottf changed the title Kv updates issue 94 Kv updates issue 94, 96 Feb 17, 2022
@scottf scottf changed the title Kv updates issue 94, 96 Kv parity issues 94, 95, 96 Feb 18, 2022
@scottf scottf dismissed aricart’s stale review February 18, 2022 14:46

Accepted as is with explanation

@@ -196,7 +193,8 @@
List<KeyValueEntry> history(String key) throws IOException, JetStreamApiException, InterruptedException;

/**
* Remove history from all keys that currently are deleted or purged.
* Remove history from all keys that currently are deleted or purged
* with using a default KeyValuePurgeOptions
* THIS IS A BETA FEATURE AND SUBJECT TO CHANGE
Copy link
Member

Choose a reason for hiding this comment

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

Can remove the BETA FEATURE comments if PR makes the KV API GA. Alternatively, that could be another PR - up to you.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll do it on another PR


import java.time.Duration;

public class KeyValuePurgeOptions {
Copy link
Member

Choose a reason for hiding this comment

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

Does this need doc?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, will do


NatsKeyValue(NatsConnection connection, String bucketName, KeyValueOptions kvo) throws IOException {
this.bucketName = Validator.validateKvBucketNameRequired(bucketName);
streamName = toStreamName(bucketName);
streamSubject = toStreamSubject(bucketName);
defaultKeyPrefix = toKeyPrefix(bucketName);
rawKeyPrefix = toKeyPrefix(bucketName);
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick... Could simplify a bit and remove rawKeyPrefix, just assign to pubSubKeyPrefix and reassign if necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

rawKeyPrefix is the base. pubSubKeyPrefix varies depending on whether or not there is a JetStream prefix


ZonedDateTime limit;
if (dmThresh < 0) {
limit = DateTimeUtils.fromNow(600000); // long enough in the future to clear all
Copy link
Member

Choose a reason for hiding this comment

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

May want to assign to a private constant...

Copy link
Member

Choose a reason for hiding this comment

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

Or configurable?

Copy link
Contributor Author

@scottf scottf Mar 8, 2022

Choose a reason for hiding this comment

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

it's the only place it's used. Usually I'm constant crazy, but I like this b/c it stands out, and it's really an arbitrary value anyway.

Copy link
Member

@ColinSullivan1 ColinSullivan1 left a comment

Choose a reason for hiding this comment

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

LGTM, have a few suggestions...

@scottf scottf merged commit bf95780 into main Mar 8, 2022
@scottf scottf deleted the kv-updates-issue-94 branch March 8, 2022 19:35
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.

None yet

3 participants