Package net.carcdr.ycrdt
Interface YBinding
public interface YBinding
Factory for creating Y-CRDT documents.
Implementations are discovered via ServiceLoader.
-
Method Summary
Modifier and TypeMethodDescriptionCreates a new document with a random client ID.createDoc(long clientId) Creates a new document with the specified client ID.byte[]encodeStateVectorFromUpdate(byte[] update) Extracts a state vector from an encoded update.static YBindingReturns the default binding discovered via ServiceLoader.byte[]mergeUpdates(byte[][] updates) Merges multiple updates into a single update.
-
Method Details
-
createDoc
-
createDoc
Creates a new document with the specified client ID.- Parameters:
clientId- the client ID- Returns:
- the new document
-
mergeUpdates
byte[] mergeUpdates(byte[][] updates) Merges multiple updates into a single update.- Parameters:
updates- the updates to merge- Returns:
- the merged update
-
encodeStateVectorFromUpdate
byte[] encodeStateVectorFromUpdate(byte[] update) Extracts a state vector from an encoded update.- Parameters:
update- the encoded update- Returns:
- the state vector
-
getInstance
Returns the default binding discovered via ServiceLoader.- Returns:
- the binding instance
- Throws:
IllegalStateException- if no binding is found
-