update protocol (#2760)

* update protocol

* deps
This commit is contained in:
Paul Wells
2024-06-05 19:46:34 -07:00
committed by GitHub
parent d3f9e8b8e5
commit f1886ece42
22 changed files with 53 additions and 38 deletions
+2 -1
View File
@@ -24,6 +24,7 @@ import (
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/rpc"
"github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
)
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
@@ -73,7 +74,7 @@ func (s *egressLauncher) StartEgressWithClusterId(ctx context.Context, clusterId
// Ensure we have an Egress ID
if req.EgressId == "" {
req.EgressId = utils.NewGuid(utils.EgressPrefix)
req.EgressId = guid.New(utils.EgressPrefix)
}
return s.client.StartEgress(ctx, clusterId, req)
+3 -2
View File
@@ -26,6 +26,7 @@ import (
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/rpc"
"github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/psrpc"
)
@@ -145,11 +146,11 @@ func (s *IngressService) CreateIngressWithUrl(ctx context.Context, urlStr string
var sk string
if req.InputType != livekit.IngressInput_URL_INPUT {
sk = utils.NewGuid("")
sk = guid.New("")
}
info := &livekit.IngressInfo{
IngressId: utils.NewGuid(utils.IngressPrefix),
IngressId: guid.New(utils.IngressPrefix),
Name: req.Name,
StreamKey: sk,
Url: urlStr,
+2 -2
View File
@@ -29,7 +29,7 @@ import (
"github.com/livekit/protocol/ingress"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/livekit-server/version"
)
@@ -240,7 +240,7 @@ func (s *RedisStore) DeleteRoom(ctx context.Context, roomName livekit.RoomName)
}
func (s *RedisStore) LockRoom(_ context.Context, roomName livekit.RoomName, duration time.Duration) (string, error) {
token := utils.NewGuid("LOCK")
token := guid.New("LOCK")
key := RoomLockPrefix + string(roomName)
startTime := time.Now()
+5 -4
View File
@@ -26,6 +26,7 @@ import (
"github.com/livekit/protocol/ingress"
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/livekit-server/pkg/service"
)
@@ -164,8 +165,8 @@ func TestEgressStore(t *testing.T) {
// store egress info
info := &livekit.EgressInfo{
EgressId: utils.NewGuid(utils.EgressPrefix),
RoomId: utils.NewGuid(utils.RoomPrefix),
EgressId: guid.New(utils.EgressPrefix),
RoomId: guid.New(utils.RoomPrefix),
RoomName: roomName,
Status: livekit.EgressStatus_EGRESS_STARTING,
Request: &livekit.EgressInfo_RoomComposite{
@@ -184,8 +185,8 @@ func TestEgressStore(t *testing.T) {
// store another
info2 := &livekit.EgressInfo{
EgressId: utils.NewGuid(utils.EgressPrefix),
RoomId: utils.NewGuid(utils.RoomPrefix),
EgressId: guid.New(utils.EgressPrefix),
RoomId: guid.New(utils.RoomPrefix),
RoomName: "another-egress-test",
Status: livekit.EgressStatus_EGRESS_STARTING,
Request: &livekit.EgressInfo_RoomComposite{
+2 -1
View File
@@ -22,6 +22,7 @@ import (
"github.com/livekit/protocol/livekit"
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/livekit-server/pkg/config"
"github.com/livekit/livekit-server/pkg/routing"
@@ -66,7 +67,7 @@ func (r *StandardRoomAllocator) CreateRoom(ctx context.Context, req *livekit.Cre
if errors.Is(err, ErrRoomNotFound) {
created = true
rm = &livekit.Room{
Sid: utils.NewGuid(utils.RoomPrefix),
Sid: guid.New(utils.RoomPrefix),
Name: req.Name,
CreationTime: time.Now().Unix(),
TurnPassword: utils.RandomSecret(),
+2 -1
View File
@@ -33,6 +33,7 @@ import (
"github.com/livekit/protocol/logger"
"github.com/livekit/protocol/rpc"
"github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/protocol/utils/must"
"github.com/livekit/psrpc"
@@ -378,7 +379,7 @@ func (r *RoomManager) StartSession(
pv := types.ProtocolVersion(pi.Client.Protocol)
rtcConf := *r.rtcConfig
rtcConf.SetBufferFactory(room.GetBufferFactory())
sid := livekit.ParticipantID(utils.NewGuid(utils.ParticipantPrefix))
sid := livekit.ParticipantID(guid.New(utils.ParticipantPrefix))
pLogger := rtc.LoggerWithParticipant(
rtc.LoggerWithRoom(logger.GetLogger(), room.Name(), room.ID()),
pi.Identity,
+3 -2
View File
@@ -24,6 +24,7 @@ import (
"github.com/livekit/protocol/rpc"
"github.com/livekit/protocol/sip"
"github.com/livekit/protocol/utils"
"github.com/livekit/protocol/utils/guid"
"github.com/livekit/psrpc"
"github.com/livekit/livekit-server/pkg/config"
@@ -91,7 +92,7 @@ func (s *SIPService) CreateSIPTrunk(ctx context.Context, req *livekit.CreateSIPT
}
// Now we can generate ID and store.
info.SipTrunkId = utils.NewGuid(utils.SIPTrunkPrefix)
info.SipTrunkId = guid.New(utils.SIPTrunkPrefix)
if err := s.store.StoreSIPTrunk(ctx, info); err != nil {
return nil, err
}
@@ -153,7 +154,7 @@ func (s *SIPService) CreateSIPDispatchRule(ctx context.Context, req *livekit.Cre
}
// Now we can generate ID and store.
info.SipDispatchRuleId = utils.NewGuid(utils.SIPDispatchRulePrefix)
info.SipDispatchRuleId = guid.New(utils.SIPDispatchRulePrefix)
if err := s.store.StoreSIPDispatchRule(ctx, info); err != nil {
return nil, err
}