DittoSmallPeerInfo
public class DittoSmallPeerInfo
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.
You don’t create this class directly, but can access it from a particular Ditto
instance via its smallPeerInfo
property.
-
Indicates whether small peer info collection is currently enabled, defaults to
false
.Small peer info consists of information scraped into a system collection at repeated interval 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 to whether this information is allowed to sync to other peers (including the big peer). This is controlled by
syncScope
.Declaration
Swift
public var isEnabled: Bool { get set }
-
Determines which “kind” of peers the small peer info will be replicate to, defaults to
.localPeerOnly
.Declaration
Swift
public var syncScope: DittoSmallPeerInfoSyncScope { get set }
-
Returns the JSON metadata being associated with the small peer info.
See
setMetadata()
for details.Declaration
Swift
public var metadata: [String : Any] { get }
-
Sets the JSON metadata to be associated with the small peer info.
The metadata is free-form, user-provided dictionary is serialized into JSON and is inserted into the small peer info system doc at each collection interval. The dictionary has no schema except for the following constraints:
- All contained values must be JSON serializable.
- The size of the dictionary serialized as JSON may not exceed 128 KB.
- The dictionary may only be nested up to 2 levels deep.
Throws
DittoSwiftError.validationError
and rethrows anyNSError
as a result of serializing the metadata into JSON data (viaJSONSerialization
).Declaration
Swift
public func setMetadata(_ metadata: [String : Any]) throws
-
Returns the JSON metadata being associated with the small peer info.
See
setMetadataJSONString()
for details.Declaration
Swift
public var metadataJSONString: String { get }
-
Sets the JSON metadata to be associated with the small peer info.
The metadata is 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:
- The contained JSON data must be a JSON hash.
- The size of the JSON string may not exceed 128 KB.
- The contained JSON hash may only be nested up to 2 levels deep.
Throws
DittoSwiftError.validationError
.Declaration
Swift
public func setMetadataJSONString(_ jsonString: String) throws