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

UpdatableStore #119

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from
Open

Conversation

avibryant
Copy link

Sketching out an UpdatableStore trait as described in #113. Extends JMapStore and ConcurrentHashMapStore to be UpdateableStores, and adds a new RedisUpdatableStore that uses the TransactionalClient.

Totally untested so far.

Todo:

  • add tests
  • memcache support
  • mysql support
  • combinator to retry on failed updates
  • ConvertedUpdatableStore
  • ShardedUpdatableStore
  • EnrichedUpdatableStore
  • combinator to turn any UpdatableStore + a monoid into a MergeableStore

@softprops
Copy link
Contributor

neat!

import com.twitter.util.Future

trait UpdatableStore[K,V] extends Store[K,V] {
def update(k : K)(fn : Option[V] => Option[V]) : Future[Unit]
Copy link
Collaborator

Choose a reason for hiding this comment

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

is it too restrictive to return Future[Option[V]] which is the original input to the function? This way, the caller knows the value that was actually set into the store.

This does make buffering a pain, and I'm speculating on use cases, so ....

Copy link
Author

Choose a reason for hiding this comment

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

I was mostly just going by analogy with put, which also returns Future[Unit].

Buffering being a pain is a good point, and for me right now that outweighs any hypothetical benefit of returning it (I know that we'd want buffering with this, I'm not sure what we'd use the return value for).

@sritchie
Copy link
Collaborator

The TODOs are so awesome! Hadn't seen that before.

@sritchie
Copy link
Collaborator

@avibryant, are you still interested in getting this bad dawg in? I think we can get it into the next release if so.

@avibryant
Copy link
Author

I'm still interested but don't actively need it right now, so I'm in no rush. What do you think is the minimal TODO to make it worth merging?

@CLAassistant
Copy link

CLAassistant commented Jul 18, 2019

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

5 participants