Package io.keikai.doc.collab.utils
Class DeleteSet
- java.lang.Object
-
- io.keikai.doc.collab.utils.DeleteSet
-
public class DeleteSet extends java.lang.ObjectWe no longer maintain a DeleteStore. DeleteSet is a temporary object that is created when needed. - When created in a transaction, it must only be accessed after sorting, and merging - This DeleteSet is sent to other clients - We do not create a DeleteSet when we send a sync message. The DeleteSet message is created directly from StructStore - We read a DeleteSet as part of a sync/update message. In this case the DeleteSet is already sorted and merged.
-
-
Constructor Summary
Constructors Constructor Description DeleteSet()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddToDeleteSet(DeleteSet ds, int client, int clock, int length)static DeleteSetcreateDeleteSet()static DeleteSetcreateDeleteSetFromStructStore(StructStore ss)static booleanequalDeleteSets(DeleteSet ds1, DeleteSet ds2)static java.lang.IntegerfindIndexDS(java.util.List<DeleteItem> dis, int clock)java.util.Map<java.lang.Integer,java.util.List<DeleteItem>>getClients()static booleanisDeleted(DeleteSet ds, ID id)static voiditerateDeletedStructs(Transaction transaction, DeleteSet ds, java.util.function.Consumer<AbstractStruct> f)Iterate over all structs that the DeleteSet gc's.static DeleteSetmergeDeleteSets(java.util.List<DeleteSet> dss)static Uint8ArrayreadAndApplyDeleteSet(DSDecoder decoder, Transaction transaction, StructStore store)static DeleteSetreadDeleteSet(DSDecoder decoder)Overloaded readDeleteSet for DSDecoderstatic voidsortAndMergeDeleteSet(DeleteSet ds)static voidwriteDeleteSet(io.keikai.doc.collab.utils.DSEncoder encoder, DeleteSet ds)Internal used only.
-
-
-
Method Detail
-
getClients
public java.util.Map<java.lang.Integer,java.util.List<DeleteItem>> getClients()
-
iterateDeletedStructs
public static void iterateDeletedStructs(Transaction transaction, DeleteSet ds, java.util.function.Consumer<AbstractStruct> f)
Iterate over all structs that the DeleteSet gc's.- Parameters:
transaction-ds-f-
-
findIndexDS
public static java.lang.Integer findIndexDS(java.util.List<DeleteItem> dis, int clock)
- Parameters:
dis-clock-- Returns:
- Integer
-
isDeleted
public static boolean isDeleted(DeleteSet ds, ID id)
- Parameters:
ds-id-- Returns:
- boolean
-
sortAndMergeDeleteSet
public static void sortAndMergeDeleteSet(DeleteSet ds)
- Parameters:
ds-
-
mergeDeleteSets
public static DeleteSet mergeDeleteSets(java.util.List<DeleteSet> dss)
- Parameters:
dss-- Returns:
- DeleteSet
-
addToDeleteSet
public static void addToDeleteSet(DeleteSet ds, int client, int clock, int length)
- Parameters:
ds-client-clock-length-
-
createDeleteSet
public static DeleteSet createDeleteSet()
- Returns:
- DeleteSet
-
createDeleteSetFromStructStore
public static DeleteSet createDeleteSetFromStructStore(StructStore ss)
- Parameters:
ss-- Returns:
- DeleteSet
-
writeDeleteSet
public static void writeDeleteSet(io.keikai.doc.collab.utils.DSEncoder encoder, DeleteSet ds)Internal used only.- Parameters:
encoder-ds-
-
readDeleteSet
public static DeleteSet readDeleteSet(DSDecoder decoder)
Overloaded readDeleteSet for DSDecoder- Parameters:
decoder-- Returns:
- DeleteSet
-
readAndApplyDeleteSet
public static Uint8Array readAndApplyDeleteSet(DSDecoder decoder, Transaction transaction, StructStore store)
- Parameters:
decoder-transaction-store-- Returns:
- Uint8Array
-
-