Class RepoSequence


  • public class RepoSequence
    extends Object
    Class for managing an incrementing sequence backed by a git repository.

    The current sequence number is stored as UTF-8 text in a blob pointed to by a ref in the refs/sequences/* namespace. Multiple processes can share the same sequence by incrementing the counter using normal git ref updates. To amortize the cost of these ref updates, processes can increment the counter by a larger number and hand out numbers from that range in memory until they run out. This means concurrent processes will hand out somewhat non-monotonic numbers.

    • Method Detail

      • next

        public int next()
                 throws com.google.gwtorm.server.OrmException
        Throws:
        com.google.gwtorm.server.OrmException
      • next

        public com.google.common.collect.ImmutableList<Integer> next​(int count)
                                                              throws com.google.gwtorm.server.OrmException
        Throws:
        com.google.gwtorm.server.OrmException
      • set

        public void set​(int val)
                 throws com.google.gwtorm.server.OrmException
        Throws:
        com.google.gwtorm.server.OrmException
      • increaseTo

        public void increaseTo​(int val)
                        throws com.google.gwtorm.server.OrmException
        Throws:
        com.google.gwtorm.server.OrmException
      • storeNew

        public static org.eclipse.jgit.transport.ReceiveCommand storeNew​(org.eclipse.jgit.lib.ObjectInserter ins,
                                                                         String name,
                                                                         int val)
                                                                  throws IOException
        Throws:
        IOException