Struct dittolive_ditto::small_peer_info::SmallPeerInfo
source · pub struct SmallPeerInfo { /* private fields */ }
Expand description
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 Ditto::small_peer_info
method.
Implementations§
source§impl SmallPeerInfo
impl SmallPeerInfo
sourcepub fn is_enabled(&self) -> bool
pub fn is_enabled(&self) -> bool
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 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 to whether this information is allowed to sync to other
peers (including the big peer). This is controlled by DittoSmallPeerInfoSyncScope
.
sourcepub fn set_enabled(&self, enabled: bool)
pub fn set_enabled(&self, enabled: bool)
Sets whether small peer info collection is currently enabled.
sourcepub fn sync_scope(&self) -> DittoSmallPeerInfoSyncScope
pub fn sync_scope(&self) -> DittoSmallPeerInfoSyncScope
Determines which “kind” of peers the small peer info will be
replicate to, defaults to DittoSmallPeerInfoSyncScope::LocalPeerOnly
.
sourcepub fn set_sync_scope(&self, sync_scope: DittoSmallPeerInfoSyncScope)
pub fn set_sync_scope(&self, sync_scope: DittoSmallPeerInfoSyncScope)
Sets which “kind” of peers the small peer info will be replicated to.
sourcepub fn metadata<T: DeserializeOwned>(&self) -> Result<T, DittoError>
pub fn metadata<T: DeserializeOwned>(&self) -> Result<T, DittoError>
Returns the JSON metadata being associated with the small peer info.
sourcepub fn set_metadata<T: Serialize>(&self, metadata: &T) -> Result<(), DittoError>
pub fn set_metadata<T: Serialize>(&self, metadata: &T) -> Result<(), DittoError>
Sets the JSON metadata to be associated with the small peer info.
The metadata is a free-form, user-provided dictionary that 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 64 levels deep.
sourcepub fn metadata_json_string(&self) -> Result<String, DittoError>
pub fn metadata_json_string(&self) -> Result<String, DittoError>
Returns the JSON string of the metadata being associated with the small peer info.
sourcepub fn set_metadata_json_string(&self, metadata: &str) -> Result<(), DittoError>
pub fn set_metadata_json_string(&self, metadata: &str) -> Result<(), DittoError>
Sets the JSON metadata to be associated with the small peer info.
The metadata is free-form, user-provided string 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 64 levels deep.