The entrypoint for small peer user info collection. Small peer info consists of information gathered into a system collection on a regular interval and optionally synced to the Big Peer for device dashboard and debugging purposes.

An instance of this class is available on each Ditto instance via its smallPeerInfo property. Instantiating this class directly is not supported.

Accessors

  • get isEnabled(): boolean
  • Indicates whether small peer info collection is currently enabled, defaults to false.

    Note: whether the background ingestion process is enabled or not is a separate decision to whether this information is allowed to sync to other peers (including the big peer). This is controlled by getSyncScope() and setSyncScope().

    Returns boolean

  • set isEnabled(newValue): void
  • Set whether small peer info collection is enabled.

    Parameters

    • newValue: boolean

    Returns void

    Throws

    when set to a non-boolean value.

  • get metadata(): Record<string, any>
  • The metadata associated with the small peer info.

    Small peer info metadata is a free-form, user-provided JSON object that is inserted into the small peer info system document at each collection interval.

    Returns Record<string, any>

  • set metadata(metadata): void
  • Set the metadata associated with the small peer info.

    The metadata must be a JSON-serializable object that conforms to the following constraints:

    • Must be a JSON object (not an array, string, number, etc.)
    • The size when encoded as JSON must be less than 128 KB
    • May only be nested up to 64 levels deep

    Parameters

    • metadata: Record<string, any>

    Returns void

    Example: Valid metadata

    ditto.smallPeerInfo.metadata = {
    "foo": "bar",
    "nested": {
    "inner": "value"
    }
    }

    Throws

    when set to a value that violates any of the constraints listed above.

  • get metadataJSONString(): string
  • The metadata associated with the small peer info, as a JSON string.

    Returns string

  • set metadataJSONString(metadata): void
  • Set the metadata associated with the small peer info, as a JSON string.

    Parameters

    • metadata: string

    Returns void

    See

    metadata for more information on valid values.

    Throws

    when set to a value that violates any of the constraints listed in metadata.

Methods

  • Determines which "kind" of peers the small peer info will be replicated to.

    Defaults to LocalPeerOnly, which means no replication. Set this to BigPeerOnly to replicate collected info to the Big Peer.

    Returns Promise<SmallPeerInfoSyncScope>

  • Set the sync scope.

    See getSyncScope for more information.

    Parameters

    Returns Promise<void>

    Throws

    when set to a value other than BigPeerOnly or LocalPeerOnly.