This commit is contained in:
Antonio Scandurra 2022-09-22 17:08:36 +02:00
parent 46019f8537
commit 8fec7da799
6 changed files with 80 additions and 13 deletions

View file

@ -7,10 +7,13 @@ use std::{mem, path::PathBuf, str, time::Duration};
use time::OffsetDateTime;
use tracing::instrument;
pub type RoomId = u64;
#[derive(Default, Serialize)]
pub struct Store {
connections: BTreeMap<ConnectionId, ConnectionState>,
connections_by_user_id: BTreeMap<UserId, HashSet<ConnectionId>>,
rooms: BTreeMap<RoomId, Room>,
projects: BTreeMap<ProjectId, Project>,
#[serde(skip)]
channels: BTreeMap<ChannelId, Channel>,
@ -25,6 +28,17 @@ struct ConnectionState {
channels: HashSet<ChannelId>,
}
#[derive(Serialize)]
struct Room {
participants: HashMap<ConnectionId, Participant>,
}
#[derive(Serialize)]
struct Participant {
user_id: UserId,
shared_projects: HashSet<ProjectId>,
}
#[derive(Serialize)]
pub struct Project {
pub online: bool,