Skip to content

Commit

Permalink
Update DataStream naming (#555)
Browse files Browse the repository at this point in the history
* Update DataStream naming

* remove unused import
  • Loading branch information
lukasIO authored Jan 21, 2025
1 parent e96fdca commit aabbd79
Show file tree
Hide file tree
Showing 7 changed files with 380 additions and 168 deletions.
8 changes: 7 additions & 1 deletion livekit-api/src/services/sip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,10 @@ impl SIPClient {
.request(
SVC,
"ListSIPTrunk",
proto::ListSipTrunkRequest {},
proto::ListSipTrunkRequest {
// TODO support these attributes
page: Default::default(),
},
self.base.auth_header(
Default::default(),
Some(SIPGrants { admin: true, ..Default::default() }),
Expand All @@ -279,6 +282,7 @@ impl SIPClient {
"ListSIPInboundTrunk",
proto::ListSipInboundTrunkRequest {
// TODO: support these attributes
page: Default::default(),
trunk_ids: Default::default(),
numbers: Default::default(),
},
Expand All @@ -303,6 +307,7 @@ impl SIPClient {
"ListSIPOutboundTrunk",
proto::ListSipOutboundTrunkRequest {
// TODO: support these attributes
page: Default::default(),
trunk_ids: Default::default(),
numbers: Default::default(),
},
Expand Down Expand Up @@ -373,6 +378,7 @@ impl SIPClient {
"ListSIPDispatchRule",
proto::ListSipDispatchRuleRequest {
// TODO: support these attributes
page: Default::default(),
dispatch_rule_ids: Default::default(),
trunk_ids: Default::default(),
},
Expand Down
12 changes: 6 additions & 6 deletions livekit-ffi/protocol/room.proto
Original file line number Diff line number Diff line change
Expand Up @@ -552,9 +552,9 @@ message DataStream {

}

// header properties specific to file or image streams
message FileHeader {
required string file_name = 1; // name of the file
// header properties specific to byte or file streams
message ByteHeader {
required string name = 1;
}

// main DataStream.Header that contains a oneof for specific headers
Expand All @@ -564,12 +564,12 @@ message DataStream {
required string mime_type = 3;
required string topic = 4;
optional uint64 total_length = 5; // only populated for finite streams, if it's a stream of unknown size this stays empty
map<string, string> extensions = 6; // user defined extensions map that can carry additional info
map<string, string> attributes = 6; // user defined attributes map that can carry additional info

// oneof to choose between specific header types
oneof content_header {
TextHeader text_header = 7;
FileHeader file_header = 8;
ByteHeader byte_header = 8;
}
}

Expand All @@ -584,7 +584,7 @@ message DataStream {
message Trailer {
required string stream_id = 1; // unique identifier for this data stream
required string reason = 2; // reason why the stream was closed (could contain "error" / "interrupted" / empty for expected end)
map<string, string> extensions = 3; // finalizing updates for the stream, can also include additional insights for errors or endTime for transcription
map<string, string> attributes = 3; // finalizing updates for the stream, can also include additional insights for errors or endTime for transcription
}
}

Expand Down
20 changes: 10 additions & 10 deletions livekit-ffi/src/conversion/room.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ impl From<livekit_protocol::data_stream::Header> for proto::data_stream::Header
},
))
}
Some(livekit_protocol::data_stream::header::ContentHeader::FileHeader(file_header)) => {
Some(proto::data_stream::header::ContentHeader::FileHeader(
proto::data_stream::FileHeader { file_name: file_header.file_name },
Some(livekit_protocol::data_stream::header::ContentHeader::ByteHeader(byte_header)) => {
Some(proto::data_stream::header::ContentHeader::ByteHeader(
proto::data_stream::ByteHeader { name: byte_header.name },
))
}
None => None,
Expand All @@ -316,7 +316,7 @@ impl From<livekit_protocol::data_stream::Header> for proto::data_stream::Header
topic: msg.topic,
mime_type: msg.mime_type,
total_length: msg.total_length,
extensions: msg.extensions,
attributes: msg.attributes,
content_header,
}
}
Expand All @@ -336,9 +336,9 @@ impl From<proto::data_stream::Header> for livekit_protocol::data_stream::Header
},
))
}
Some(proto::data_stream::header::ContentHeader::FileHeader(file_header)) => {
Some(livekit_protocol::data_stream::header::ContentHeader::FileHeader(
livekit_protocol::data_stream::FileHeader { file_name: file_header.file_name },
Some(proto::data_stream::header::ContentHeader::ByteHeader(byte_header)) => {
Some(livekit_protocol::data_stream::header::ContentHeader::ByteHeader(
livekit_protocol::data_stream::ByteHeader { name: byte_header.name },
))
}
None => None,
Expand All @@ -350,7 +350,7 @@ impl From<proto::data_stream::Header> for livekit_protocol::data_stream::Header
topic: msg.topic,
mime_type: msg.mime_type,
total_length: msg.total_length,
extensions: msg.extensions,
attributes: msg.attributes,
content_header,
encryption_type: 0,
}
Expand Down Expand Up @@ -383,12 +383,12 @@ impl From<proto::data_stream::Chunk> for livekit_protocol::data_stream::Chunk {

impl From<livekit_protocol::data_stream::Trailer> for proto::data_stream::Trailer {
fn from(msg: livekit_protocol::data_stream::Trailer) -> Self {
Self { stream_id: msg.stream_id, reason: msg.reason, extensions: msg.extensions }
Self { stream_id: msg.stream_id, reason: msg.reason, attributes: msg.attributes }
}
}

impl From<proto::data_stream::Trailer> for livekit_protocol::data_stream::Trailer {
fn from(msg: proto::data_stream::Trailer) -> Self {
Self { stream_id: msg.stream_id, reason: msg.reason, extensions: msg.extensions }
Self { stream_id: msg.stream_id, reason: msg.reason, attributes: msg.attributes }
}
}
18 changes: 10 additions & 8 deletions livekit-ffi/src/livekit.proto.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @generated
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FrameCryptor {
Expand Down Expand Up @@ -2007,6 +2008,8 @@ impl VideoRotation {
}
}
}
/// Values of this enum must not be changed
/// It is used to serialize a rtc.VideoFrame on Python
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
pub enum VideoBufferType {
Expand Down Expand Up @@ -3011,13 +3014,12 @@ pub mod data_stream {
#[prost(bool, optional, tag="5")]
pub generated: ::core::option::Option<bool>,
}
/// header properties specific to file or image streams
/// header properties specific to byte or file streams
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FileHeader {
/// name of the file
pub struct ByteHeader {
#[prost(string, required, tag="1")]
pub file_name: ::prost::alloc::string::String,
pub name: ::prost::alloc::string::String,
}
/// main DataStream.Header that contains a oneof for specific headers
#[allow(clippy::derive_partial_eq_without_eq)]
Expand All @@ -3036,9 +3038,9 @@ pub mod data_stream {
/// only populated for finite streams, if it's a stream of unknown size this stays empty
#[prost(uint64, optional, tag="5")]
pub total_length: ::core::option::Option<u64>,
/// user defined extensions map that can carry additional info
/// user defined attributes map that can carry additional info
#[prost(map="string, string", tag="6")]
pub extensions: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
/// oneof to choose between specific header types
#[prost(oneof="header::ContentHeader", tags="7, 8")]
pub content_header: ::core::option::Option<header::ContentHeader>,
Expand All @@ -3052,7 +3054,7 @@ pub mod data_stream {
#[prost(message, tag="7")]
TextHeader(super::TextHeader),
#[prost(message, tag="8")]
FileHeader(super::FileHeader),
ByteHeader(super::ByteHeader),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -3084,7 +3086,7 @@ pub mod data_stream {
pub reason: ::prost::alloc::string::String,
/// finalizing updates for the stream, can also include additional insights for errors or endTime for transcription
#[prost(map="string, string", tag="3")]
pub extensions: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
/// enum for operation types (specific to TextHeader)
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
Expand Down
32 changes: 24 additions & 8 deletions livekit-protocol/src/livekit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,15 @@ impl MetricLabel {
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Pagination {
/// list entities which IDs are greater
#[prost(string, tag="1")]
pub after_id: ::prost::alloc::string::String,
#[prost(int32, tag="2")]
pub limit: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct Room {
#[prost(string, tag="1")]
pub sid: ::prost::alloc::string::String,
Expand Down Expand Up @@ -1143,13 +1152,12 @@ pub mod data_stream {
#[prost(bool, tag="5")]
pub generated: bool,
}
/// header properties specific to file or image streams
/// header properties specific to byte or file streams
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct FileHeader {
/// name of the file
pub struct ByteHeader {
#[prost(string, tag="1")]
pub file_name: ::prost::alloc::string::String,
pub name: ::prost::alloc::string::String,
}
/// main DataStream.Header that contains a oneof for specific headers
#[allow(clippy::derive_partial_eq_without_eq)]
Expand All @@ -1171,9 +1179,9 @@ pub mod data_stream {
/// defaults to NONE
#[prost(enumeration="super::encryption::Type", tag="7")]
pub encryption_type: i32,
/// user defined extensions map that can carry additional info
/// user defined attributes map that can carry additional info
#[prost(map="string, string", tag="8")]
pub extensions: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
/// oneof to choose between specific header types
#[prost(oneof="header::ContentHeader", tags="9, 10")]
pub content_header: ::core::option::Option<header::ContentHeader>,
Expand All @@ -1187,7 +1195,7 @@ pub mod data_stream {
#[prost(message, tag="9")]
TextHeader(super::TextHeader),
#[prost(message, tag="10")]
FileHeader(super::FileHeader),
ByteHeader(super::ByteHeader),
}
}
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -1219,7 +1227,7 @@ pub mod data_stream {
pub reason: ::prost::alloc::string::String,
/// finalizing updates for the stream, can also include additional insights for errors or endTime for transcription
#[prost(map="string, string", tag="3")]
pub extensions: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
pub attributes: ::std::collections::HashMap<::prost::alloc::string::String, ::prost::alloc::string::String>,
}
/// enum for operation types (specific to TextHeader)
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
Expand Down Expand Up @@ -4785,6 +4793,8 @@ pub struct GetSipOutboundTrunkResponse {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSipTrunkRequest {
#[prost(message, optional, tag="1")]
pub page: ::core::option::Option<Pagination>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand All @@ -4796,6 +4806,8 @@ pub struct ListSipTrunkResponse {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSipInboundTrunkRequest {
#[prost(message, optional, tag="3")]
pub page: ::core::option::Option<Pagination>,
/// Trunk IDs to list. If this option is set, the response will contains trunks in the same order.
/// If any of the trunks is missing, a nil item in that position will be sent in the response.
#[prost(string, repeated, tag="1")]
Expand All @@ -4814,6 +4826,8 @@ pub struct ListSipInboundTrunkResponse {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSipOutboundTrunkRequest {
#[prost(message, optional, tag="3")]
pub page: ::core::option::Option<Pagination>,
/// Trunk IDs to list. If this option is set, the response will contains trunks in the same order.
/// If any of the trunks is missing, a nil item in that position will be sent in the response.
#[prost(string, repeated, tag="1")]
Expand Down Expand Up @@ -4966,6 +4980,8 @@ pub struct SipDispatchRuleInfo {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListSipDispatchRuleRequest {
#[prost(message, optional, tag="3")]
pub page: ::core::option::Option<Pagination>,
/// Rule IDs to list. If this option is set, the response will contains rules in the same order.
/// If any of the rules is missing, a nil item in that position will be sent in the response.
#[prost(string, repeated, tag="1")]
Expand Down
Loading

0 comments on commit aabbd79

Please sign in to comment.