Package io.keikai.doc.collab.utils
Class StructStore
java.lang.Object
io.keikai.doc.collab.utils.StructStore
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddStruct(StructStore store, AbstractStruct struct) static AbstractStructfind(StructStore store, ID id) Expects that id is actually in store.static intfindIndexCleanStart(Transaction transaction, List<AbstractStruct> structs, int clock) static intfindIndexSS(List<AbstractStruct> structs, int clock) Perform a binary search on a sorted arraystatic AbstractStructgetItem(StructStore store, ID id) Expects that id is actually in store.static AbstractStructgetItemCleanEnd(Transaction transaction, StructStore store, ID id) Expects that id is actually in store.static ItemgetItemCleanStart(Transaction transaction, ID id) Expects that id is actually in store.static intgetState(StructStore store, int client) getStateVector(StructStore store) Return the states as aMap<client,clock>.static voidintegrityCheck(StructStore store) static voiditerateStructs(Transaction transaction, List<AbstractStruct> structs, int clockStart, int len, Consumer<AbstractStruct> f) Iterate over a range of structsstatic voidreplaceStruct(StructStore store, AbstractStruct struct, AbstractStruct newStruct) Replace `item` with `newitem` in storevoidsetPendingDs(Uint8Array pendingDs) voidsetPendingStructs(StructResult pendingStructs)
-
Constructor Details
-
StructStore
public StructStore()
-
-
Method Details
-
getClients
-
getPendingStructs
-
setPendingStructs
-
getPendingDs
-
setPendingDs
-
getStateVector
Return the states as aMap<client,clock>. Note that clock refers to the next expected clock id.- Parameters:
store-- Returns:
-
getState
-
integrityCheck
-
addStruct
-
findIndexSS
Perform a binary search on a sorted array- Parameters:
structs-clock-- Returns:
-
find
Expects that id is actually in store. This function throws or is an infinite loop otherwise.- Parameters:
store-id-- Returns:
-
getItem
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, List<AbstractStruct> structs, int clock) -
getItemCleanStart
Expects that id is actually in store. This function throws or is an infinite loop otherwise.- Parameters:
transaction-id-- Returns:
-
getItemCleanEnd
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, List<AbstractStruct> structs, int clockStart, int len, Consumer<AbstractStruct> f) Iterate over a range of structs- Parameters:
transaction-structs-clockStart- Inclusive startlen-f-
-