Arbitrary metadata associated with the patch, which is not used by the library.
A list of operations in the patch.
Returns the patch ID, which is equal to the ID of the first operation in the patch.
The ID of the first operation in the patch.
Returns the expected time of the next inserted operation.
The .rebase()
operation is meant to be applied to patches which have not
yet been advertised to the server (other peers), or when
the server clock is used and concurrent change on the server happened.
The .rebase() operation returns a new Patch
with the IDs recalculated
such that the first operation has the time
equal to newTime
.
Time where the patch ID should begin (ID of the first operation).
Optional
transformAfter: numberTime after (and including) which the IDs should be transformed. If not specified, equals to the time of the first operation.
Creates a new patch where all timestamps are transformed using the provided function.
Timestamp transformation function.
A new patch with transformed timestamps.
Returns the total time span of the patch, which is the sum of all operation spans.
The length of the patch.
Marshals the patch into a binary representation.
A binary representation of the patch.
Returns a textual human-readable representation of the patch. This can be used for debugging purposes.
Start string for each line.
Text representation of the patch.
Static
from
Represents a JSON CRDT patch.
Normally, you would create a new patch using the PatchBuilder class.
Save patch to a binary representation:
Load patch from a binary representation: