Skip to content

Conversation

calmera
Copy link

@calmera calmera commented Mar 31, 2025

Abstract

Wouldn't it be great if it was easier to use a KV in our applications? To be able to apply changes without having to deal with retrying logic when concurrent changes happen? To have entries securely read and written from the KV bucket? Well, that's what this PR is all about.

I found myself reimplementing this in a lot of projects and think it might be a valuable addition to Orbit. It wraps a KV bucket and the corresponding Stream in a Store and allows straightforward operations on it. Changes to the store are done through an Apply() function which takes a Modifier. This modifier can be executed multiple times if a record is updated between reading the entry and writing the updated data.

The Purge() function is an addition to the store to perform a deep-remove of a key from the underlying stream.

calmera added 4 commits March 31, 2025 16:31
Signed-off-by: Daan Gerits <[email protected]>
Signed-off-by: Daan Gerits <[email protected]>
Signed-off-by: Daan Gerits <[email protected]>
@calmera calmera requested review from piotrpio and ripienaar March 31, 2025 15:47
Signed-off-by: Daan Gerits <[email protected]>
@ripienaar
Copy link
Contributor

We should not be exposing non KV operations

The Purge() function is an addition to the store to perform a deep-remove of a key from the underlying stream.

The abstractions are there for a reason, doing this is inherently incompatible with a lot of what KV is. Soon with TTL+Purge there will be a safe way to clear out keys for good.

Signed-off-by: Daan Gerits <[email protected]>
@ripienaar
Copy link
Contributor

I am also reluctant to ship - by us - a competing codec implementation

@calmera
Copy link
Author

calmera commented Apr 13, 2025

We should not be exposing non KV operations

The Purge() function is an addition to the store to perform a deep-remove of a key from the underlying stream.

The abstractions are there for a reason, doing this is inherently incompatible with a lot of what KV is. Soon with TTL+Purge there will be a safe way to clear out keys for good.

makes sense. Will remove the purge option.

@calmera
Copy link
Author

calmera commented Apr 13, 2025

I am also reluctant to ship - by us - a competing codec implementation

I couldn't find any reference to the current codec implementation, but happy to replace what is in here with what the standard should be.

@ripienaar
Copy link
Contributor

Cc @Jarema about codecs.

I have some reservations about the general approach for us - saying a simplification is needed for our KV (already a simplification) is maybe not the message we want to send. We should have a chat about a more KV like way to achieve what this achieves

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.

2 participants