Java
Ditto introduced an experimental feature for retrieving, configuring, and restoring default configurations for the Ditto peer-to-peer system at runtime using Ditto Query Language (DQL) syntax.
The Customer Experience team offers this feature to customers when appropriate for your scenario and use case.
Through two new statements:ALTER SYSTEM and SHOW, you can change parameters, settings, and configurations while your peer-to-peer system is actively running.
Due to recent improvements to the sync protocol, Small peers no longer accumulate unsubscribed documents when subscription statuses are changed.
This fix ensures that the peer-to-peer system prevents retaining unnecessary data, resulting in optimized resource usage.
Ditto's recent adjustments to the sync protocol have decreased the exchange of redundant data during re-synchronization, improving the efficiency and stability of the sync process.
Ditto decoupled sync protocol from conflict-free replicated data types (CRDTs) so peers now prioritize using the latest supported protocol version for data exchange.
This change is backward-compatible, so even if your app uses legacy CRDTs, you'll benefit.
The documentation for the sort() API method on cursor operations has been updated to provide clearer explanations of behavior in cases where the specified field for sorting is missing.
Now, parser error messages focus more on indicating the location of errors within the input code, rather than suggesting potential fixes.
With this improvement to the API reference, you have better guidance in debugging your code.
This fix addresses a specific bug where Ditto Link could go into a "forever loop" under certain conditions. This loop, caused performance issues and could potentially lead your app crashing.
Before this fix, there were issues with incorrect casting to boolean values, leading to inconsistent behavior. This update ensures that values are cast properly, resulting in consistency across your app.
If you're using legacy CRDTs in your app, now you can perform comparisons with ATTACHMENT objects.
Previously, DQL queries were limited when retrieving the pointer, or attachment token, Ditto references to fetch its associated ATTACHMENT object holding the binary large object (blob) storing the binary contents representing the actual binary data being stored, such as a large image file.
Now you can query the following additional fields:
Property | Description |
---|---|
id | A cryptographic hash of the attachment's contents. (See Organizing by ID and Attachment Token) |
metadata | Additional information about the attachment, such as its name, type, and so on. (See Attachment Token) |
len | The size of the blob data in terms of length (len) in bytes. (See Blob Store) |
Following is an example document showing these new fields:
We've improved error handling mechanisms to manage input-output (IO) errors that may result during the creation of ATTACHMENT objects.
Now you'll receive clearer feedback when encountering errors so you can prevent potential crashes and improve the overall stability of your app.
Fixed: Improved internal data decoding functions to prevent API crashes under certain inputs:
We've improved the software component for handling tasks such as byte parsing, character decoding, and data type conversion. Instead of crashing, like before, the API returns an error.
There were issues causing app crashes during the preparation phase for syncing data to remote peers.
With these improvements, the likelihood of encountering errors during syncing has been significantly reduced.
The following synchronous methods are now available in the DittoStore Java API:
- DittoStore::execute(String)
- DittoStore::execute(String, Map)
With these methods, you can execute queries in a blocking way. This means that operations can be delayed until the query completes and returns the result; for example, in response to end-user interaction, like a profile update, in your app.
With the latest update to the Java API classes: DittoStoreObserver and DittoSyncSubscription, you now have read-only access to the following fields:
- queryString
- queryArgument
Use queryString to retrieve the string associated with a Ditto store observer or a sync subscription. Similarly, use queryArgument for visibility into associated arguments, if any.
With the following new method overload for registering store observers, you no longer have to pass unnecessary argument parameters:
New DittoStore::registerObserver(String, DittoChangeHandler)
Previously, you'd create attachments using a method in the DittoCollection class, which has since been deprecated.
New Method for Creating Attachments
This release rolls out a replacement classDittoStore class with a new API method for creating ATTACHMENT objects:
newAttachment()
This new way of creating attachments comes with improvements, such as asynchronous or, in Kotlin, suspendable (suspend) execution. Meaning, it does not block your main thread.
New Property for Managing Fetching
With the attachmentFetchers property, keep track of ongoing attachment fetching operations.
New Mechanism for Handling Fetching-Related Errors
If there are any issues fetching attachments, the fetchAttachment() method now throws DittoError.
New Document Field Properties for Identifying Attachments
The following new properties that you can query to increase the efficiency of fetching operations:
Property | Description |
---|---|
id | A cryptographic hash of the attachment's contents. |
metadata | Additional information about the attachment, such as its name, type, and so on. |
len | The size of the blob data in terms of length (len) in bytes. |
New Method for Retrieving Length of Attachments
The getLength() method provides a way to determine how large an attachment is in terms of its bytes.
With this addition, you can access reference information about Ditto API's classes, methods, and so on from your IDE.
The Javadocs JAR artifact is available in the dittopresenceviewer module of the Ditto SDK. To enable access in your IDE, specify the artifact's location in your project settings.
Previously, the syncGroup and routingHint properties in the DittoGlobalConfig class were represented as unsigned 32-bit integers (UINT).
They've been redefined as long integers so you can hold a much larger range of values in these properties, which are represented as of this release as 64-bit signed integers.
We fixed an issue related to the structure representing attachment tokens provided by the value of DittoQueryResultItem so that the schema accurately represents the content of attachment tokens.
Now the token is structured within the document as a MAP object in the form of ["id": "...", "len": 123, "metadata": ...], where metadata is a Map<String, String>.
Two peers targeting each other simultaneously in Ditto Bus or Query Overlap Groups, known as mutual-link connections, no longer struggle to establish a multihop connection to participate in the flood-fill process.