conduwuit/src/service/rooms/short/data.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

27 lines
937 B
Rust
Raw Normal View History

2022-10-05 18:36:12 +02:00
use std::sync::Arc;
2022-10-05 20:34:31 +02:00
use ruma::{events::StateEventType, EventId, RoomId};
2022-10-05 18:36:12 +02:00
use crate::Result;
pub trait Data: Send + Sync {
2022-10-05 20:34:31 +02:00
fn get_or_create_shorteventid(&self, event_id: &EventId) -> Result<u64>;
2022-10-05 18:36:12 +02:00
fn multi_get_or_create_shorteventid(&self, event_id: &[&EventId]) -> Result<Vec<u64>>;
2022-10-05 18:36:12 +02:00
fn get_shortstatekey(&self, event_type: &StateEventType, state_key: &str) -> Result<Option<u64>>;
fn get_or_create_shortstatekey(&self, event_type: &StateEventType, state_key: &str) -> Result<u64>;
fn get_eventid_from_short(&self, shorteventid: u64) -> Result<Arc<EventId>>;
fn get_statekey_from_short(&self, shortstatekey: u64) -> Result<(StateEventType, String)>;
/// Returns (shortstatehash, already_existed)
2022-10-05 20:34:31 +02:00
fn get_or_create_shortstatehash(&self, state_hash: &[u8]) -> Result<(u64, bool)>;
2022-10-05 18:36:12 +02:00
fn get_shortroomid(&self, room_id: &RoomId) -> Result<Option<u64>>;
2022-10-05 20:34:31 +02:00
fn get_or_create_shortroomid(&self, room_id: &RoomId) -> Result<u64>;
2022-09-07 13:25:51 +02:00
}