Notedb: Add a git repo based sequence implementation

This is intended to replace the next*Id() methods in ReviewDb. We
increment a counter stored in a blob on refs/sequences/*, and allow
multiple processes to reserve chunks of the number space so they can
operate concurrently. The resulting IDs are not quite monotonic, but
this is a common feature of distributed unique ID assignment; the
careful observer will note the same behavior on gerrit-review, for
example.

Change-Id: Ia5f59233df97b7eff71b1ec6af1d816975f28ad9
This commit is contained in:
Dave Borowitz
2016-01-14 13:01:54 -05:00
parent 906471f1f7
commit 9b82bfdd57
5 changed files with 466 additions and 0 deletions

View File

@@ -46,6 +46,9 @@ public class RefNames {
/** A change starred by a user */
public static final String REFS_STARRED_CHANGES = "refs/starred-changes/";
/** Sequence counters in notedb. */
public static final String REFS_SEQUENCES = "refs/sequences/";
/**
* Prefix applied to merge commit base nodes.
* <p>