github.com/livekit/protocol@v1.39.3/observability/roomobs/participantrecorder.go (about) 1 package roomobs 2 3 import ( 4 "github.com/livekit/protocol/livekit" 5 ) 6 7 type ParticipantReporterResolver interface { 8 Resolve(roomName livekit.RoomName, roomID livekit.RoomID, participant livekit.ParticipantIdentity, pID livekit.ParticipantID) 9 Reset() 10 } 11 12 type deferredParticipantResolver struct { 13 room KeyResolver 14 roomSession KeyResolver 15 participant KeyResolver 16 participantSession KeyResolver 17 } 18 19 func DeferredParticipantReporter(p ProjectReporter) (ParticipantSessionReporter, ParticipantReporterResolver) { 20 room, roomResolver := p.WithDeferredRoom() 21 roomSession, roomSessionResolver := room.WithDeferredRoomSession() 22 participant, participantResolver := roomSession.WithDeferredParticipant() 23 participantSession, participantSessionResolver := participant.WithDeferredParticipantSession() 24 25 return participantSession, deferredParticipantResolver{roomResolver, roomSessionResolver, participantResolver, participantSessionResolver} 26 } 27 28 func (r deferredParticipantResolver) Resolve(roomName livekit.RoomName, roomID livekit.RoomID, participant livekit.ParticipantIdentity, pID livekit.ParticipantID) { 29 r.room.Resolve(string(roomName)) 30 r.roomSession.Resolve(string(roomID)) 31 r.participant.Resolve(string(participant)) 32 r.participantSession.Resolve(string(pID)) 33 } 34 35 func (r deferredParticipantResolver) Reset() { 36 r.room.Reset() 37 r.roomSession.Reset() 38 r.participant.Reset() 39 r.participantSession.Reset() 40 }