Class StructStore


  • public class StructStore
    extends java.lang.Object
    • Constructor Detail

      • StructStore

        public StructStore()
    • Method Detail

      • getClients

        public java.util.Map<java.lang.Integer,​java.util.List<AbstractStruct>> getClients()
      • getPendingStructs

        public StructResult getPendingStructs()
      • setPendingStructs

        public void setPendingStructs​(StructResult pendingStructs)
      • setPendingDs

        public void setPendingDs​(Uint8Array pendingDs)
      • getStateVector

        public static java.util.Map<java.lang.Integer,​java.lang.Integer> getStateVector​(StructStore store)
        Return the states as a Map<client,clock>. Note that clock refers to the next expected clock id.
        Parameters:
        store -
        Returns:
      • getState

        public static int getState​(StructStore store,
                                   int client)
      • integrityCheck

        public static void integrityCheck​(StructStore store)
      • findIndexSS

        public static int findIndexSS​(java.util.List<AbstractStruct> structs,
                                      int clock)
        Perform a binary search on a sorted array
        Parameters:
        structs -
        clock -
        Returns:
      • find

        public static AbstractStruct find​(StructStore store,
                                          ID id)
        Expects that id is actually in store. This function throws or is an infinite loop otherwise.
        Parameters:
        store -
        id -
        Returns:
      • getItem

        public static AbstractStruct getItem​(StructStore store,
                                             ID id)
        Expects that id is actually in store. This function throws or is an infinite loop otherwise.
        Parameters:
        store -
        id -
        Returns:
      • findIndexCleanStart

        public static int findIndexCleanStart​(Transaction transaction,
                                              java.util.List<AbstractStruct> structs,
                                              int clock)
      • getItemCleanStart

        public static Item getItemCleanStart​(Transaction transaction,
                                             ID id)
        Expects that id is actually in store. This function throws or is an infinite loop otherwise.
        Parameters:
        transaction -
        id -
        Returns:
      • getItemCleanEnd

        public static AbstractStruct getItemCleanEnd​(Transaction transaction,
                                                     StructStore store,
                                                     ID id)
        Expects that id is actually in store. This function throws or is an infinite loop otherwise.
        Parameters:
        transaction -
        store -
        id -
        Returns:
      • replaceStruct

        public static void replaceStruct​(StructStore store,
                                         AbstractStruct struct,
                                         AbstractStruct newStruct)
        Replace `item` with `newitem` in store
        Parameters:
        store -
        struct -
        newStruct -
      • iterateStructs

        public static void iterateStructs​(Transaction transaction,
                                          java.util.List<AbstractStruct> structs,
                                          int clockStart,
                                          int len,
                                          java.util.function.Consumer<AbstractStruct> f)
        Iterate over a range of structs
        Parameters:
        transaction -
        structs -
        clockStart - Inclusive start
        len -
        f -