forked from joewilliams/merle
-
Notifications
You must be signed in to change notification settings - Fork 2
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
Support for incr/decr operations #1
Open
jesse-lauro
wants to merge
69
commits into
ppolv:master
Choose a base branch
from
jesse-lauro:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
incr/2 implements the increment command for memcached, decr implements the decrement command. addcounter/1 uses a simple (non-CAS) set to initialized a counter set at zero, which can then be fiddled with via incr/2 and decr/2. This was necessary because merle functions mainly as a key/value store for arbitrary erlang data instead of a general data-store, such as we want for cacti purposes. literal/1 allows the user to submit literal strings over the socket to memcached. This should be used with extreme caution as memcached is intolerant of malformed input, but it is useful for determining what strings sent to memcached should look like and checking assumptions about its behavior. TODO: (optional) need a Check-And-Set version of addcounter so that distributed applications can update the same value with incr/2 and decr/2. This would save client code from having to try changing a value and then making a separate call to initialize it if it does not exist.
All three of the above functions now return more erlang-ish results, in keeping with the rest of merle. addcounter/1 also uses incr/2 to determine if a prospective key exists before creating it. This should be replaced with a CAS-version in the future.
merle:literal/1 is rough and possibly dangerous to leave in production code (why would we let random erlang clients submit arbitrary strings to memcached?), so it is now compiled only when the DEV flag is defined to erlc. Added EDoc segments for addcounter/1, incr/2 and decr/2 have been added
* added incr and decr to listed features * added note to the effect that counters aren't erlang terms * demonstration of incr, decr and addcounter * examples of delete with counters and incr/decr on counters that don't exist
This reverts commit 3c0798a.
This reverts commit 00538e0.
merle is distributed under the MIT license, but doesn't seem to have copy of the text of the MIT license with the code. With the addition of LICENCE.txt, that little wrinkle should be cleared up.
…e in purely list form
…clustering to play nice with added support for increment operations
…rt more than just erlang binary term storage in order to support inc/dec operations
… merle process and let the merle_watcher restart it via the supervisor.
…ge in queue, and move on
…gr dies, all outstanding merle watchers will also die
…ions at any given time
…n the event of a bug
…n the event of a bug
Locked pgs
…tead we initialize on demand.
…merle_client itself. merle_pool merely chooses a client, which is then checked out via the exec function
… along with value
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please consider merging this branch. Basically added support for incr/decr operations.