Class DittoSmallPeerInfo

java.lang.Object
com.ditto.java.DittoSmallPeerInfo

public final class DittoSmallPeerInfo extends Object
Manages diagnostic information collection for small peers. `DittoSmallPeerInfo` collects diagnostic information from small peers at regular intervals, optionally syncing it to the Big Peer for monitoring and debugging through the device dashboard. Access it through a [Ditto] instance's [Ditto#getSmallPeerInfo()] method. This class can't be instantiated directly. You can access an instance through the [ditto.getSmallPeerInfo()] API.
  • Method Details

    • isEnabled

      public boolean isEnabled()

      Indicates whether small peer info collection is currently enabled. Defaults to true.

      Small peer info consists of information scraped into a system collection at repeated intervals and synced to the Big Peer for device dashboard and debugging purposes.

      Note: Whether the background ingestion process is enabled or not is a separate decision from whether this information is allowed to sync to other peers (including the Big Peer). This is controlled by Sync Scopes, settable via DQL ALTER SYSTEM.

      Returns:
      true if small peer info collection is enabled, false otherwise.
    • setEnabled

      public void setEnabled(boolean enabled)
      Sets whether small peer info collection is enabled.
      Parameters:
      enabled - true to enable collection, false to disable.
      See Also:
    • getMetadata

      public @NonNull Map<String,Object> getMetadata()
      Returns the JSON metadata being associated with the small peer info. The metadata is a free-form JSON object that gets inserted into the small peer info system document at each collection interval.
      Returns:
      an unmodifiable map containing the metadata.
    • getMetadataJsonString

      public @NonNull String getMetadataJsonString()
      Returns the raw JSON string metadata being associated with the small peer info.
      Returns:
      the metadata as a JSON string.
    • setMetadata

      public void setMetadata(@NonNull Map<String,Object> metadata) throws DittoException.SmallPeerInfoException
      Sets the JSON metadata to be associated with the small peer info. The metadata is a free-form, user-provided map that is serialized into JSON and inserted into the small peer info system doc at each collection interval. The map has no schema except for the following constraints: 1. All contained values must be JSON serializable. 2. The size of the map serialized as JSON may not exceed 128 KB. 3. The map may only be nested up to 64 levels deep.
      Parameters:
      metadata - The metadata map to set.
      Throws:
      DittoException.SmallPeerInfoException - If the metadata exceeds size limits, depth limits, or is not a valid JSON object.
    • setMetadataJsonString

      public void setMetadataJsonString(@NonNull String jsonString) throws DittoException.SmallPeerInfoException
      Sets the raw JSON string metadata to be associated with the small peer info. The metadata is a free-form, user-provided JSON object that is inserted into the small peer info system doc at each collection interval. The JSON data has no schema except for the following constraints: 1. The contained JSON data must be a JSON object. 2. The size of the JSON string may not exceed 128 KB. 3. The contained JSON hash may only be nested up to 64 levels deep.
      Parameters:
      jsonString - The JSON string to set as metadata.
      Throws:
      DittoException.SmallPeerInfoException - If the metadata exceeds size limits, depth limits, or is not a valid JSON object.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object