handle serde_json for deserialized()
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
946ca364e0
commit
4776fe66c4
13 changed files with 95 additions and 107 deletions
|
@ -33,7 +33,7 @@ pub async fn get_outlier_pdu_json(&self, event_id: &EventId) -> Result<Canonical
|
|||
.eventid_outlierpdu
|
||||
.qry(event_id)
|
||||
.await
|
||||
.deserialized_json()
|
||||
.deserialized()
|
||||
}
|
||||
|
||||
/// Returns the pdu from the outlier tree.
|
||||
|
@ -43,7 +43,7 @@ pub async fn get_pdu_outlier(&self, event_id: &EventId) -> Result<PduEvent> {
|
|||
.eventid_outlierpdu
|
||||
.qry(event_id)
|
||||
.await
|
||||
.deserialized_json()
|
||||
.deserialized()
|
||||
}
|
||||
|
||||
/// Append the PDU as an outlier.
|
||||
|
|
|
@ -156,10 +156,7 @@ impl Data {
|
|||
&self, user_id: &UserId, room_id: &RoomId,
|
||||
) -> Result<Vec<Raw<AnyStrippedStateEvent>>> {
|
||||
let key = (user_id, room_id);
|
||||
self.userroomid_invitestate
|
||||
.qry(&key)
|
||||
.await
|
||||
.deserialized_json()
|
||||
self.userroomid_invitestate.qry(&key).await.deserialized()
|
||||
}
|
||||
|
||||
#[tracing::instrument(skip(self), level = "debug")]
|
||||
|
@ -167,10 +164,7 @@ impl Data {
|
|||
&self, user_id: &UserId, room_id: &RoomId,
|
||||
) -> Result<Vec<Raw<AnyStrippedStateEvent>>> {
|
||||
let key = (user_id, room_id);
|
||||
self.userroomid_leftstate
|
||||
.qry(&key)
|
||||
.await
|
||||
.deserialized_json()
|
||||
self.userroomid_leftstate.qry(&key).await.deserialized()
|
||||
}
|
||||
|
||||
/// Returns an iterator over all rooms a user left.
|
||||
|
|
|
@ -90,17 +90,14 @@ impl Data {
|
|||
return Ok(pdu);
|
||||
}
|
||||
|
||||
self.eventid_outlierpdu
|
||||
.qry(event_id)
|
||||
.await
|
||||
.deserialized_json()
|
||||
self.eventid_outlierpdu.qry(event_id).await.deserialized()
|
||||
}
|
||||
|
||||
/// Returns the json of a pdu.
|
||||
pub(super) async fn get_non_outlier_pdu_json(&self, event_id: &EventId) -> Result<CanonicalJsonObject> {
|
||||
let pduid = self.get_pdu_id(event_id).await?;
|
||||
|
||||
self.pduid_pdu.qry(&pduid).await.deserialized_json()
|
||||
self.pduid_pdu.qry(&pduid).await.deserialized()
|
||||
}
|
||||
|
||||
/// Returns the pdu's id.
|
||||
|
@ -113,7 +110,7 @@ impl Data {
|
|||
pub(super) async fn get_non_outlier_pdu(&self, event_id: &EventId) -> Result<PduEvent> {
|
||||
let pduid = self.get_pdu_id(event_id).await?;
|
||||
|
||||
self.pduid_pdu.qry(&pduid).await.deserialized_json()
|
||||
self.pduid_pdu.qry(&pduid).await.deserialized()
|
||||
}
|
||||
|
||||
/// Like get_non_outlier_pdu(), but without the expense of fetching and
|
||||
|
@ -137,7 +134,7 @@ impl Data {
|
|||
self.eventid_outlierpdu
|
||||
.qry(event_id)
|
||||
.await
|
||||
.deserialized_json()
|
||||
.deserialized()
|
||||
.map(Arc::new)
|
||||
}
|
||||
|
||||
|
@ -162,12 +159,12 @@ impl Data {
|
|||
///
|
||||
/// This does __NOT__ check the outliers `Tree`.
|
||||
pub(super) async fn get_pdu_from_id(&self, pdu_id: &[u8]) -> Result<PduEvent> {
|
||||
self.pduid_pdu.qry(pdu_id).await.deserialized_json()
|
||||
self.pduid_pdu.qry(pdu_id).await.deserialized()
|
||||
}
|
||||
|
||||
/// Returns the pdu as a `BTreeMap<String, CanonicalJsonValue>`.
|
||||
pub(super) async fn get_pdu_json_from_id(&self, pdu_id: &[u8]) -> Result<CanonicalJsonObject> {
|
||||
self.pduid_pdu.qry(pdu_id).await.deserialized_json()
|
||||
self.pduid_pdu.qry(pdu_id).await.deserialized()
|
||||
}
|
||||
|
||||
pub(super) async fn append_pdu(&self, pdu_id: &[u8], pdu: &PduEvent, json: &CanonicalJsonObject, count: u64) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue