Files
continuwuity/src/service/rooms/directory/mod.rs
T

24 lines
743 B
Rust
Raw Normal View History

mod data;
2022-10-08 13:04:55 +02:00
2024-04-22 23:48:57 -04:00
pub(crate) use data::Data;
2022-10-09 17:25:06 +02:00
use ruma::{OwnedRoomId, RoomId};
2022-09-07 13:25:51 +02:00
use crate::Result;
2024-04-22 23:48:57 -04:00
pub(crate) struct Service {
pub(crate) db: &'static dyn Data,
}
2022-10-05 12:45:54 +02:00
impl Service {
2024-03-05 19:48:54 -05:00
#[tracing::instrument(skip(self))]
2024-04-22 23:48:57 -04:00
pub(crate) fn set_public(&self, room_id: &RoomId) -> Result<()> { self.db.set_public(room_id) }
2020-05-25 23:24:13 +02:00
2024-03-05 19:48:54 -05:00
#[tracing::instrument(skip(self))]
2024-04-22 23:48:57 -04:00
pub(crate) fn set_not_public(&self, room_id: &RoomId) -> Result<()> { self.db.set_not_public(room_id) }
2020-05-25 23:24:13 +02:00
2024-03-05 19:48:54 -05:00
#[tracing::instrument(skip(self))]
2024-04-22 23:48:57 -04:00
pub(crate) fn is_public_room(&self, room_id: &RoomId) -> Result<bool> { self.db.is_public_room(room_id) }
2020-05-25 23:24:13 +02:00
2024-03-05 19:48:54 -05:00
#[tracing::instrument(skip(self))]
2024-04-22 23:48:57 -04:00
pub(crate) fn public_rooms(&self) -> impl Iterator<Item = Result<OwnedRoomId>> + '_ { self.db.public_rooms() }
}