Skip to content

Commit 3c28384

Browse files
committed
remove external participant id coupling
1 parent f9c1007 commit 3c28384

File tree

3 files changed

+6
-34
lines changed

3 files changed

+6
-34
lines changed

pulsebeam/src/entity.rs

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -194,23 +194,13 @@ impl AsRef<str> for ExternalRoomId {
194194
}
195195

196196
pub struct ParticipantId {
197-
pub external: ExternalParticipantId,
198197
pub internal: EntityId,
199198
}
200199

201200
impl ParticipantId {
202-
pub fn new(external: ExternalParticipantId) -> Self {
201+
pub fn new() -> Self {
203202
let internal = new_entity_id(prefix::PARTICIPANT_ID);
204-
Self { external, internal }
205-
}
206-
}
207-
208-
impl TryFrom<&str> for ParticipantId {
209-
type Error = IdValidationError;
210-
211-
fn try_from(value: &str) -> Result<Self, Self::Error> {
212-
let external = ExternalParticipantId::from_str(value)?;
213-
Ok(Self::new(external))
203+
Self { internal }
214204
}
215205
}
216206

@@ -469,15 +459,10 @@ mod tests {
469459
#[test]
470460
fn test_participant_id_equality_and_hash() {
471461
let internal = "pa_xyz987".to_string();
472-
let ext = ExternalParticipantId::new("external_pa".into()).unwrap();
473462
let id1 = ParticipantId {
474-
external: ext.clone(),
475463
internal: internal.clone(),
476464
};
477-
let id2 = ParticipantId {
478-
external: ext,
479-
internal,
480-
};
465+
let id2 = ParticipantId { internal };
481466

482467
assert_eq!(id1, id2);
483468
use std::collections::hash_map::DefaultHasher;
@@ -487,12 +472,4 @@ mod tests {
487472
id2.hash(&mut h2);
488473
assert_eq!(h1.finish(), h2.finish());
489474
}
490-
491-
#[test]
492-
fn test_participant_id_equality_multiple() {
493-
let ext = ExternalParticipantId::new("external_pa".into()).unwrap();
494-
let participant_id1 = ParticipantId::new(ext.clone());
495-
let participant_id2 = ParticipantId::new(ext);
496-
assert_ne!(participant_id1, participant_id2);
497-
}
498475
}

pulsebeam/src/signaling.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
use crate::entity::{ParticipantId, RoomId};
2-
use crate::{
3-
controller,
4-
entity::{ExternalParticipantId, ExternalRoomId},
5-
};
2+
use crate::{controller, entity::ExternalRoomId};
63
use axum::{
74
Router,
85
extract::{Query, State},
@@ -54,7 +51,6 @@ impl IntoResponse for SignalingError {
5451
#[derive(serde::Deserialize, serde::Serialize, Debug)]
5552
pub struct ParticipantInfo {
5653
room: ExternalRoomId,
57-
participant: ExternalParticipantId,
5854
}
5955

6056
#[axum::debug_handler]
@@ -67,7 +63,7 @@ async fn spawn_participant(
6763
// TODO: validate content_type = "application/sdp"
6864

6965
let room_id = RoomId::new(info.room);
70-
let participant_id = ParticipantId::new(info.participant);
66+
let participant_id = ParticipantId::new();
7167
tracing::info!("allocated {} to {}", participant_id, room_id);
7268

7369
// TODO: better unique ID to handle session.

pulsebeam/src/test_utils.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ use pulsebeam_runtime::net;
55
use str0m::media::Mid;
66

77
pub fn create_participant_id() -> Arc<entity::ParticipantId> {
8-
let external = entity::ExternalParticipantId::new(entity::new_random_id("tp", 10)).unwrap();
9-
let participant_id = entity::ParticipantId::new(external);
8+
let participant_id = entity::ParticipantId::new();
109
Arc::new(participant_id)
1110
}
1211

0 commit comments

Comments
 (0)