Egress (#455)
* egress updates * pass egressInfo to delete * update typefakes * export StartEgress * update protocol * new rpc, rename stores * add json tag * update tests * update protocol
This commit is contained in:
+1
@@ -2,5 +2,6 @@
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="GoCommentStart" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="GoNameStartsWithPackageName" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
||||
@@ -14,7 +14,7 @@ require (
|
||||
github.com/google/wire v0.5.0
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/hashicorp/golang-lru v0.5.4
|
||||
github.com/livekit/protocol v0.11.14-0.20220223000017-946db440fa31
|
||||
github.com/livekit/protocol v0.11.14-0.20220223230744-2d72f8bc52aa
|
||||
github.com/magefile/mage v1.11.0
|
||||
github.com/maxbrunsfeld/counterfeiter/v6 v6.3.0
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
|
||||
@@ -132,8 +132,8 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/lithammer/shortuuid/v3 v3.0.6 h1:pr15YQyvhiSX/qPxncFtqk+v4xLEpOZObbsY/mKrcvA=
|
||||
github.com/lithammer/shortuuid/v3 v3.0.6/go.mod h1:vMk8ke37EmiewwolSO1NLW8vP4ZaKlRuDIi8tWWmAts=
|
||||
github.com/livekit/protocol v0.11.14-0.20220223000017-946db440fa31 h1:hKxQgugr7nDA28kY+XEKELL/c4fD5kaoUHkTSPQyXwQ=
|
||||
github.com/livekit/protocol v0.11.14-0.20220223000017-946db440fa31/go.mod h1:3pHsWUtQmWaH8mG0cXrQWpbf3Vo+kj0U+In77CEXu90=
|
||||
github.com/livekit/protocol v0.11.14-0.20220223230744-2d72f8bc52aa h1:3eJ92nyh9krLpbkz2TB4Dtc4oDLO86sznNxQR2sb614=
|
||||
github.com/livekit/protocol v0.11.14-0.20220223230744-2d72f8bc52aa/go.mod h1:3pHsWUtQmWaH8mG0cXrQWpbf3Vo+kj0U+In77CEXu90=
|
||||
github.com/magefile/mage v1.11.0 h1:C/55Ywp9BpgVVclD3lRnSYCwXTYxmSppIgLeDYlNuls=
|
||||
github.com/magefile/mage v1.11.0/go.mod h1:z5UZb/iS3GoOSn0JgWuiw7dxlurVYTu+/jHXqQg881A=
|
||||
github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0=
|
||||
|
||||
@@ -0,0 +1,259 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
|
||||
"github.com/livekit/protocol/egress"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/logger"
|
||||
"github.com/livekit/protocol/recording"
|
||||
"github.com/livekit/protocol/utils"
|
||||
"google.golang.org/protobuf/proto"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/telemetry"
|
||||
)
|
||||
|
||||
type EgressService struct {
|
||||
bus utils.MessageBus
|
||||
store EgressStore
|
||||
roomService livekit.RoomService
|
||||
telemetry telemetry.TelemetryService
|
||||
shutdown chan struct{}
|
||||
}
|
||||
|
||||
func NewEgressService(bus utils.MessageBus, es EgressStore, rs livekit.RoomService, ts telemetry.TelemetryService) *EgressService {
|
||||
return &EgressService{
|
||||
bus: bus,
|
||||
store: es,
|
||||
roomService: rs,
|
||||
telemetry: ts,
|
||||
shutdown: make(chan struct{}),
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EgressService) Start() {
|
||||
if s.bus != nil {
|
||||
go s.resultsWorker()
|
||||
}
|
||||
}
|
||||
|
||||
func (s *EgressService) Stop() {
|
||||
close(s.shutdown)
|
||||
}
|
||||
|
||||
func (s *EgressService) StartWebCompositeEgress(ctx context.Context, req *livekit.WebCompositeEgressRequest) (*livekit.EgressInfo, error) {
|
||||
return s.StartEgress(ctx, livekit.RoomName(req.RoomName), &livekit.StartEgressRequest{
|
||||
Request: &livekit.StartEgressRequest_WebComposite{
|
||||
WebComposite: req,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (s *EgressService) StartTrackCompositeEgress(ctx context.Context, req *livekit.TrackCompositeEgressRequest) (*livekit.EgressInfo, error) {
|
||||
return s.StartEgress(ctx, livekit.RoomName(req.RoomName), &livekit.StartEgressRequest{
|
||||
Request: &livekit.StartEgressRequest_TrackComposite{
|
||||
TrackComposite: req,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (s *EgressService) StartTrackEgress(ctx context.Context, req *livekit.TrackEgressRequest) (*livekit.EgressInfo, error) {
|
||||
return s.StartEgress(ctx, livekit.RoomName(req.RoomName), &livekit.StartEgressRequest{
|
||||
Request: &livekit.StartEgressRequest_Track{
|
||||
Track: req,
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
func (s *EgressService) StartEgress(ctx context.Context, roomName livekit.RoomName, req *livekit.StartEgressRequest) (*livekit.EgressInfo, error) {
|
||||
if err := EnsureRecordPermission(ctx); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
if s.bus == nil {
|
||||
return nil, errors.New("egress not connected (redis required)")
|
||||
}
|
||||
|
||||
room, err := s.store.LoadRoom(ctx, roomName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
req.RoomId = room.Sid
|
||||
|
||||
info, err := egress.SendRequest(ctx, s.bus, req)
|
||||
if err != nil {
|
||||
s.telemetry.EgressStarted(ctx, info)
|
||||
go func() {
|
||||
if err := s.store.StoreEgress(ctx, info); err != nil {
|
||||
logger.Errorw("could not write egress info", err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
return info, nil
|
||||
}
|
||||
|
||||
type LayoutMetadata struct {
|
||||
Layout string `json:"layout"`
|
||||
}
|
||||
|
||||
func (s *EgressService) UpdateLayout(ctx context.Context, req *livekit.UpdateLayoutRequest) (*livekit.EgressInfo, error) {
|
||||
if err := EnsureRecordPermission(ctx); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
if s.bus == nil {
|
||||
return nil, errors.New("egress not connected (redis required)")
|
||||
}
|
||||
|
||||
info, err := s.store.LoadEgress(ctx, req.EgressId)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var roomName string
|
||||
switch r := info.Request.(type) {
|
||||
case *livekit.EgressInfo_WebComposite:
|
||||
roomName = r.WebComposite.RoomName
|
||||
case *livekit.EgressInfo_TrackComposite:
|
||||
roomName = r.TrackComposite.RoomName
|
||||
case *livekit.EgressInfo_Track:
|
||||
roomName = r.Track.RoomName
|
||||
default:
|
||||
return nil, ErrRoomNotFound
|
||||
}
|
||||
|
||||
metadata, err := json.Marshal(&LayoutMetadata{Layout: req.Layout})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
_, err = s.roomService.UpdateParticipant(ctx, &livekit.UpdateParticipantRequest{
|
||||
Room: roomName,
|
||||
Identity: info.EgressId,
|
||||
Metadata: string(metadata),
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return info, nil
|
||||
}
|
||||
|
||||
func (s *EgressService) UpdateStream(ctx context.Context, req *livekit.UpdateStreamRequest) (*livekit.EgressInfo, error) {
|
||||
if err := EnsureRecordPermission(ctx); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
if s.bus == nil {
|
||||
return nil, errors.New("egress not connected (redis required)")
|
||||
}
|
||||
|
||||
info, err := egress.SendRequest(ctx, s.bus, &livekit.EgressRequest{
|
||||
EgressId: req.EgressId,
|
||||
Request: &livekit.EgressRequest_UpdateStream{
|
||||
UpdateStream: req,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
go func() {
|
||||
if err := s.store.UpdateEgress(ctx, info); err != nil {
|
||||
logger.Errorw("could not write egress info", err)
|
||||
}
|
||||
}()
|
||||
|
||||
return info, nil
|
||||
}
|
||||
|
||||
func (s *EgressService) ListEgress(ctx context.Context, req *livekit.ListEgressRequest) (*livekit.ListEgressResponse, error) {
|
||||
if err := EnsureRecordPermission(ctx); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
if s.bus == nil {
|
||||
return nil, errors.New("egress not connected (redis required)")
|
||||
}
|
||||
|
||||
var roomID livekit.RoomID
|
||||
if req.RoomName != "" {
|
||||
room, err := s.store.LoadRoom(ctx, livekit.RoomName(req.RoomName))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
roomID = livekit.RoomID(room.Sid)
|
||||
}
|
||||
|
||||
infos, err := s.store.ListEgress(ctx, roomID)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &livekit.ListEgressResponse{Items: infos}, nil
|
||||
}
|
||||
|
||||
func (s *EgressService) StopEgress(ctx context.Context, req *livekit.StopEgressRequest) (*livekit.EgressInfo, error) {
|
||||
if err := EnsureRecordPermission(ctx); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
if s.bus == nil {
|
||||
return nil, errors.New("recording not configured (redis required)")
|
||||
}
|
||||
|
||||
info, err := egress.SendRequest(ctx, s.bus, &livekit.EgressRequest{
|
||||
EgressId: req.EgressId,
|
||||
Request: &livekit.EgressRequest_Stop{
|
||||
Stop: req,
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
go func() {
|
||||
if err := s.store.UpdateEgress(ctx, info); err != nil {
|
||||
logger.Errorw("could not write egress info", err)
|
||||
}
|
||||
}()
|
||||
|
||||
return info, nil
|
||||
}
|
||||
|
||||
func (s *EgressService) resultsWorker() {
|
||||
sub, err := s.bus.SubscribeQueue(context.Background(), recording.ResultChannel)
|
||||
if err != nil {
|
||||
logger.Errorw("failed to subscribe to results channel", err)
|
||||
return
|
||||
}
|
||||
|
||||
resChan := sub.Channel()
|
||||
for {
|
||||
select {
|
||||
case msg := <-resChan:
|
||||
b := sub.Payload(msg)
|
||||
|
||||
res := &livekit.EgressInfo{}
|
||||
if err = proto.Unmarshal(b, res); err != nil {
|
||||
logger.Errorw("failed to read results", err)
|
||||
continue
|
||||
}
|
||||
|
||||
err = s.store.DeleteEgress(context.Background(), res)
|
||||
if err != nil {
|
||||
logger.Errorw("could not delete egress from store", err)
|
||||
}
|
||||
|
||||
// log results
|
||||
if res.Error != "" {
|
||||
logger.Errorw("egress failed", errors.New(res.Error), "egressID", res.EgressId)
|
||||
} else {
|
||||
logger.Debugw("egress ended", "egressID", res.EgressId)
|
||||
}
|
||||
|
||||
s.telemetry.EgressEnded(context.Background(), res)
|
||||
case <-s.shutdown:
|
||||
_ = sub.Close()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package service
|
||||
import "errors"
|
||||
|
||||
var (
|
||||
ErrEgressNotFound = errors.New("egress does not exist")
|
||||
ErrRoomNotFound = errors.New("requested room does not exist")
|
||||
ErrRoomLockFailed = errors.New("could not lock room")
|
||||
ErrRoomUnlockFailed = errors.New("could not unlock room, lock token does not match")
|
||||
|
||||
@@ -10,9 +10,10 @@ import (
|
||||
//go:generate go run github.com/maxbrunsfeld/counterfeiter/v6 -generate
|
||||
|
||||
// encapsulates CRUD operations for room settings
|
||||
//counterfeiter:generate . RoomStore
|
||||
type RoomStore interface {
|
||||
RORoomStore
|
||||
//counterfeiter:generate . ObjectStore
|
||||
type ObjectStore interface {
|
||||
ServiceStore
|
||||
EgressStore
|
||||
|
||||
// enable locking on a specific room to prevent race
|
||||
// returns a (lock uuid, error)
|
||||
@@ -26,8 +27,8 @@ type RoomStore interface {
|
||||
DeleteParticipant(ctx context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) error
|
||||
}
|
||||
|
||||
//counterfeiter:generate . RORoomStore
|
||||
type RORoomStore interface {
|
||||
//counterfeiter:generate . ServiceStore
|
||||
type ServiceStore interface {
|
||||
LoadRoom(ctx context.Context, name livekit.RoomName) (*livekit.Room, error)
|
||||
// ListRooms returns currently active rooms. if names is not nil, it'll filter and return
|
||||
// only rooms that match
|
||||
@@ -37,6 +38,17 @@ type RORoomStore interface {
|
||||
ListParticipants(ctx context.Context, roomName livekit.RoomName) ([]*livekit.ParticipantInfo, error)
|
||||
}
|
||||
|
||||
//counterfeiter:generate . EgressStore
|
||||
type EgressStore interface {
|
||||
LoadRoom(ctx context.Context, name livekit.RoomName) (*livekit.Room, error)
|
||||
|
||||
StoreEgress(ctx context.Context, info *livekit.EgressInfo) error
|
||||
LoadEgress(ctx context.Context, egressID string) (*livekit.EgressInfo, error)
|
||||
ListEgress(ctx context.Context, roomID livekit.RoomID) ([]*livekit.EgressInfo, error)
|
||||
UpdateEgress(ctx context.Context, info *livekit.EgressInfo) error
|
||||
DeleteEgress(ctx context.Context, info *livekit.EgressInfo) error
|
||||
}
|
||||
|
||||
//counterfeiter:generate . RoomAllocator
|
||||
type RoomAllocator interface {
|
||||
CreateRoom(ctx context.Context, req *livekit.CreateRoomRequest) (*livekit.Room, error)
|
||||
|
||||
@@ -1,144 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/thoas/go-funk"
|
||||
)
|
||||
|
||||
// encapsulates CRUD operations for room settings
|
||||
type LocalRoomStore struct {
|
||||
// map of roomName => room
|
||||
rooms map[livekit.RoomName]*livekit.Room
|
||||
// map of roomName => { identity: participant }
|
||||
participants map[livekit.RoomName]map[livekit.ParticipantIdentity]*livekit.ParticipantInfo
|
||||
lock sync.RWMutex
|
||||
globalLock sync.Mutex
|
||||
}
|
||||
|
||||
func NewLocalRoomStore() *LocalRoomStore {
|
||||
return &LocalRoomStore{
|
||||
rooms: make(map[livekit.RoomName]*livekit.Room),
|
||||
participants: make(map[livekit.RoomName]map[livekit.ParticipantIdentity]*livekit.ParticipantInfo),
|
||||
lock: sync.RWMutex{},
|
||||
}
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) StoreRoom(_ context.Context, room *livekit.Room) error {
|
||||
if room.CreationTime == 0 {
|
||||
room.CreationTime = time.Now().Unix()
|
||||
}
|
||||
p.lock.Lock()
|
||||
p.rooms[livekit.RoomName(room.Name)] = room
|
||||
p.lock.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) LoadRoom(_ context.Context, name livekit.RoomName) (*livekit.Room, error) {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
|
||||
room := p.rooms[name]
|
||||
if room == nil {
|
||||
return nil, ErrRoomNotFound
|
||||
}
|
||||
return room, nil
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) ListRooms(_ context.Context, names []livekit.RoomName) ([]*livekit.Room, error) {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
rooms := make([]*livekit.Room, 0, len(p.rooms))
|
||||
for _, r := range p.rooms {
|
||||
if names == nil || funk.Contains(names, livekit.RoomName(r.Name)) {
|
||||
rooms = append(rooms, r)
|
||||
}
|
||||
}
|
||||
return rooms, nil
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) DeleteRoom(ctx context.Context, name livekit.RoomName) error {
|
||||
room, err := p.LoadRoom(ctx, name)
|
||||
if err == ErrRoomNotFound {
|
||||
return nil
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
p.lock.Lock()
|
||||
defer p.lock.Unlock()
|
||||
|
||||
delete(p.participants, livekit.RoomName(room.Name))
|
||||
delete(p.rooms, livekit.RoomName(room.Name))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) LockRoom(_ context.Context, _ livekit.RoomName, _ time.Duration) (string, error) {
|
||||
// local rooms lock & unlock globally
|
||||
p.globalLock.Lock()
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) UnlockRoom(_ context.Context, _ livekit.RoomName, _ string) error {
|
||||
p.globalLock.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) StoreParticipant(_ context.Context, roomName livekit.RoomName, participant *livekit.ParticipantInfo) error {
|
||||
p.lock.Lock()
|
||||
defer p.lock.Unlock()
|
||||
roomParticipants := p.participants[roomName]
|
||||
if roomParticipants == nil {
|
||||
roomParticipants = make(map[livekit.ParticipantIdentity]*livekit.ParticipantInfo)
|
||||
p.participants[roomName] = roomParticipants
|
||||
}
|
||||
roomParticipants[livekit.ParticipantIdentity(participant.Identity)] = participant
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) LoadParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
|
||||
roomParticipants := p.participants[roomName]
|
||||
if roomParticipants == nil {
|
||||
return nil, ErrParticipantNotFound
|
||||
}
|
||||
participant := roomParticipants[identity]
|
||||
if participant == nil {
|
||||
return nil, ErrParticipantNotFound
|
||||
}
|
||||
return participant, nil
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) ListParticipants(_ context.Context, roomName livekit.RoomName) ([]*livekit.ParticipantInfo, error) {
|
||||
p.lock.RLock()
|
||||
defer p.lock.RUnlock()
|
||||
|
||||
roomParticipants := p.participants[roomName]
|
||||
if roomParticipants == nil {
|
||||
// empty array
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
items := make([]*livekit.ParticipantInfo, 0, len(roomParticipants))
|
||||
for _, p := range roomParticipants {
|
||||
items = append(items, p)
|
||||
}
|
||||
|
||||
return items, nil
|
||||
}
|
||||
|
||||
func (p *LocalRoomStore) DeleteParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) error {
|
||||
p.lock.Lock()
|
||||
defer p.lock.Unlock()
|
||||
|
||||
roomParticipants := p.participants[roomName]
|
||||
if roomParticipants != nil {
|
||||
delete(roomParticipants, identity)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/thoas/go-funk"
|
||||
)
|
||||
|
||||
// encapsulates CRUD operations for room settings
|
||||
type LocalStore struct {
|
||||
// map of roomName => room
|
||||
rooms map[livekit.RoomName]*livekit.Room
|
||||
// map of roomName => { identity: participant }
|
||||
participants map[livekit.RoomName]map[livekit.ParticipantIdentity]*livekit.ParticipantInfo
|
||||
|
||||
lock sync.RWMutex
|
||||
globalLock sync.Mutex
|
||||
}
|
||||
|
||||
func NewLocalStore() *LocalStore {
|
||||
return &LocalStore{
|
||||
rooms: make(map[livekit.RoomName]*livekit.Room),
|
||||
participants: make(map[livekit.RoomName]map[livekit.ParticipantIdentity]*livekit.ParticipantInfo),
|
||||
lock: sync.RWMutex{},
|
||||
}
|
||||
}
|
||||
|
||||
func (s *LocalStore) StoreRoom(_ context.Context, room *livekit.Room) error {
|
||||
if room.CreationTime == 0 {
|
||||
room.CreationTime = time.Now().Unix()
|
||||
}
|
||||
s.lock.Lock()
|
||||
s.rooms[livekit.RoomName(room.Name)] = room
|
||||
s.lock.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) LoadRoom(_ context.Context, name livekit.RoomName) (*livekit.Room, error) {
|
||||
s.lock.RLock()
|
||||
defer s.lock.RUnlock()
|
||||
|
||||
room := s.rooms[name]
|
||||
if room == nil {
|
||||
return nil, ErrRoomNotFound
|
||||
}
|
||||
return room, nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) ListRooms(_ context.Context, names []livekit.RoomName) ([]*livekit.Room, error) {
|
||||
s.lock.RLock()
|
||||
defer s.lock.RUnlock()
|
||||
rooms := make([]*livekit.Room, 0, len(s.rooms))
|
||||
for _, r := range s.rooms {
|
||||
if names == nil || funk.Contains(names, livekit.RoomName(r.Name)) {
|
||||
rooms = append(rooms, r)
|
||||
}
|
||||
}
|
||||
return rooms, nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) DeleteRoom(ctx context.Context, name livekit.RoomName) error {
|
||||
room, err := s.LoadRoom(ctx, name)
|
||||
if err == ErrRoomNotFound {
|
||||
return nil
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
|
||||
delete(s.participants, livekit.RoomName(room.Name))
|
||||
delete(s.rooms, livekit.RoomName(room.Name))
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) LockRoom(_ context.Context, _ livekit.RoomName, _ time.Duration) (string, error) {
|
||||
// local rooms lock & unlock globally
|
||||
s.globalLock.Lock()
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) UnlockRoom(_ context.Context, _ livekit.RoomName, _ string) error {
|
||||
s.globalLock.Unlock()
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) StoreParticipant(_ context.Context, roomName livekit.RoomName, participant *livekit.ParticipantInfo) error {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
roomParticipants := s.participants[roomName]
|
||||
if roomParticipants == nil {
|
||||
roomParticipants = make(map[livekit.ParticipantIdentity]*livekit.ParticipantInfo)
|
||||
s.participants[roomName] = roomParticipants
|
||||
}
|
||||
roomParticipants[livekit.ParticipantIdentity(participant.Identity)] = participant
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) LoadParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
|
||||
s.lock.RLock()
|
||||
defer s.lock.RUnlock()
|
||||
|
||||
roomParticipants := s.participants[roomName]
|
||||
if roomParticipants == nil {
|
||||
return nil, ErrParticipantNotFound
|
||||
}
|
||||
participant := roomParticipants[identity]
|
||||
if participant == nil {
|
||||
return nil, ErrParticipantNotFound
|
||||
}
|
||||
return participant, nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) ListParticipants(_ context.Context, roomName livekit.RoomName) ([]*livekit.ParticipantInfo, error) {
|
||||
s.lock.RLock()
|
||||
defer s.lock.RUnlock()
|
||||
|
||||
roomParticipants := s.participants[roomName]
|
||||
if roomParticipants == nil {
|
||||
// empty array
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
items := make([]*livekit.ParticipantInfo, 0, len(roomParticipants))
|
||||
for _, p := range roomParticipants {
|
||||
items = append(items, p)
|
||||
}
|
||||
|
||||
return items, nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) DeleteParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) error {
|
||||
s.lock.Lock()
|
||||
defer s.lock.Unlock()
|
||||
|
||||
roomParticipants := s.participants[roomName]
|
||||
if roomParticipants != nil {
|
||||
delete(roomParticipants, identity)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) StoreEgress(_ context.Context, _ *livekit.EgressInfo) error {
|
||||
// redis is required for egress
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) LoadEgress(_ context.Context, _ string) (*livekit.EgressInfo, error) {
|
||||
// redis is required for egress
|
||||
return nil, ErrEgressNotFound
|
||||
}
|
||||
|
||||
func (s *LocalStore) ListEgress(_ context.Context, _ livekit.RoomID) ([]*livekit.EgressInfo, error) {
|
||||
// redis is required for egress
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) UpdateEgress(_ context.Context, _ *livekit.EgressInfo) error {
|
||||
// redis is required for egress
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *LocalStore) DeleteEgress(_ context.Context, _ *livekit.EgressInfo) error {
|
||||
// redis is required for egress
|
||||
return nil
|
||||
}
|
||||
@@ -38,6 +38,7 @@ func (s *RecordingService) Stop() {
|
||||
s.shutdown <- struct{}{}
|
||||
}
|
||||
|
||||
// RecordingService is deprecated, use EgressService instead
|
||||
func (s *RecordingService) StartRecording(ctx context.Context, req *livekit.StartRecordingRequest) (*livekit.StartRecordingResponse, error) {
|
||||
if err := EnsureRecordPermission(ctx); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
@@ -78,6 +79,7 @@ func (s *RecordingService) StartRecording(ctx context.Context, req *livekit.Star
|
||||
return &livekit.StartRecordingResponse{RecordingId: recordingID}, nil
|
||||
}
|
||||
|
||||
// RecordingService is deprecated, use EgressService instead
|
||||
func (s *RecordingService) AddOutput(ctx context.Context, req *livekit.AddOutputRequest) (*emptypb.Empty, error) {
|
||||
if err := EnsureRecordPermission(ctx); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
@@ -98,6 +100,7 @@ func (s *RecordingService) AddOutput(ctx context.Context, req *livekit.AddOutput
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
// RecordingService is deprecated, use EgressService instead
|
||||
func (s *RecordingService) RemoveOutput(ctx context.Context, req *livekit.RemoveOutputRequest) (*emptypb.Empty, error) {
|
||||
if err := EnsureRecordPermission(ctx); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
@@ -118,6 +121,7 @@ func (s *RecordingService) RemoveOutput(ctx context.Context, req *livekit.Remove
|
||||
return &emptypb.Empty{}, nil
|
||||
}
|
||||
|
||||
// RecordingService is deprecated, use EgressService instead
|
||||
func (s *RecordingService) EndRecording(ctx context.Context, req *livekit.EndRecordingRequest) (*emptypb.Empty, error) {
|
||||
if err := EnsureRecordPermission(ctx); err != nil {
|
||||
return nil, twirpAuthError(err)
|
||||
|
||||
@@ -1,216 +0,0 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/utils"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
// RoomsKey is hash of room_name => Room proto
|
||||
RoomsKey = "rooms"
|
||||
|
||||
// RoomParticipantsPrefix is hash of participant_name => ParticipantInfo
|
||||
RoomParticipantsPrefix = "room_participants:"
|
||||
|
||||
// RoomLockPrefix is a simple key containing a provided lock uid
|
||||
RoomLockPrefix = "room_lock:"
|
||||
)
|
||||
|
||||
type RedisRoomStore struct {
|
||||
rc *redis.Client
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func NewRedisRoomStore(rc *redis.Client) *RedisRoomStore {
|
||||
return &RedisRoomStore{
|
||||
ctx: context.Background(),
|
||||
rc: rc,
|
||||
}
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) StoreRoom(_ context.Context, room *livekit.Room) error {
|
||||
if room.CreationTime == 0 {
|
||||
room.CreationTime = time.Now().Unix()
|
||||
}
|
||||
|
||||
data, err := proto.Marshal(room)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pp := p.rc.Pipeline()
|
||||
pp.HSet(p.ctx, RoomsKey, room.Name, data)
|
||||
|
||||
if _, err = pp.Exec(p.ctx); err != nil {
|
||||
return errors.Wrap(err, "could not create room")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) LoadRoom(_ context.Context, name livekit.RoomName) (*livekit.Room, error) {
|
||||
data, err := p.rc.HGet(p.ctx, RoomsKey, string(name)).Result()
|
||||
if err != nil {
|
||||
if err == redis.Nil {
|
||||
err = ErrRoomNotFound
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
room := livekit.Room{}
|
||||
err = proto.Unmarshal([]byte(data), &room)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &room, nil
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) ListRooms(_ context.Context, names []livekit.RoomName) ([]*livekit.Room, error) {
|
||||
var items []string
|
||||
var err error
|
||||
if names == nil {
|
||||
items, err = p.rc.HVals(p.ctx, RoomsKey).Result()
|
||||
if err != nil && err != redis.Nil {
|
||||
return nil, errors.Wrap(err, "could not get rooms")
|
||||
}
|
||||
} else {
|
||||
roomNames := livekit.RoomNamesAsStrings(names)
|
||||
var results []interface{}
|
||||
results, err = p.rc.HMGet(p.ctx, RoomsKey, roomNames...).Result()
|
||||
if err != nil && err != redis.Nil {
|
||||
return nil, errors.Wrap(err, "could not get rooms by names")
|
||||
}
|
||||
for _, r := range results {
|
||||
if item, ok := r.(string); ok {
|
||||
items = append(items, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rooms := make([]*livekit.Room, 0, len(items))
|
||||
|
||||
for _, item := range items {
|
||||
room := livekit.Room{}
|
||||
err := proto.Unmarshal([]byte(item), &room)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rooms = append(rooms, &room)
|
||||
}
|
||||
return rooms, nil
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) DeleteRoom(ctx context.Context, name livekit.RoomName) error {
|
||||
_, err := p.LoadRoom(ctx, name)
|
||||
if err == ErrRoomNotFound {
|
||||
return nil
|
||||
}
|
||||
|
||||
pp := p.rc.Pipeline()
|
||||
pp.HDel(p.ctx, RoomsKey, string(name))
|
||||
pp.Del(p.ctx, RoomParticipantsPrefix+string(name))
|
||||
|
||||
_, err = pp.Exec(p.ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) LockRoom(_ context.Context, name livekit.RoomName, duration time.Duration) (string, error) {
|
||||
token := utils.NewGuid("LOCK")
|
||||
key := RoomLockPrefix + string(name)
|
||||
|
||||
startTime := time.Now()
|
||||
for {
|
||||
locked, err := p.rc.SetNX(p.ctx, key, token, duration).Result()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if locked {
|
||||
return token, nil
|
||||
}
|
||||
|
||||
// stop waiting past lock duration
|
||||
if time.Now().Sub(startTime) > duration {
|
||||
break
|
||||
}
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
return "", ErrRoomLockFailed
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) UnlockRoom(_ context.Context, name livekit.RoomName, uid string) error {
|
||||
key := RoomLockPrefix + string(name)
|
||||
|
||||
val, err := p.rc.Get(p.ctx, key).Result()
|
||||
if err == redis.Nil {
|
||||
// already unlocked
|
||||
return nil
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if val != uid {
|
||||
return ErrRoomUnlockFailed
|
||||
}
|
||||
return p.rc.Del(p.ctx, key).Err()
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) StoreParticipant(_ context.Context, roomName livekit.RoomName, participant *livekit.ParticipantInfo) error {
|
||||
key := RoomParticipantsPrefix + string(roomName)
|
||||
|
||||
data, err := proto.Marshal(participant)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return p.rc.HSet(p.ctx, key, participant.Identity, data).Err()
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) LoadParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
|
||||
key := RoomParticipantsPrefix + string(roomName)
|
||||
data, err := p.rc.HGet(p.ctx, key, string(identity)).Result()
|
||||
if err == redis.Nil {
|
||||
return nil, ErrParticipantNotFound
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pi := livekit.ParticipantInfo{}
|
||||
if err := proto.Unmarshal([]byte(data), &pi); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pi, nil
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) ListParticipants(_ context.Context, roomName livekit.RoomName) ([]*livekit.ParticipantInfo, error) {
|
||||
key := RoomParticipantsPrefix + string(roomName)
|
||||
items, err := p.rc.HVals(p.ctx, key).Result()
|
||||
if err == redis.Nil {
|
||||
return nil, nil
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
participants := make([]*livekit.ParticipantInfo, 0, len(items))
|
||||
for _, item := range items {
|
||||
pi := livekit.ParticipantInfo{}
|
||||
if err := proto.Unmarshal([]byte(item), &pi); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
participants = append(participants, &pi)
|
||||
}
|
||||
return participants, nil
|
||||
}
|
||||
|
||||
func (p *RedisRoomStore) DeleteParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) error {
|
||||
key := RoomParticipantsPrefix + string(roomName)
|
||||
|
||||
return p.rc.HDel(p.ctx, key, string(identity)).Err()
|
||||
}
|
||||
@@ -0,0 +1,325 @@
|
||||
package service
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
"github.com/livekit/protocol/utils"
|
||||
"github.com/pkg/errors"
|
||||
"google.golang.org/protobuf/proto"
|
||||
)
|
||||
|
||||
const (
|
||||
// RoomsKey is hash of room_name => Room proto
|
||||
RoomsKey = "rooms"
|
||||
|
||||
// EgressKey is a hash of egressID => egress info
|
||||
EgressKey = "egress"
|
||||
RoomEgressPrefix = "room_egress:"
|
||||
|
||||
// RoomParticipantsPrefix is hash of participant_name => ParticipantInfo
|
||||
RoomParticipantsPrefix = "room_participants:"
|
||||
|
||||
// RoomLockPrefix is a simple key containing a provided lock uid
|
||||
RoomLockPrefix = "room_lock:"
|
||||
)
|
||||
|
||||
type RedisStore struct {
|
||||
rc *redis.Client
|
||||
ctx context.Context
|
||||
}
|
||||
|
||||
func NewRedisStore(rc *redis.Client) *RedisStore {
|
||||
return &RedisStore{
|
||||
ctx: context.Background(),
|
||||
rc: rc,
|
||||
}
|
||||
}
|
||||
|
||||
func (s *RedisStore) StoreRoom(_ context.Context, room *livekit.Room) error {
|
||||
if room.CreationTime == 0 {
|
||||
room.CreationTime = time.Now().Unix()
|
||||
}
|
||||
|
||||
data, err := proto.Marshal(room)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pp := s.rc.Pipeline()
|
||||
pp.HSet(s.ctx, RoomsKey, room.Name, data)
|
||||
|
||||
if _, err = pp.Exec(s.ctx); err != nil {
|
||||
return errors.Wrap(err, "could not create room")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *RedisStore) LoadRoom(_ context.Context, name livekit.RoomName) (*livekit.Room, error) {
|
||||
data, err := s.rc.HGet(s.ctx, RoomsKey, string(name)).Result()
|
||||
if err != nil {
|
||||
if err == redis.Nil {
|
||||
err = ErrRoomNotFound
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
room := livekit.Room{}
|
||||
err = proto.Unmarshal([]byte(data), &room)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return &room, nil
|
||||
}
|
||||
|
||||
func (s *RedisStore) ListRooms(_ context.Context, names []livekit.RoomName) ([]*livekit.Room, error) {
|
||||
var items []string
|
||||
var err error
|
||||
if names == nil {
|
||||
items, err = s.rc.HVals(s.ctx, RoomsKey).Result()
|
||||
if err != nil && err != redis.Nil {
|
||||
return nil, errors.Wrap(err, "could not get rooms")
|
||||
}
|
||||
} else {
|
||||
roomNames := livekit.RoomNamesAsStrings(names)
|
||||
var results []interface{}
|
||||
results, err = s.rc.HMGet(s.ctx, RoomsKey, roomNames...).Result()
|
||||
if err != nil && err != redis.Nil {
|
||||
return nil, errors.Wrap(err, "could not get rooms by names")
|
||||
}
|
||||
for _, r := range results {
|
||||
if item, ok := r.(string); ok {
|
||||
items = append(items, item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rooms := make([]*livekit.Room, 0, len(items))
|
||||
|
||||
for _, item := range items {
|
||||
room := livekit.Room{}
|
||||
err := proto.Unmarshal([]byte(item), &room)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
rooms = append(rooms, &room)
|
||||
}
|
||||
return rooms, nil
|
||||
}
|
||||
|
||||
func (s *RedisStore) DeleteRoom(ctx context.Context, name livekit.RoomName) error {
|
||||
_, err := s.LoadRoom(ctx, name)
|
||||
if err == ErrRoomNotFound {
|
||||
return nil
|
||||
}
|
||||
|
||||
pp := s.rc.Pipeline()
|
||||
pp.HDel(s.ctx, RoomsKey, string(name))
|
||||
pp.Del(s.ctx, RoomParticipantsPrefix+string(name))
|
||||
|
||||
_, err = pp.Exec(s.ctx)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *RedisStore) LockRoom(_ context.Context, name livekit.RoomName, duration time.Duration) (string, error) {
|
||||
token := utils.NewGuid("LOCK")
|
||||
key := RoomLockPrefix + string(name)
|
||||
|
||||
startTime := time.Now()
|
||||
for {
|
||||
locked, err := s.rc.SetNX(s.ctx, key, token, duration).Result()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if locked {
|
||||
return token, nil
|
||||
}
|
||||
|
||||
// stop waiting past lock duration
|
||||
if time.Now().Sub(startTime) > duration {
|
||||
break
|
||||
}
|
||||
|
||||
time.Sleep(100 * time.Millisecond)
|
||||
}
|
||||
|
||||
return "", ErrRoomLockFailed
|
||||
}
|
||||
|
||||
func (s *RedisStore) UnlockRoom(_ context.Context, name livekit.RoomName, uid string) error {
|
||||
key := RoomLockPrefix + string(name)
|
||||
|
||||
val, err := s.rc.Get(s.ctx, key).Result()
|
||||
if err == redis.Nil {
|
||||
// already unlocked
|
||||
return nil
|
||||
} else if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if val != uid {
|
||||
return ErrRoomUnlockFailed
|
||||
}
|
||||
return s.rc.Del(s.ctx, key).Err()
|
||||
}
|
||||
|
||||
func (s *RedisStore) StoreParticipant(_ context.Context, roomName livekit.RoomName, participant *livekit.ParticipantInfo) error {
|
||||
key := RoomParticipantsPrefix + string(roomName)
|
||||
|
||||
data, err := proto.Marshal(participant)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return s.rc.HSet(s.ctx, key, participant.Identity, data).Err()
|
||||
}
|
||||
|
||||
func (s *RedisStore) LoadParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
|
||||
key := RoomParticipantsPrefix + string(roomName)
|
||||
data, err := s.rc.HGet(s.ctx, key, string(identity)).Result()
|
||||
if err == redis.Nil {
|
||||
return nil, ErrParticipantNotFound
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
pi := livekit.ParticipantInfo{}
|
||||
if err := proto.Unmarshal([]byte(data), &pi); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &pi, nil
|
||||
}
|
||||
|
||||
func (s *RedisStore) ListParticipants(_ context.Context, roomName livekit.RoomName) ([]*livekit.ParticipantInfo, error) {
|
||||
key := RoomParticipantsPrefix + string(roomName)
|
||||
items, err := s.rc.HVals(s.ctx, key).Result()
|
||||
if err == redis.Nil {
|
||||
return nil, nil
|
||||
} else if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
participants := make([]*livekit.ParticipantInfo, 0, len(items))
|
||||
for _, item := range items {
|
||||
pi := livekit.ParticipantInfo{}
|
||||
if err := proto.Unmarshal([]byte(item), &pi); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
participants = append(participants, &pi)
|
||||
}
|
||||
return participants, nil
|
||||
}
|
||||
|
||||
func (s *RedisStore) DeleteParticipant(_ context.Context, roomName livekit.RoomName, identity livekit.ParticipantIdentity) error {
|
||||
key := RoomParticipantsPrefix + string(roomName)
|
||||
|
||||
return s.rc.HDel(s.ctx, key, string(identity)).Err()
|
||||
}
|
||||
|
||||
func (s *RedisStore) StoreEgress(_ context.Context, info *livekit.EgressInfo) error {
|
||||
data, err := proto.Marshal(info)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pp := s.rc.Pipeline()
|
||||
pp.HSet(s.ctx, EgressKey, info.EgressId, data)
|
||||
pp.SAdd(s.ctx, RoomEgressPrefix+info.RoomId, info.EgressId)
|
||||
|
||||
if _, err = pp.Exec(s.ctx); err != nil {
|
||||
return errors.Wrap(err, "could not store egress info")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *RedisStore) LoadEgress(_ context.Context, egressID string) (*livekit.EgressInfo, error) {
|
||||
data, err := s.rc.HGet(s.ctx, EgressKey, egressID).Result()
|
||||
if err != nil {
|
||||
if err == redis.Nil {
|
||||
return nil, ErrEgressNotFound
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
info := &livekit.EgressInfo{}
|
||||
err = proto.Unmarshal([]byte(data), info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return info, nil
|
||||
}
|
||||
|
||||
func (s *RedisStore) ListEgress(_ context.Context, roomID livekit.RoomID) ([]*livekit.EgressInfo, error) {
|
||||
var infos []*livekit.EgressInfo
|
||||
|
||||
if roomID == "" {
|
||||
data, err := s.rc.HGetAll(s.ctx, EgressKey).Result()
|
||||
if err != nil {
|
||||
if err == redis.Nil {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
for _, d := range data {
|
||||
info := &livekit.EgressInfo{}
|
||||
err = proto.Unmarshal([]byte(d), info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
infos = append(infos, info)
|
||||
}
|
||||
} else {
|
||||
ids, err := s.rc.SMembers(s.ctx, RoomEgressPrefix+string(roomID)).Result()
|
||||
if err != nil {
|
||||
if err == redis.Nil {
|
||||
return nil, nil
|
||||
}
|
||||
return nil, err
|
||||
}
|
||||
|
||||
data, err := s.rc.HMGet(s.ctx, EgressKey, ids...).Result()
|
||||
for _, d := range data {
|
||||
if d == nil {
|
||||
continue
|
||||
}
|
||||
info := &livekit.EgressInfo{}
|
||||
err = proto.Unmarshal([]byte(d.(string)), info)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
infos = append(infos, info)
|
||||
}
|
||||
}
|
||||
|
||||
return infos, nil
|
||||
}
|
||||
|
||||
func (s *RedisStore) UpdateEgress(_ context.Context, info *livekit.EgressInfo) error {
|
||||
data, err := proto.Marshal(info)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
pp := s.rc.Pipeline()
|
||||
pp.HSet(s.ctx, EgressKey, info.EgressId, data)
|
||||
|
||||
if _, err = pp.Exec(s.ctx); err != nil {
|
||||
return errors.Wrap(err, "could not store egress info")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *RedisStore) DeleteEgress(_ context.Context, info *livekit.EgressInfo) error {
|
||||
err := s.rc.SRem(s.ctx, RoomEgressPrefix+info.RoomId, info.EgressId).Err()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return s.rc.HDel(s.ctx, EgressKey, info.EgressId).Err()
|
||||
}
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
func TestParticipantPersistence(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
rs := service.NewRedisRoomStore(redisClient())
|
||||
rs := service.NewRedisStore(redisClient())
|
||||
|
||||
roomName := livekit.RoomName("room1")
|
||||
_ = rs.DeleteRoom(ctx, roomName)
|
||||
@@ -62,7 +62,7 @@ func TestParticipantPersistence(t *testing.T) {
|
||||
|
||||
func TestRoomLock(t *testing.T) {
|
||||
ctx := context.Background()
|
||||
rs := service.NewRedisRoomStore(redisClient())
|
||||
rs := service.NewRedisStore(redisClient())
|
||||
lockInterval := 5 * time.Millisecond
|
||||
roomName := livekit.RoomName("myroom")
|
||||
|
||||
@@ -17,10 +17,10 @@ type StandardRoomAllocator struct {
|
||||
config *config.Config
|
||||
router routing.Router
|
||||
selector selector.NodeSelector
|
||||
roomStore RoomStore
|
||||
roomStore ObjectStore
|
||||
}
|
||||
|
||||
func NewRoomAllocator(conf *config.Config, router routing.Router, rs RoomStore) (RoomAllocator, error) {
|
||||
func NewRoomAllocator(conf *config.Config, router routing.Router, rs ObjectStore) (RoomAllocator, error) {
|
||||
ns, err := selector.CreateNodeSelector(conf)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -64,7 +64,7 @@ func TestCreateRoom(t *testing.T) {
|
||||
}
|
||||
|
||||
func newTestRoomAllocator(t *testing.T, conf *config.Config, node *livekit.Node) (service.RoomAllocator, *config.Config) {
|
||||
store := &servicefakes.FakeRoomStore{}
|
||||
store := &servicefakes.FakeObjectStore{}
|
||||
store.LoadRoomReturns(nil, service.ErrRoomNotFound)
|
||||
router := &routingfakes.FakeRouter{}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ type RoomManager struct {
|
||||
rtcConfig *rtc.WebRTCConfig
|
||||
currentNode routing.LocalNode
|
||||
router routing.Router
|
||||
roomStore RoomStore
|
||||
roomStore ObjectStore
|
||||
telemetry telemetry.TelemetryService
|
||||
|
||||
rooms map[livekit.RoomName]*rtc.Room
|
||||
@@ -41,7 +41,7 @@ type RoomManager struct {
|
||||
|
||||
func NewLocalRoomManager(
|
||||
conf *config.Config,
|
||||
roomStore RoomStore,
|
||||
roomStore ObjectStore,
|
||||
currentNode routing.LocalNode,
|
||||
router routing.Router,
|
||||
telemetry telemetry.TelemetryService,
|
||||
|
||||
@@ -21,10 +21,10 @@ const (
|
||||
type RoomService struct {
|
||||
router routing.MessageRouter
|
||||
roomAllocator RoomAllocator
|
||||
roomStore RORoomStore
|
||||
roomStore ServiceStore
|
||||
}
|
||||
|
||||
func NewRoomService(ra RoomAllocator, rs RORoomStore, router routing.MessageRouter) (svc *RoomService, err error) {
|
||||
func NewRoomService(ra RoomAllocator, rs ServiceStore, router routing.MessageRouter) (svc *RoomService, err error) {
|
||||
svc = &RoomService{
|
||||
router: router,
|
||||
roomAllocator: ra,
|
||||
|
||||
@@ -47,7 +47,7 @@ func TestDeleteRoom(t *testing.T) {
|
||||
func newTestRoomService() *TestRoomService {
|
||||
router := &routingfakes.FakeRouter{}
|
||||
allocator := &servicefakes.FakeRoomAllocator{}
|
||||
store := &servicefakes.FakeRORoomStore{}
|
||||
store := &servicefakes.FakeServiceStore{}
|
||||
svc, err := service.NewRoomService(allocator, store, router)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
@@ -64,5 +64,5 @@ type TestRoomService struct {
|
||||
service.RoomService
|
||||
router *routingfakes.FakeRouter
|
||||
allocator *servicefakes.FakeRoomAllocator
|
||||
store *servicefakes.FakeRORoomStore
|
||||
store *servicefakes.FakeServiceStore
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ import (
|
||||
type RTCService struct {
|
||||
router routing.MessageRouter
|
||||
roomAllocator RoomAllocator
|
||||
store RORoomStore
|
||||
store ServiceStore
|
||||
upgrader websocket.Upgrader
|
||||
currentNode routing.LocalNode
|
||||
config *config.Config
|
||||
@@ -38,7 +38,7 @@ type RTCService struct {
|
||||
func NewRTCService(
|
||||
conf *config.Config,
|
||||
ra RoomAllocator,
|
||||
store RORoomStore,
|
||||
store ServiceStore,
|
||||
router routing.MessageRouter,
|
||||
currentNode routing.LocalNode,
|
||||
) *RTCService {
|
||||
|
||||
+24
-17
@@ -25,22 +25,24 @@ import (
|
||||
)
|
||||
|
||||
type LivekitServer struct {
|
||||
config *config.Config
|
||||
recService *RecordingService
|
||||
rtcService *RTCService
|
||||
httpServer *http.Server
|
||||
promServer *http.Server
|
||||
router routing.Router
|
||||
roomManager *RoomManager
|
||||
turnServer *turn.Server
|
||||
currentNode routing.LocalNode
|
||||
running utils.AtomicFlag
|
||||
doneChan chan struct{}
|
||||
closedChan chan struct{}
|
||||
config *config.Config
|
||||
egressService *EgressService
|
||||
recService *RecordingService
|
||||
rtcService *RTCService
|
||||
httpServer *http.Server
|
||||
promServer *http.Server
|
||||
router routing.Router
|
||||
roomManager *RoomManager
|
||||
turnServer *turn.Server
|
||||
currentNode routing.LocalNode
|
||||
running utils.AtomicFlag
|
||||
doneChan chan struct{}
|
||||
closedChan chan struct{}
|
||||
}
|
||||
|
||||
func NewLivekitServer(conf *config.Config,
|
||||
roomService livekit.RoomService,
|
||||
egressService *EgressService,
|
||||
recService *RecordingService,
|
||||
rtcService *RTCService,
|
||||
keyProvider auth.KeyProvider,
|
||||
@@ -50,11 +52,12 @@ func NewLivekitServer(conf *config.Config,
|
||||
currentNode routing.LocalNode,
|
||||
) (s *LivekitServer, err error) {
|
||||
s = &LivekitServer{
|
||||
config: conf,
|
||||
recService: recService,
|
||||
rtcService: rtcService,
|
||||
router: router,
|
||||
roomManager: roomManager,
|
||||
config: conf,
|
||||
egressService: egressService,
|
||||
recService: recService,
|
||||
rtcService: rtcService,
|
||||
router: router,
|
||||
roomManager: roomManager,
|
||||
// turn server starts automatically
|
||||
turnServer: turnServer,
|
||||
currentNode: currentNode,
|
||||
@@ -77,10 +80,12 @@ func NewLivekitServer(conf *config.Config,
|
||||
}
|
||||
|
||||
roomServer := livekit.NewRoomServiceServer(roomService)
|
||||
egressServer := livekit.NewEgressServer(egressService)
|
||||
recServer := livekit.NewRecordingServiceServer(recService)
|
||||
|
||||
mux := http.NewServeMux()
|
||||
mux.Handle(roomServer.PathPrefix(), roomServer)
|
||||
mux.Handle(egressServer.PathPrefix(), egressServer)
|
||||
mux.Handle(recServer.PathPrefix(), recServer)
|
||||
mux.Handle("/rtc", rtcService)
|
||||
mux.HandleFunc("/rtc/validate", rtcService.Validate)
|
||||
@@ -144,6 +149,7 @@ func (s *LivekitServer) Start() error {
|
||||
return err
|
||||
}
|
||||
|
||||
s.egressService.Start()
|
||||
s.recService.Start()
|
||||
|
||||
// ensure we could listen
|
||||
@@ -211,6 +217,7 @@ func (s *LivekitServer) Start() error {
|
||||
}
|
||||
|
||||
s.roomManager.Stop()
|
||||
s.egressService.Stop()
|
||||
s.recService.Stop()
|
||||
|
||||
close(s.closedChan)
|
||||
|
||||
@@ -0,0 +1,510 @@
|
||||
// Code generated by counterfeiter. DO NOT EDIT.
|
||||
package servicefakes
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/service"
|
||||
"github.com/livekit/protocol/livekit"
|
||||
)
|
||||
|
||||
type FakeEgressStore struct {
|
||||
DeleteEgressStub func(context.Context, *livekit.EgressInfo) error
|
||||
deleteEgressMutex sync.RWMutex
|
||||
deleteEgressArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}
|
||||
deleteEgressReturns struct {
|
||||
result1 error
|
||||
}
|
||||
deleteEgressReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
ListEgressStub func(context.Context, livekit.RoomID) ([]*livekit.EgressInfo, error)
|
||||
listEgressMutex sync.RWMutex
|
||||
listEgressArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.RoomID
|
||||
}
|
||||
listEgressReturns struct {
|
||||
result1 []*livekit.EgressInfo
|
||||
result2 error
|
||||
}
|
||||
listEgressReturnsOnCall map[int]struct {
|
||||
result1 []*livekit.EgressInfo
|
||||
result2 error
|
||||
}
|
||||
LoadEgressStub func(context.Context, string) (*livekit.EgressInfo, error)
|
||||
loadEgressMutex sync.RWMutex
|
||||
loadEgressArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
}
|
||||
loadEgressReturns struct {
|
||||
result1 *livekit.EgressInfo
|
||||
result2 error
|
||||
}
|
||||
loadEgressReturnsOnCall map[int]struct {
|
||||
result1 *livekit.EgressInfo
|
||||
result2 error
|
||||
}
|
||||
LoadRoomStub func(context.Context, livekit.RoomName) (*livekit.Room, error)
|
||||
loadRoomMutex sync.RWMutex
|
||||
loadRoomArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.RoomName
|
||||
}
|
||||
loadRoomReturns struct {
|
||||
result1 *livekit.Room
|
||||
result2 error
|
||||
}
|
||||
loadRoomReturnsOnCall map[int]struct {
|
||||
result1 *livekit.Room
|
||||
result2 error
|
||||
}
|
||||
StoreEgressStub func(context.Context, *livekit.EgressInfo) error
|
||||
storeEgressMutex sync.RWMutex
|
||||
storeEgressArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}
|
||||
storeEgressReturns struct {
|
||||
result1 error
|
||||
}
|
||||
storeEgressReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
UpdateEgressStub func(context.Context, *livekit.EgressInfo) error
|
||||
updateEgressMutex sync.RWMutex
|
||||
updateEgressArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}
|
||||
updateEgressReturns struct {
|
||||
result1 error
|
||||
}
|
||||
updateEgressReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
invocations map[string][][]interface{}
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) DeleteEgress(arg1 context.Context, arg2 *livekit.EgressInfo) error {
|
||||
fake.deleteEgressMutex.Lock()
|
||||
ret, specificReturn := fake.deleteEgressReturnsOnCall[len(fake.deleteEgressArgsForCall)]
|
||||
fake.deleteEgressArgsForCall = append(fake.deleteEgressArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.DeleteEgressStub
|
||||
fakeReturns := fake.deleteEgressReturns
|
||||
fake.recordInvocation("DeleteEgress", []interface{}{arg1, arg2})
|
||||
fake.deleteEgressMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) DeleteEgressCallCount() int {
|
||||
fake.deleteEgressMutex.RLock()
|
||||
defer fake.deleteEgressMutex.RUnlock()
|
||||
return len(fake.deleteEgressArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) DeleteEgressCalls(stub func(context.Context, *livekit.EgressInfo) error) {
|
||||
fake.deleteEgressMutex.Lock()
|
||||
defer fake.deleteEgressMutex.Unlock()
|
||||
fake.DeleteEgressStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) DeleteEgressArgsForCall(i int) (context.Context, *livekit.EgressInfo) {
|
||||
fake.deleteEgressMutex.RLock()
|
||||
defer fake.deleteEgressMutex.RUnlock()
|
||||
argsForCall := fake.deleteEgressArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) DeleteEgressReturns(result1 error) {
|
||||
fake.deleteEgressMutex.Lock()
|
||||
defer fake.deleteEgressMutex.Unlock()
|
||||
fake.DeleteEgressStub = nil
|
||||
fake.deleteEgressReturns = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) DeleteEgressReturnsOnCall(i int, result1 error) {
|
||||
fake.deleteEgressMutex.Lock()
|
||||
defer fake.deleteEgressMutex.Unlock()
|
||||
fake.DeleteEgressStub = nil
|
||||
if fake.deleteEgressReturnsOnCall == nil {
|
||||
fake.deleteEgressReturnsOnCall = make(map[int]struct {
|
||||
result1 error
|
||||
})
|
||||
}
|
||||
fake.deleteEgressReturnsOnCall[i] = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) ListEgress(arg1 context.Context, arg2 livekit.RoomID) ([]*livekit.EgressInfo, error) {
|
||||
fake.listEgressMutex.Lock()
|
||||
ret, specificReturn := fake.listEgressReturnsOnCall[len(fake.listEgressArgsForCall)]
|
||||
fake.listEgressArgsForCall = append(fake.listEgressArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.RoomID
|
||||
}{arg1, arg2})
|
||||
stub := fake.ListEgressStub
|
||||
fakeReturns := fake.listEgressReturns
|
||||
fake.recordInvocation("ListEgress", []interface{}{arg1, arg2})
|
||||
fake.listEgressMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) ListEgressCallCount() int {
|
||||
fake.listEgressMutex.RLock()
|
||||
defer fake.listEgressMutex.RUnlock()
|
||||
return len(fake.listEgressArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) ListEgressCalls(stub func(context.Context, livekit.RoomID) ([]*livekit.EgressInfo, error)) {
|
||||
fake.listEgressMutex.Lock()
|
||||
defer fake.listEgressMutex.Unlock()
|
||||
fake.ListEgressStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) ListEgressArgsForCall(i int) (context.Context, livekit.RoomID) {
|
||||
fake.listEgressMutex.RLock()
|
||||
defer fake.listEgressMutex.RUnlock()
|
||||
argsForCall := fake.listEgressArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) ListEgressReturns(result1 []*livekit.EgressInfo, result2 error) {
|
||||
fake.listEgressMutex.Lock()
|
||||
defer fake.listEgressMutex.Unlock()
|
||||
fake.ListEgressStub = nil
|
||||
fake.listEgressReturns = struct {
|
||||
result1 []*livekit.EgressInfo
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) ListEgressReturnsOnCall(i int, result1 []*livekit.EgressInfo, result2 error) {
|
||||
fake.listEgressMutex.Lock()
|
||||
defer fake.listEgressMutex.Unlock()
|
||||
fake.ListEgressStub = nil
|
||||
if fake.listEgressReturnsOnCall == nil {
|
||||
fake.listEgressReturnsOnCall = make(map[int]struct {
|
||||
result1 []*livekit.EgressInfo
|
||||
result2 error
|
||||
})
|
||||
}
|
||||
fake.listEgressReturnsOnCall[i] = struct {
|
||||
result1 []*livekit.EgressInfo
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) LoadEgress(arg1 context.Context, arg2 string) (*livekit.EgressInfo, error) {
|
||||
fake.loadEgressMutex.Lock()
|
||||
ret, specificReturn := fake.loadEgressReturnsOnCall[len(fake.loadEgressArgsForCall)]
|
||||
fake.loadEgressArgsForCall = append(fake.loadEgressArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.LoadEgressStub
|
||||
fakeReturns := fake.loadEgressReturns
|
||||
fake.recordInvocation("LoadEgress", []interface{}{arg1, arg2})
|
||||
fake.loadEgressMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) LoadEgressCallCount() int {
|
||||
fake.loadEgressMutex.RLock()
|
||||
defer fake.loadEgressMutex.RUnlock()
|
||||
return len(fake.loadEgressArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) LoadEgressCalls(stub func(context.Context, string) (*livekit.EgressInfo, error)) {
|
||||
fake.loadEgressMutex.Lock()
|
||||
defer fake.loadEgressMutex.Unlock()
|
||||
fake.LoadEgressStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) LoadEgressArgsForCall(i int) (context.Context, string) {
|
||||
fake.loadEgressMutex.RLock()
|
||||
defer fake.loadEgressMutex.RUnlock()
|
||||
argsForCall := fake.loadEgressArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) LoadEgressReturns(result1 *livekit.EgressInfo, result2 error) {
|
||||
fake.loadEgressMutex.Lock()
|
||||
defer fake.loadEgressMutex.Unlock()
|
||||
fake.LoadEgressStub = nil
|
||||
fake.loadEgressReturns = struct {
|
||||
result1 *livekit.EgressInfo
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) LoadEgressReturnsOnCall(i int, result1 *livekit.EgressInfo, result2 error) {
|
||||
fake.loadEgressMutex.Lock()
|
||||
defer fake.loadEgressMutex.Unlock()
|
||||
fake.LoadEgressStub = nil
|
||||
if fake.loadEgressReturnsOnCall == nil {
|
||||
fake.loadEgressReturnsOnCall = make(map[int]struct {
|
||||
result1 *livekit.EgressInfo
|
||||
result2 error
|
||||
})
|
||||
}
|
||||
fake.loadEgressReturnsOnCall[i] = struct {
|
||||
result1 *livekit.EgressInfo
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) LoadRoom(arg1 context.Context, arg2 livekit.RoomName) (*livekit.Room, error) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
ret, specificReturn := fake.loadRoomReturnsOnCall[len(fake.loadRoomArgsForCall)]
|
||||
fake.loadRoomArgsForCall = append(fake.loadRoomArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.RoomName
|
||||
}{arg1, arg2})
|
||||
stub := fake.LoadRoomStub
|
||||
fakeReturns := fake.loadRoomReturns
|
||||
fake.recordInvocation("LoadRoom", []interface{}{arg1, arg2})
|
||||
fake.loadRoomMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) LoadRoomCallCount() int {
|
||||
fake.loadRoomMutex.RLock()
|
||||
defer fake.loadRoomMutex.RUnlock()
|
||||
return len(fake.loadRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) LoadRoomCalls(stub func(context.Context, livekit.RoomName) (*livekit.Room, error)) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
defer fake.loadRoomMutex.Unlock()
|
||||
fake.LoadRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) LoadRoomArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.loadRoomMutex.RLock()
|
||||
defer fake.loadRoomMutex.RUnlock()
|
||||
argsForCall := fake.loadRoomArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) LoadRoomReturns(result1 *livekit.Room, result2 error) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
defer fake.loadRoomMutex.Unlock()
|
||||
fake.LoadRoomStub = nil
|
||||
fake.loadRoomReturns = struct {
|
||||
result1 *livekit.Room
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) LoadRoomReturnsOnCall(i int, result1 *livekit.Room, result2 error) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
defer fake.loadRoomMutex.Unlock()
|
||||
fake.LoadRoomStub = nil
|
||||
if fake.loadRoomReturnsOnCall == nil {
|
||||
fake.loadRoomReturnsOnCall = make(map[int]struct {
|
||||
result1 *livekit.Room
|
||||
result2 error
|
||||
})
|
||||
}
|
||||
fake.loadRoomReturnsOnCall[i] = struct {
|
||||
result1 *livekit.Room
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) StoreEgress(arg1 context.Context, arg2 *livekit.EgressInfo) error {
|
||||
fake.storeEgressMutex.Lock()
|
||||
ret, specificReturn := fake.storeEgressReturnsOnCall[len(fake.storeEgressArgsForCall)]
|
||||
fake.storeEgressArgsForCall = append(fake.storeEgressArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.StoreEgressStub
|
||||
fakeReturns := fake.storeEgressReturns
|
||||
fake.recordInvocation("StoreEgress", []interface{}{arg1, arg2})
|
||||
fake.storeEgressMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) StoreEgressCallCount() int {
|
||||
fake.storeEgressMutex.RLock()
|
||||
defer fake.storeEgressMutex.RUnlock()
|
||||
return len(fake.storeEgressArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) StoreEgressCalls(stub func(context.Context, *livekit.EgressInfo) error) {
|
||||
fake.storeEgressMutex.Lock()
|
||||
defer fake.storeEgressMutex.Unlock()
|
||||
fake.StoreEgressStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) StoreEgressArgsForCall(i int) (context.Context, *livekit.EgressInfo) {
|
||||
fake.storeEgressMutex.RLock()
|
||||
defer fake.storeEgressMutex.RUnlock()
|
||||
argsForCall := fake.storeEgressArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) StoreEgressReturns(result1 error) {
|
||||
fake.storeEgressMutex.Lock()
|
||||
defer fake.storeEgressMutex.Unlock()
|
||||
fake.StoreEgressStub = nil
|
||||
fake.storeEgressReturns = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) StoreEgressReturnsOnCall(i int, result1 error) {
|
||||
fake.storeEgressMutex.Lock()
|
||||
defer fake.storeEgressMutex.Unlock()
|
||||
fake.StoreEgressStub = nil
|
||||
if fake.storeEgressReturnsOnCall == nil {
|
||||
fake.storeEgressReturnsOnCall = make(map[int]struct {
|
||||
result1 error
|
||||
})
|
||||
}
|
||||
fake.storeEgressReturnsOnCall[i] = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) UpdateEgress(arg1 context.Context, arg2 *livekit.EgressInfo) error {
|
||||
fake.updateEgressMutex.Lock()
|
||||
ret, specificReturn := fake.updateEgressReturnsOnCall[len(fake.updateEgressArgsForCall)]
|
||||
fake.updateEgressArgsForCall = append(fake.updateEgressArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.UpdateEgressStub
|
||||
fakeReturns := fake.updateEgressReturns
|
||||
fake.recordInvocation("UpdateEgress", []interface{}{arg1, arg2})
|
||||
fake.updateEgressMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) UpdateEgressCallCount() int {
|
||||
fake.updateEgressMutex.RLock()
|
||||
defer fake.updateEgressMutex.RUnlock()
|
||||
return len(fake.updateEgressArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) UpdateEgressCalls(stub func(context.Context, *livekit.EgressInfo) error) {
|
||||
fake.updateEgressMutex.Lock()
|
||||
defer fake.updateEgressMutex.Unlock()
|
||||
fake.UpdateEgressStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) UpdateEgressArgsForCall(i int) (context.Context, *livekit.EgressInfo) {
|
||||
fake.updateEgressMutex.RLock()
|
||||
defer fake.updateEgressMutex.RUnlock()
|
||||
argsForCall := fake.updateEgressArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) UpdateEgressReturns(result1 error) {
|
||||
fake.updateEgressMutex.Lock()
|
||||
defer fake.updateEgressMutex.Unlock()
|
||||
fake.UpdateEgressStub = nil
|
||||
fake.updateEgressReturns = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) UpdateEgressReturnsOnCall(i int, result1 error) {
|
||||
fake.updateEgressMutex.Lock()
|
||||
defer fake.updateEgressMutex.Unlock()
|
||||
fake.UpdateEgressStub = nil
|
||||
if fake.updateEgressReturnsOnCall == nil {
|
||||
fake.updateEgressReturnsOnCall = make(map[int]struct {
|
||||
result1 error
|
||||
})
|
||||
}
|
||||
fake.updateEgressReturnsOnCall[i] = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) Invocations() map[string][][]interface{} {
|
||||
fake.invocationsMutex.RLock()
|
||||
defer fake.invocationsMutex.RUnlock()
|
||||
fake.deleteEgressMutex.RLock()
|
||||
defer fake.deleteEgressMutex.RUnlock()
|
||||
fake.listEgressMutex.RLock()
|
||||
defer fake.listEgressMutex.RUnlock()
|
||||
fake.loadEgressMutex.RLock()
|
||||
defer fake.loadEgressMutex.RUnlock()
|
||||
fake.loadRoomMutex.RLock()
|
||||
defer fake.loadRoomMutex.RUnlock()
|
||||
fake.storeEgressMutex.RLock()
|
||||
defer fake.storeEgressMutex.RUnlock()
|
||||
fake.updateEgressMutex.RLock()
|
||||
defer fake.updateEgressMutex.RUnlock()
|
||||
copiedInvocations := map[string][][]interface{}{}
|
||||
for key, value := range fake.invocations {
|
||||
copiedInvocations[key] = value
|
||||
}
|
||||
return copiedInvocations
|
||||
}
|
||||
|
||||
func (fake *FakeEgressStore) recordInvocation(key string, args []interface{}) {
|
||||
fake.invocationsMutex.Lock()
|
||||
defer fake.invocationsMutex.Unlock()
|
||||
if fake.invocations == nil {
|
||||
fake.invocations = map[string][][]interface{}{}
|
||||
}
|
||||
if fake.invocations[key] == nil {
|
||||
fake.invocations[key] = [][]interface{}{}
|
||||
}
|
||||
fake.invocations[key] = append(fake.invocations[key], args)
|
||||
}
|
||||
|
||||
var _ service.EgressStore = new(FakeEgressStore)
|
||||
+454
-64
@@ -10,7 +10,19 @@ import (
|
||||
"github.com/livekit/protocol/livekit"
|
||||
)
|
||||
|
||||
type FakeRoomStore struct {
|
||||
type FakeObjectStore struct {
|
||||
DeleteEgressStub func(context.Context, *livekit.EgressInfo) error
|
||||
deleteEgressMutex sync.RWMutex
|
||||
deleteEgressArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}
|
||||
deleteEgressReturns struct {
|
||||
result1 error
|
||||
}
|
||||
deleteEgressReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
DeleteParticipantStub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) error
|
||||
deleteParticipantMutex sync.RWMutex
|
||||
deleteParticipantArgsForCall []struct {
|
||||
@@ -36,6 +48,20 @@ type FakeRoomStore struct {
|
||||
deleteRoomReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
ListEgressStub func(context.Context, livekit.RoomID) ([]*livekit.EgressInfo, error)
|
||||
listEgressMutex sync.RWMutex
|
||||
listEgressArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.RoomID
|
||||
}
|
||||
listEgressReturns struct {
|
||||
result1 []*livekit.EgressInfo
|
||||
result2 error
|
||||
}
|
||||
listEgressReturnsOnCall map[int]struct {
|
||||
result1 []*livekit.EgressInfo
|
||||
result2 error
|
||||
}
|
||||
ListParticipantsStub func(context.Context, livekit.RoomName) ([]*livekit.ParticipantInfo, error)
|
||||
listParticipantsMutex sync.RWMutex
|
||||
listParticipantsArgsForCall []struct {
|
||||
@@ -64,6 +90,20 @@ type FakeRoomStore struct {
|
||||
result1 []*livekit.Room
|
||||
result2 error
|
||||
}
|
||||
LoadEgressStub func(context.Context, string) (*livekit.EgressInfo, error)
|
||||
loadEgressMutex sync.RWMutex
|
||||
loadEgressArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
}
|
||||
loadEgressReturns struct {
|
||||
result1 *livekit.EgressInfo
|
||||
result2 error
|
||||
}
|
||||
loadEgressReturnsOnCall map[int]struct {
|
||||
result1 *livekit.EgressInfo
|
||||
result2 error
|
||||
}
|
||||
LoadParticipantStub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error)
|
||||
loadParticipantMutex sync.RWMutex
|
||||
loadParticipantArgsForCall []struct {
|
||||
@@ -108,6 +148,18 @@ type FakeRoomStore struct {
|
||||
result1 string
|
||||
result2 error
|
||||
}
|
||||
StoreEgressStub func(context.Context, *livekit.EgressInfo) error
|
||||
storeEgressMutex sync.RWMutex
|
||||
storeEgressArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}
|
||||
storeEgressReturns struct {
|
||||
result1 error
|
||||
}
|
||||
storeEgressReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
StoreParticipantStub func(context.Context, livekit.RoomName, *livekit.ParticipantInfo) error
|
||||
storeParticipantMutex sync.RWMutex
|
||||
storeParticipantArgsForCall []struct {
|
||||
@@ -146,11 +198,85 @@ type FakeRoomStore struct {
|
||||
unlockRoomReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
UpdateEgressStub func(context.Context, *livekit.EgressInfo) error
|
||||
updateEgressMutex sync.RWMutex
|
||||
updateEgressArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}
|
||||
updateEgressReturns struct {
|
||||
result1 error
|
||||
}
|
||||
updateEgressReturnsOnCall map[int]struct {
|
||||
result1 error
|
||||
}
|
||||
invocations map[string][][]interface{}
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 livekit.ParticipantIdentity) error {
|
||||
func (fake *FakeObjectStore) DeleteEgress(arg1 context.Context, arg2 *livekit.EgressInfo) error {
|
||||
fake.deleteEgressMutex.Lock()
|
||||
ret, specificReturn := fake.deleteEgressReturnsOnCall[len(fake.deleteEgressArgsForCall)]
|
||||
fake.deleteEgressArgsForCall = append(fake.deleteEgressArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.DeleteEgressStub
|
||||
fakeReturns := fake.deleteEgressReturns
|
||||
fake.recordInvocation("DeleteEgress", []interface{}{arg1, arg2})
|
||||
fake.deleteEgressMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) DeleteEgressCallCount() int {
|
||||
fake.deleteEgressMutex.RLock()
|
||||
defer fake.deleteEgressMutex.RUnlock()
|
||||
return len(fake.deleteEgressArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) DeleteEgressCalls(stub func(context.Context, *livekit.EgressInfo) error) {
|
||||
fake.deleteEgressMutex.Lock()
|
||||
defer fake.deleteEgressMutex.Unlock()
|
||||
fake.DeleteEgressStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) DeleteEgressArgsForCall(i int) (context.Context, *livekit.EgressInfo) {
|
||||
fake.deleteEgressMutex.RLock()
|
||||
defer fake.deleteEgressMutex.RUnlock()
|
||||
argsForCall := fake.deleteEgressArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) DeleteEgressReturns(result1 error) {
|
||||
fake.deleteEgressMutex.Lock()
|
||||
defer fake.deleteEgressMutex.Unlock()
|
||||
fake.DeleteEgressStub = nil
|
||||
fake.deleteEgressReturns = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) DeleteEgressReturnsOnCall(i int, result1 error) {
|
||||
fake.deleteEgressMutex.Lock()
|
||||
defer fake.deleteEgressMutex.Unlock()
|
||||
fake.DeleteEgressStub = nil
|
||||
if fake.deleteEgressReturnsOnCall == nil {
|
||||
fake.deleteEgressReturnsOnCall = make(map[int]struct {
|
||||
result1 error
|
||||
})
|
||||
}
|
||||
fake.deleteEgressReturnsOnCall[i] = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) DeleteParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 livekit.ParticipantIdentity) error {
|
||||
fake.deleteParticipantMutex.Lock()
|
||||
ret, specificReturn := fake.deleteParticipantReturnsOnCall[len(fake.deleteParticipantArgsForCall)]
|
||||
fake.deleteParticipantArgsForCall = append(fake.deleteParticipantArgsForCall, struct {
|
||||
@@ -171,26 +297,26 @@ func (fake *FakeRoomStore) DeleteParticipant(arg1 context.Context, arg2 livekit.
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteParticipantCallCount() int {
|
||||
func (fake *FakeObjectStore) DeleteParticipantCallCount() int {
|
||||
fake.deleteParticipantMutex.RLock()
|
||||
defer fake.deleteParticipantMutex.RUnlock()
|
||||
return len(fake.deleteParticipantArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteParticipantCalls(stub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) error) {
|
||||
func (fake *FakeObjectStore) DeleteParticipantCalls(stub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) error) {
|
||||
fake.deleteParticipantMutex.Lock()
|
||||
defer fake.deleteParticipantMutex.Unlock()
|
||||
fake.DeleteParticipantStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteParticipantArgsForCall(i int) (context.Context, livekit.RoomName, livekit.ParticipantIdentity) {
|
||||
func (fake *FakeObjectStore) DeleteParticipantArgsForCall(i int) (context.Context, livekit.RoomName, livekit.ParticipantIdentity) {
|
||||
fake.deleteParticipantMutex.RLock()
|
||||
defer fake.deleteParticipantMutex.RUnlock()
|
||||
argsForCall := fake.deleteParticipantArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteParticipantReturns(result1 error) {
|
||||
func (fake *FakeObjectStore) DeleteParticipantReturns(result1 error) {
|
||||
fake.deleteParticipantMutex.Lock()
|
||||
defer fake.deleteParticipantMutex.Unlock()
|
||||
fake.DeleteParticipantStub = nil
|
||||
@@ -199,7 +325,7 @@ func (fake *FakeRoomStore) DeleteParticipantReturns(result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteParticipantReturnsOnCall(i int, result1 error) {
|
||||
func (fake *FakeObjectStore) DeleteParticipantReturnsOnCall(i int, result1 error) {
|
||||
fake.deleteParticipantMutex.Lock()
|
||||
defer fake.deleteParticipantMutex.Unlock()
|
||||
fake.DeleteParticipantStub = nil
|
||||
@@ -213,7 +339,7 @@ func (fake *FakeRoomStore) DeleteParticipantReturnsOnCall(i int, result1 error)
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteRoom(arg1 context.Context, arg2 livekit.RoomName) error {
|
||||
func (fake *FakeObjectStore) DeleteRoom(arg1 context.Context, arg2 livekit.RoomName) error {
|
||||
fake.deleteRoomMutex.Lock()
|
||||
ret, specificReturn := fake.deleteRoomReturnsOnCall[len(fake.deleteRoomArgsForCall)]
|
||||
fake.deleteRoomArgsForCall = append(fake.deleteRoomArgsForCall, struct {
|
||||
@@ -233,26 +359,26 @@ func (fake *FakeRoomStore) DeleteRoom(arg1 context.Context, arg2 livekit.RoomNam
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteRoomCallCount() int {
|
||||
func (fake *FakeObjectStore) DeleteRoomCallCount() int {
|
||||
fake.deleteRoomMutex.RLock()
|
||||
defer fake.deleteRoomMutex.RUnlock()
|
||||
return len(fake.deleteRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteRoomCalls(stub func(context.Context, livekit.RoomName) error) {
|
||||
func (fake *FakeObjectStore) DeleteRoomCalls(stub func(context.Context, livekit.RoomName) error) {
|
||||
fake.deleteRoomMutex.Lock()
|
||||
defer fake.deleteRoomMutex.Unlock()
|
||||
fake.DeleteRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteRoomArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
func (fake *FakeObjectStore) DeleteRoomArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.deleteRoomMutex.RLock()
|
||||
defer fake.deleteRoomMutex.RUnlock()
|
||||
argsForCall := fake.deleteRoomArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteRoomReturns(result1 error) {
|
||||
func (fake *FakeObjectStore) DeleteRoomReturns(result1 error) {
|
||||
fake.deleteRoomMutex.Lock()
|
||||
defer fake.deleteRoomMutex.Unlock()
|
||||
fake.DeleteRoomStub = nil
|
||||
@@ -261,7 +387,7 @@ func (fake *FakeRoomStore) DeleteRoomReturns(result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) DeleteRoomReturnsOnCall(i int, result1 error) {
|
||||
func (fake *FakeObjectStore) DeleteRoomReturnsOnCall(i int, result1 error) {
|
||||
fake.deleteRoomMutex.Lock()
|
||||
defer fake.deleteRoomMutex.Unlock()
|
||||
fake.DeleteRoomStub = nil
|
||||
@@ -275,7 +401,72 @@ func (fake *FakeRoomStore) DeleteRoomReturnsOnCall(i int, result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListParticipants(arg1 context.Context, arg2 livekit.RoomName) ([]*livekit.ParticipantInfo, error) {
|
||||
func (fake *FakeObjectStore) ListEgress(arg1 context.Context, arg2 livekit.RoomID) ([]*livekit.EgressInfo, error) {
|
||||
fake.listEgressMutex.Lock()
|
||||
ret, specificReturn := fake.listEgressReturnsOnCall[len(fake.listEgressArgsForCall)]
|
||||
fake.listEgressArgsForCall = append(fake.listEgressArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 livekit.RoomID
|
||||
}{arg1, arg2})
|
||||
stub := fake.ListEgressStub
|
||||
fakeReturns := fake.listEgressReturns
|
||||
fake.recordInvocation("ListEgress", []interface{}{arg1, arg2})
|
||||
fake.listEgressMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) ListEgressCallCount() int {
|
||||
fake.listEgressMutex.RLock()
|
||||
defer fake.listEgressMutex.RUnlock()
|
||||
return len(fake.listEgressArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) ListEgressCalls(stub func(context.Context, livekit.RoomID) ([]*livekit.EgressInfo, error)) {
|
||||
fake.listEgressMutex.Lock()
|
||||
defer fake.listEgressMutex.Unlock()
|
||||
fake.ListEgressStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) ListEgressArgsForCall(i int) (context.Context, livekit.RoomID) {
|
||||
fake.listEgressMutex.RLock()
|
||||
defer fake.listEgressMutex.RUnlock()
|
||||
argsForCall := fake.listEgressArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) ListEgressReturns(result1 []*livekit.EgressInfo, result2 error) {
|
||||
fake.listEgressMutex.Lock()
|
||||
defer fake.listEgressMutex.Unlock()
|
||||
fake.ListEgressStub = nil
|
||||
fake.listEgressReturns = struct {
|
||||
result1 []*livekit.EgressInfo
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) ListEgressReturnsOnCall(i int, result1 []*livekit.EgressInfo, result2 error) {
|
||||
fake.listEgressMutex.Lock()
|
||||
defer fake.listEgressMutex.Unlock()
|
||||
fake.ListEgressStub = nil
|
||||
if fake.listEgressReturnsOnCall == nil {
|
||||
fake.listEgressReturnsOnCall = make(map[int]struct {
|
||||
result1 []*livekit.EgressInfo
|
||||
result2 error
|
||||
})
|
||||
}
|
||||
fake.listEgressReturnsOnCall[i] = struct {
|
||||
result1 []*livekit.EgressInfo
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) ListParticipants(arg1 context.Context, arg2 livekit.RoomName) ([]*livekit.ParticipantInfo, error) {
|
||||
fake.listParticipantsMutex.Lock()
|
||||
ret, specificReturn := fake.listParticipantsReturnsOnCall[len(fake.listParticipantsArgsForCall)]
|
||||
fake.listParticipantsArgsForCall = append(fake.listParticipantsArgsForCall, struct {
|
||||
@@ -295,26 +486,26 @@ func (fake *FakeRoomStore) ListParticipants(arg1 context.Context, arg2 livekit.R
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListParticipantsCallCount() int {
|
||||
func (fake *FakeObjectStore) ListParticipantsCallCount() int {
|
||||
fake.listParticipantsMutex.RLock()
|
||||
defer fake.listParticipantsMutex.RUnlock()
|
||||
return len(fake.listParticipantsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListParticipantsCalls(stub func(context.Context, livekit.RoomName) ([]*livekit.ParticipantInfo, error)) {
|
||||
func (fake *FakeObjectStore) ListParticipantsCalls(stub func(context.Context, livekit.RoomName) ([]*livekit.ParticipantInfo, error)) {
|
||||
fake.listParticipantsMutex.Lock()
|
||||
defer fake.listParticipantsMutex.Unlock()
|
||||
fake.ListParticipantsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListParticipantsArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
func (fake *FakeObjectStore) ListParticipantsArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.listParticipantsMutex.RLock()
|
||||
defer fake.listParticipantsMutex.RUnlock()
|
||||
argsForCall := fake.listParticipantsArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListParticipantsReturns(result1 []*livekit.ParticipantInfo, result2 error) {
|
||||
func (fake *FakeObjectStore) ListParticipantsReturns(result1 []*livekit.ParticipantInfo, result2 error) {
|
||||
fake.listParticipantsMutex.Lock()
|
||||
defer fake.listParticipantsMutex.Unlock()
|
||||
fake.ListParticipantsStub = nil
|
||||
@@ -324,7 +515,7 @@ func (fake *FakeRoomStore) ListParticipantsReturns(result1 []*livekit.Participan
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListParticipantsReturnsOnCall(i int, result1 []*livekit.ParticipantInfo, result2 error) {
|
||||
func (fake *FakeObjectStore) ListParticipantsReturnsOnCall(i int, result1 []*livekit.ParticipantInfo, result2 error) {
|
||||
fake.listParticipantsMutex.Lock()
|
||||
defer fake.listParticipantsMutex.Unlock()
|
||||
fake.ListParticipantsStub = nil
|
||||
@@ -340,7 +531,7 @@ func (fake *FakeRoomStore) ListParticipantsReturnsOnCall(i int, result1 []*livek
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListRooms(arg1 context.Context, arg2 []livekit.RoomName) ([]*livekit.Room, error) {
|
||||
func (fake *FakeObjectStore) ListRooms(arg1 context.Context, arg2 []livekit.RoomName) ([]*livekit.Room, error) {
|
||||
var arg2Copy []livekit.RoomName
|
||||
if arg2 != nil {
|
||||
arg2Copy = make([]livekit.RoomName, len(arg2))
|
||||
@@ -365,26 +556,26 @@ func (fake *FakeRoomStore) ListRooms(arg1 context.Context, arg2 []livekit.RoomNa
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListRoomsCallCount() int {
|
||||
func (fake *FakeObjectStore) ListRoomsCallCount() int {
|
||||
fake.listRoomsMutex.RLock()
|
||||
defer fake.listRoomsMutex.RUnlock()
|
||||
return len(fake.listRoomsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListRoomsCalls(stub func(context.Context, []livekit.RoomName) ([]*livekit.Room, error)) {
|
||||
func (fake *FakeObjectStore) ListRoomsCalls(stub func(context.Context, []livekit.RoomName) ([]*livekit.Room, error)) {
|
||||
fake.listRoomsMutex.Lock()
|
||||
defer fake.listRoomsMutex.Unlock()
|
||||
fake.ListRoomsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListRoomsArgsForCall(i int) (context.Context, []livekit.RoomName) {
|
||||
func (fake *FakeObjectStore) ListRoomsArgsForCall(i int) (context.Context, []livekit.RoomName) {
|
||||
fake.listRoomsMutex.RLock()
|
||||
defer fake.listRoomsMutex.RUnlock()
|
||||
argsForCall := fake.listRoomsArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListRoomsReturns(result1 []*livekit.Room, result2 error) {
|
||||
func (fake *FakeObjectStore) ListRoomsReturns(result1 []*livekit.Room, result2 error) {
|
||||
fake.listRoomsMutex.Lock()
|
||||
defer fake.listRoomsMutex.Unlock()
|
||||
fake.ListRoomsStub = nil
|
||||
@@ -394,7 +585,7 @@ func (fake *FakeRoomStore) ListRoomsReturns(result1 []*livekit.Room, result2 err
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) ListRoomsReturnsOnCall(i int, result1 []*livekit.Room, result2 error) {
|
||||
func (fake *FakeObjectStore) ListRoomsReturnsOnCall(i int, result1 []*livekit.Room, result2 error) {
|
||||
fake.listRoomsMutex.Lock()
|
||||
defer fake.listRoomsMutex.Unlock()
|
||||
fake.ListRoomsStub = nil
|
||||
@@ -410,7 +601,72 @@ func (fake *FakeRoomStore) ListRoomsReturnsOnCall(i int, result1 []*livekit.Room
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
|
||||
func (fake *FakeObjectStore) LoadEgress(arg1 context.Context, arg2 string) (*livekit.EgressInfo, error) {
|
||||
fake.loadEgressMutex.Lock()
|
||||
ret, specificReturn := fake.loadEgressReturnsOnCall[len(fake.loadEgressArgsForCall)]
|
||||
fake.loadEgressArgsForCall = append(fake.loadEgressArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 string
|
||||
}{arg1, arg2})
|
||||
stub := fake.LoadEgressStub
|
||||
fakeReturns := fake.loadEgressReturns
|
||||
fake.recordInvocation("LoadEgress", []interface{}{arg1, arg2})
|
||||
fake.loadEgressMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1, ret.result2
|
||||
}
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) LoadEgressCallCount() int {
|
||||
fake.loadEgressMutex.RLock()
|
||||
defer fake.loadEgressMutex.RUnlock()
|
||||
return len(fake.loadEgressArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) LoadEgressCalls(stub func(context.Context, string) (*livekit.EgressInfo, error)) {
|
||||
fake.loadEgressMutex.Lock()
|
||||
defer fake.loadEgressMutex.Unlock()
|
||||
fake.LoadEgressStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) LoadEgressArgsForCall(i int) (context.Context, string) {
|
||||
fake.loadEgressMutex.RLock()
|
||||
defer fake.loadEgressMutex.RUnlock()
|
||||
argsForCall := fake.loadEgressArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) LoadEgressReturns(result1 *livekit.EgressInfo, result2 error) {
|
||||
fake.loadEgressMutex.Lock()
|
||||
defer fake.loadEgressMutex.Unlock()
|
||||
fake.LoadEgressStub = nil
|
||||
fake.loadEgressReturns = struct {
|
||||
result1 *livekit.EgressInfo
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) LoadEgressReturnsOnCall(i int, result1 *livekit.EgressInfo, result2 error) {
|
||||
fake.loadEgressMutex.Lock()
|
||||
defer fake.loadEgressMutex.Unlock()
|
||||
fake.LoadEgressStub = nil
|
||||
if fake.loadEgressReturnsOnCall == nil {
|
||||
fake.loadEgressReturnsOnCall = make(map[int]struct {
|
||||
result1 *livekit.EgressInfo
|
||||
result2 error
|
||||
})
|
||||
}
|
||||
fake.loadEgressReturnsOnCall[i] = struct {
|
||||
result1 *livekit.EgressInfo
|
||||
result2 error
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) LoadParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
|
||||
fake.loadParticipantMutex.Lock()
|
||||
ret, specificReturn := fake.loadParticipantReturnsOnCall[len(fake.loadParticipantArgsForCall)]
|
||||
fake.loadParticipantArgsForCall = append(fake.loadParticipantArgsForCall, struct {
|
||||
@@ -431,26 +687,26 @@ func (fake *FakeRoomStore) LoadParticipant(arg1 context.Context, arg2 livekit.Ro
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadParticipantCallCount() int {
|
||||
func (fake *FakeObjectStore) LoadParticipantCallCount() int {
|
||||
fake.loadParticipantMutex.RLock()
|
||||
defer fake.loadParticipantMutex.RUnlock()
|
||||
return len(fake.loadParticipantArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadParticipantCalls(stub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error)) {
|
||||
func (fake *FakeObjectStore) LoadParticipantCalls(stub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error)) {
|
||||
fake.loadParticipantMutex.Lock()
|
||||
defer fake.loadParticipantMutex.Unlock()
|
||||
fake.LoadParticipantStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadParticipantArgsForCall(i int) (context.Context, livekit.RoomName, livekit.ParticipantIdentity) {
|
||||
func (fake *FakeObjectStore) LoadParticipantArgsForCall(i int) (context.Context, livekit.RoomName, livekit.ParticipantIdentity) {
|
||||
fake.loadParticipantMutex.RLock()
|
||||
defer fake.loadParticipantMutex.RUnlock()
|
||||
argsForCall := fake.loadParticipantArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadParticipantReturns(result1 *livekit.ParticipantInfo, result2 error) {
|
||||
func (fake *FakeObjectStore) LoadParticipantReturns(result1 *livekit.ParticipantInfo, result2 error) {
|
||||
fake.loadParticipantMutex.Lock()
|
||||
defer fake.loadParticipantMutex.Unlock()
|
||||
fake.LoadParticipantStub = nil
|
||||
@@ -460,7 +716,7 @@ func (fake *FakeRoomStore) LoadParticipantReturns(result1 *livekit.ParticipantIn
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadParticipantReturnsOnCall(i int, result1 *livekit.ParticipantInfo, result2 error) {
|
||||
func (fake *FakeObjectStore) LoadParticipantReturnsOnCall(i int, result1 *livekit.ParticipantInfo, result2 error) {
|
||||
fake.loadParticipantMutex.Lock()
|
||||
defer fake.loadParticipantMutex.Unlock()
|
||||
fake.LoadParticipantStub = nil
|
||||
@@ -476,7 +732,7 @@ func (fake *FakeRoomStore) LoadParticipantReturnsOnCall(i int, result1 *livekit.
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadRoom(arg1 context.Context, arg2 livekit.RoomName) (*livekit.Room, error) {
|
||||
func (fake *FakeObjectStore) LoadRoom(arg1 context.Context, arg2 livekit.RoomName) (*livekit.Room, error) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
ret, specificReturn := fake.loadRoomReturnsOnCall[len(fake.loadRoomArgsForCall)]
|
||||
fake.loadRoomArgsForCall = append(fake.loadRoomArgsForCall, struct {
|
||||
@@ -496,26 +752,26 @@ func (fake *FakeRoomStore) LoadRoom(arg1 context.Context, arg2 livekit.RoomName)
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadRoomCallCount() int {
|
||||
func (fake *FakeObjectStore) LoadRoomCallCount() int {
|
||||
fake.loadRoomMutex.RLock()
|
||||
defer fake.loadRoomMutex.RUnlock()
|
||||
return len(fake.loadRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadRoomCalls(stub func(context.Context, livekit.RoomName) (*livekit.Room, error)) {
|
||||
func (fake *FakeObjectStore) LoadRoomCalls(stub func(context.Context, livekit.RoomName) (*livekit.Room, error)) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
defer fake.loadRoomMutex.Unlock()
|
||||
fake.LoadRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadRoomArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
func (fake *FakeObjectStore) LoadRoomArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.loadRoomMutex.RLock()
|
||||
defer fake.loadRoomMutex.RUnlock()
|
||||
argsForCall := fake.loadRoomArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadRoomReturns(result1 *livekit.Room, result2 error) {
|
||||
func (fake *FakeObjectStore) LoadRoomReturns(result1 *livekit.Room, result2 error) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
defer fake.loadRoomMutex.Unlock()
|
||||
fake.LoadRoomStub = nil
|
||||
@@ -525,7 +781,7 @@ func (fake *FakeRoomStore) LoadRoomReturns(result1 *livekit.Room, result2 error)
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LoadRoomReturnsOnCall(i int, result1 *livekit.Room, result2 error) {
|
||||
func (fake *FakeObjectStore) LoadRoomReturnsOnCall(i int, result1 *livekit.Room, result2 error) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
defer fake.loadRoomMutex.Unlock()
|
||||
fake.LoadRoomStub = nil
|
||||
@@ -541,7 +797,7 @@ func (fake *FakeRoomStore) LoadRoomReturnsOnCall(i int, result1 *livekit.Room, r
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LockRoom(arg1 context.Context, arg2 livekit.RoomName, arg3 time.Duration) (string, error) {
|
||||
func (fake *FakeObjectStore) LockRoom(arg1 context.Context, arg2 livekit.RoomName, arg3 time.Duration) (string, error) {
|
||||
fake.lockRoomMutex.Lock()
|
||||
ret, specificReturn := fake.lockRoomReturnsOnCall[len(fake.lockRoomArgsForCall)]
|
||||
fake.lockRoomArgsForCall = append(fake.lockRoomArgsForCall, struct {
|
||||
@@ -562,26 +818,26 @@ func (fake *FakeRoomStore) LockRoom(arg1 context.Context, arg2 livekit.RoomName,
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LockRoomCallCount() int {
|
||||
func (fake *FakeObjectStore) LockRoomCallCount() int {
|
||||
fake.lockRoomMutex.RLock()
|
||||
defer fake.lockRoomMutex.RUnlock()
|
||||
return len(fake.lockRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LockRoomCalls(stub func(context.Context, livekit.RoomName, time.Duration) (string, error)) {
|
||||
func (fake *FakeObjectStore) LockRoomCalls(stub func(context.Context, livekit.RoomName, time.Duration) (string, error)) {
|
||||
fake.lockRoomMutex.Lock()
|
||||
defer fake.lockRoomMutex.Unlock()
|
||||
fake.LockRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LockRoomArgsForCall(i int) (context.Context, livekit.RoomName, time.Duration) {
|
||||
func (fake *FakeObjectStore) LockRoomArgsForCall(i int) (context.Context, livekit.RoomName, time.Duration) {
|
||||
fake.lockRoomMutex.RLock()
|
||||
defer fake.lockRoomMutex.RUnlock()
|
||||
argsForCall := fake.lockRoomArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LockRoomReturns(result1 string, result2 error) {
|
||||
func (fake *FakeObjectStore) LockRoomReturns(result1 string, result2 error) {
|
||||
fake.lockRoomMutex.Lock()
|
||||
defer fake.lockRoomMutex.Unlock()
|
||||
fake.LockRoomStub = nil
|
||||
@@ -591,7 +847,7 @@ func (fake *FakeRoomStore) LockRoomReturns(result1 string, result2 error) {
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) LockRoomReturnsOnCall(i int, result1 string, result2 error) {
|
||||
func (fake *FakeObjectStore) LockRoomReturnsOnCall(i int, result1 string, result2 error) {
|
||||
fake.lockRoomMutex.Lock()
|
||||
defer fake.lockRoomMutex.Unlock()
|
||||
fake.LockRoomStub = nil
|
||||
@@ -607,7 +863,69 @@ func (fake *FakeRoomStore) LockRoomReturnsOnCall(i int, result1 string, result2
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 *livekit.ParticipantInfo) error {
|
||||
func (fake *FakeObjectStore) StoreEgress(arg1 context.Context, arg2 *livekit.EgressInfo) error {
|
||||
fake.storeEgressMutex.Lock()
|
||||
ret, specificReturn := fake.storeEgressReturnsOnCall[len(fake.storeEgressArgsForCall)]
|
||||
fake.storeEgressArgsForCall = append(fake.storeEgressArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.StoreEgressStub
|
||||
fakeReturns := fake.storeEgressReturns
|
||||
fake.recordInvocation("StoreEgress", []interface{}{arg1, arg2})
|
||||
fake.storeEgressMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) StoreEgressCallCount() int {
|
||||
fake.storeEgressMutex.RLock()
|
||||
defer fake.storeEgressMutex.RUnlock()
|
||||
return len(fake.storeEgressArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) StoreEgressCalls(stub func(context.Context, *livekit.EgressInfo) error) {
|
||||
fake.storeEgressMutex.Lock()
|
||||
defer fake.storeEgressMutex.Unlock()
|
||||
fake.StoreEgressStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) StoreEgressArgsForCall(i int) (context.Context, *livekit.EgressInfo) {
|
||||
fake.storeEgressMutex.RLock()
|
||||
defer fake.storeEgressMutex.RUnlock()
|
||||
argsForCall := fake.storeEgressArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) StoreEgressReturns(result1 error) {
|
||||
fake.storeEgressMutex.Lock()
|
||||
defer fake.storeEgressMutex.Unlock()
|
||||
fake.StoreEgressStub = nil
|
||||
fake.storeEgressReturns = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) StoreEgressReturnsOnCall(i int, result1 error) {
|
||||
fake.storeEgressMutex.Lock()
|
||||
defer fake.storeEgressMutex.Unlock()
|
||||
fake.StoreEgressStub = nil
|
||||
if fake.storeEgressReturnsOnCall == nil {
|
||||
fake.storeEgressReturnsOnCall = make(map[int]struct {
|
||||
result1 error
|
||||
})
|
||||
}
|
||||
fake.storeEgressReturnsOnCall[i] = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) StoreParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 *livekit.ParticipantInfo) error {
|
||||
fake.storeParticipantMutex.Lock()
|
||||
ret, specificReturn := fake.storeParticipantReturnsOnCall[len(fake.storeParticipantArgsForCall)]
|
||||
fake.storeParticipantArgsForCall = append(fake.storeParticipantArgsForCall, struct {
|
||||
@@ -628,26 +946,26 @@ func (fake *FakeRoomStore) StoreParticipant(arg1 context.Context, arg2 livekit.R
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreParticipantCallCount() int {
|
||||
func (fake *FakeObjectStore) StoreParticipantCallCount() int {
|
||||
fake.storeParticipantMutex.RLock()
|
||||
defer fake.storeParticipantMutex.RUnlock()
|
||||
return len(fake.storeParticipantArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreParticipantCalls(stub func(context.Context, livekit.RoomName, *livekit.ParticipantInfo) error) {
|
||||
func (fake *FakeObjectStore) StoreParticipantCalls(stub func(context.Context, livekit.RoomName, *livekit.ParticipantInfo) error) {
|
||||
fake.storeParticipantMutex.Lock()
|
||||
defer fake.storeParticipantMutex.Unlock()
|
||||
fake.StoreParticipantStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreParticipantArgsForCall(i int) (context.Context, livekit.RoomName, *livekit.ParticipantInfo) {
|
||||
func (fake *FakeObjectStore) StoreParticipantArgsForCall(i int) (context.Context, livekit.RoomName, *livekit.ParticipantInfo) {
|
||||
fake.storeParticipantMutex.RLock()
|
||||
defer fake.storeParticipantMutex.RUnlock()
|
||||
argsForCall := fake.storeParticipantArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreParticipantReturns(result1 error) {
|
||||
func (fake *FakeObjectStore) StoreParticipantReturns(result1 error) {
|
||||
fake.storeParticipantMutex.Lock()
|
||||
defer fake.storeParticipantMutex.Unlock()
|
||||
fake.StoreParticipantStub = nil
|
||||
@@ -656,7 +974,7 @@ func (fake *FakeRoomStore) StoreParticipantReturns(result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreParticipantReturnsOnCall(i int, result1 error) {
|
||||
func (fake *FakeObjectStore) StoreParticipantReturnsOnCall(i int, result1 error) {
|
||||
fake.storeParticipantMutex.Lock()
|
||||
defer fake.storeParticipantMutex.Unlock()
|
||||
fake.StoreParticipantStub = nil
|
||||
@@ -670,7 +988,7 @@ func (fake *FakeRoomStore) StoreParticipantReturnsOnCall(i int, result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreRoom(arg1 context.Context, arg2 *livekit.Room) error {
|
||||
func (fake *FakeObjectStore) StoreRoom(arg1 context.Context, arg2 *livekit.Room) error {
|
||||
fake.storeRoomMutex.Lock()
|
||||
ret, specificReturn := fake.storeRoomReturnsOnCall[len(fake.storeRoomArgsForCall)]
|
||||
fake.storeRoomArgsForCall = append(fake.storeRoomArgsForCall, struct {
|
||||
@@ -690,26 +1008,26 @@ func (fake *FakeRoomStore) StoreRoom(arg1 context.Context, arg2 *livekit.Room) e
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreRoomCallCount() int {
|
||||
func (fake *FakeObjectStore) StoreRoomCallCount() int {
|
||||
fake.storeRoomMutex.RLock()
|
||||
defer fake.storeRoomMutex.RUnlock()
|
||||
return len(fake.storeRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreRoomCalls(stub func(context.Context, *livekit.Room) error) {
|
||||
func (fake *FakeObjectStore) StoreRoomCalls(stub func(context.Context, *livekit.Room) error) {
|
||||
fake.storeRoomMutex.Lock()
|
||||
defer fake.storeRoomMutex.Unlock()
|
||||
fake.StoreRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreRoomArgsForCall(i int) (context.Context, *livekit.Room) {
|
||||
func (fake *FakeObjectStore) StoreRoomArgsForCall(i int) (context.Context, *livekit.Room) {
|
||||
fake.storeRoomMutex.RLock()
|
||||
defer fake.storeRoomMutex.RUnlock()
|
||||
argsForCall := fake.storeRoomArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreRoomReturns(result1 error) {
|
||||
func (fake *FakeObjectStore) StoreRoomReturns(result1 error) {
|
||||
fake.storeRoomMutex.Lock()
|
||||
defer fake.storeRoomMutex.Unlock()
|
||||
fake.StoreRoomStub = nil
|
||||
@@ -718,7 +1036,7 @@ func (fake *FakeRoomStore) StoreRoomReturns(result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) StoreRoomReturnsOnCall(i int, result1 error) {
|
||||
func (fake *FakeObjectStore) StoreRoomReturnsOnCall(i int, result1 error) {
|
||||
fake.storeRoomMutex.Lock()
|
||||
defer fake.storeRoomMutex.Unlock()
|
||||
fake.StoreRoomStub = nil
|
||||
@@ -732,7 +1050,7 @@ func (fake *FakeRoomStore) StoreRoomReturnsOnCall(i int, result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) UnlockRoom(arg1 context.Context, arg2 livekit.RoomName, arg3 string) error {
|
||||
func (fake *FakeObjectStore) UnlockRoom(arg1 context.Context, arg2 livekit.RoomName, arg3 string) error {
|
||||
fake.unlockRoomMutex.Lock()
|
||||
ret, specificReturn := fake.unlockRoomReturnsOnCall[len(fake.unlockRoomArgsForCall)]
|
||||
fake.unlockRoomArgsForCall = append(fake.unlockRoomArgsForCall, struct {
|
||||
@@ -753,26 +1071,26 @@ func (fake *FakeRoomStore) UnlockRoom(arg1 context.Context, arg2 livekit.RoomNam
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) UnlockRoomCallCount() int {
|
||||
func (fake *FakeObjectStore) UnlockRoomCallCount() int {
|
||||
fake.unlockRoomMutex.RLock()
|
||||
defer fake.unlockRoomMutex.RUnlock()
|
||||
return len(fake.unlockRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) UnlockRoomCalls(stub func(context.Context, livekit.RoomName, string) error) {
|
||||
func (fake *FakeObjectStore) UnlockRoomCalls(stub func(context.Context, livekit.RoomName, string) error) {
|
||||
fake.unlockRoomMutex.Lock()
|
||||
defer fake.unlockRoomMutex.Unlock()
|
||||
fake.UnlockRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) UnlockRoomArgsForCall(i int) (context.Context, livekit.RoomName, string) {
|
||||
func (fake *FakeObjectStore) UnlockRoomArgsForCall(i int) (context.Context, livekit.RoomName, string) {
|
||||
fake.unlockRoomMutex.RLock()
|
||||
defer fake.unlockRoomMutex.RUnlock()
|
||||
argsForCall := fake.unlockRoomArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) UnlockRoomReturns(result1 error) {
|
||||
func (fake *FakeObjectStore) UnlockRoomReturns(result1 error) {
|
||||
fake.unlockRoomMutex.Lock()
|
||||
defer fake.unlockRoomMutex.Unlock()
|
||||
fake.UnlockRoomStub = nil
|
||||
@@ -781,7 +1099,7 @@ func (fake *FakeRoomStore) UnlockRoomReturns(result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) UnlockRoomReturnsOnCall(i int, result1 error) {
|
||||
func (fake *FakeObjectStore) UnlockRoomReturnsOnCall(i int, result1 error) {
|
||||
fake.unlockRoomMutex.Lock()
|
||||
defer fake.unlockRoomMutex.Unlock()
|
||||
fake.UnlockRoomStub = nil
|
||||
@@ -795,29 +1113,101 @@ func (fake *FakeRoomStore) UnlockRoomReturnsOnCall(i int, result1 error) {
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) Invocations() map[string][][]interface{} {
|
||||
func (fake *FakeObjectStore) UpdateEgress(arg1 context.Context, arg2 *livekit.EgressInfo) error {
|
||||
fake.updateEgressMutex.Lock()
|
||||
ret, specificReturn := fake.updateEgressReturnsOnCall[len(fake.updateEgressArgsForCall)]
|
||||
fake.updateEgressArgsForCall = append(fake.updateEgressArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.UpdateEgressStub
|
||||
fakeReturns := fake.updateEgressReturns
|
||||
fake.recordInvocation("UpdateEgress", []interface{}{arg1, arg2})
|
||||
fake.updateEgressMutex.Unlock()
|
||||
if stub != nil {
|
||||
return stub(arg1, arg2)
|
||||
}
|
||||
if specificReturn {
|
||||
return ret.result1
|
||||
}
|
||||
return fakeReturns.result1
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) UpdateEgressCallCount() int {
|
||||
fake.updateEgressMutex.RLock()
|
||||
defer fake.updateEgressMutex.RUnlock()
|
||||
return len(fake.updateEgressArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) UpdateEgressCalls(stub func(context.Context, *livekit.EgressInfo) error) {
|
||||
fake.updateEgressMutex.Lock()
|
||||
defer fake.updateEgressMutex.Unlock()
|
||||
fake.UpdateEgressStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) UpdateEgressArgsForCall(i int) (context.Context, *livekit.EgressInfo) {
|
||||
fake.updateEgressMutex.RLock()
|
||||
defer fake.updateEgressMutex.RUnlock()
|
||||
argsForCall := fake.updateEgressArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) UpdateEgressReturns(result1 error) {
|
||||
fake.updateEgressMutex.Lock()
|
||||
defer fake.updateEgressMutex.Unlock()
|
||||
fake.UpdateEgressStub = nil
|
||||
fake.updateEgressReturns = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) UpdateEgressReturnsOnCall(i int, result1 error) {
|
||||
fake.updateEgressMutex.Lock()
|
||||
defer fake.updateEgressMutex.Unlock()
|
||||
fake.UpdateEgressStub = nil
|
||||
if fake.updateEgressReturnsOnCall == nil {
|
||||
fake.updateEgressReturnsOnCall = make(map[int]struct {
|
||||
result1 error
|
||||
})
|
||||
}
|
||||
fake.updateEgressReturnsOnCall[i] = struct {
|
||||
result1 error
|
||||
}{result1}
|
||||
}
|
||||
|
||||
func (fake *FakeObjectStore) Invocations() map[string][][]interface{} {
|
||||
fake.invocationsMutex.RLock()
|
||||
defer fake.invocationsMutex.RUnlock()
|
||||
fake.deleteEgressMutex.RLock()
|
||||
defer fake.deleteEgressMutex.RUnlock()
|
||||
fake.deleteParticipantMutex.RLock()
|
||||
defer fake.deleteParticipantMutex.RUnlock()
|
||||
fake.deleteRoomMutex.RLock()
|
||||
defer fake.deleteRoomMutex.RUnlock()
|
||||
fake.listEgressMutex.RLock()
|
||||
defer fake.listEgressMutex.RUnlock()
|
||||
fake.listParticipantsMutex.RLock()
|
||||
defer fake.listParticipantsMutex.RUnlock()
|
||||
fake.listRoomsMutex.RLock()
|
||||
defer fake.listRoomsMutex.RUnlock()
|
||||
fake.loadEgressMutex.RLock()
|
||||
defer fake.loadEgressMutex.RUnlock()
|
||||
fake.loadParticipantMutex.RLock()
|
||||
defer fake.loadParticipantMutex.RUnlock()
|
||||
fake.loadRoomMutex.RLock()
|
||||
defer fake.loadRoomMutex.RUnlock()
|
||||
fake.lockRoomMutex.RLock()
|
||||
defer fake.lockRoomMutex.RUnlock()
|
||||
fake.storeEgressMutex.RLock()
|
||||
defer fake.storeEgressMutex.RUnlock()
|
||||
fake.storeParticipantMutex.RLock()
|
||||
defer fake.storeParticipantMutex.RUnlock()
|
||||
fake.storeRoomMutex.RLock()
|
||||
defer fake.storeRoomMutex.RUnlock()
|
||||
fake.unlockRoomMutex.RLock()
|
||||
defer fake.unlockRoomMutex.RUnlock()
|
||||
fake.updateEgressMutex.RLock()
|
||||
defer fake.updateEgressMutex.RUnlock()
|
||||
copiedInvocations := map[string][][]interface{}{}
|
||||
for key, value := range fake.invocations {
|
||||
copiedInvocations[key] = value
|
||||
@@ -825,7 +1215,7 @@ func (fake *FakeRoomStore) Invocations() map[string][][]interface{} {
|
||||
return copiedInvocations
|
||||
}
|
||||
|
||||
func (fake *FakeRoomStore) recordInvocation(key string, args []interface{}) {
|
||||
func (fake *FakeObjectStore) recordInvocation(key string, args []interface{}) {
|
||||
fake.invocationsMutex.Lock()
|
||||
defer fake.invocationsMutex.Unlock()
|
||||
if fake.invocations == nil {
|
||||
@@ -837,4 +1227,4 @@ func (fake *FakeRoomStore) recordInvocation(key string, args []interface{}) {
|
||||
fake.invocations[key] = append(fake.invocations[key], args)
|
||||
}
|
||||
|
||||
var _ service.RoomStore = new(FakeRoomStore)
|
||||
var _ service.ObjectStore = new(FakeObjectStore)
|
||||
+28
-28
@@ -9,7 +9,7 @@ import (
|
||||
"github.com/livekit/protocol/livekit"
|
||||
)
|
||||
|
||||
type FakeRORoomStore struct {
|
||||
type FakeServiceStore struct {
|
||||
ListParticipantsStub func(context.Context, livekit.RoomName) ([]*livekit.ParticipantInfo, error)
|
||||
listParticipantsMutex sync.RWMutex
|
||||
listParticipantsArgsForCall []struct {
|
||||
@@ -71,7 +71,7 @@ type FakeRORoomStore struct {
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListParticipants(arg1 context.Context, arg2 livekit.RoomName) ([]*livekit.ParticipantInfo, error) {
|
||||
func (fake *FakeServiceStore) ListParticipants(arg1 context.Context, arg2 livekit.RoomName) ([]*livekit.ParticipantInfo, error) {
|
||||
fake.listParticipantsMutex.Lock()
|
||||
ret, specificReturn := fake.listParticipantsReturnsOnCall[len(fake.listParticipantsArgsForCall)]
|
||||
fake.listParticipantsArgsForCall = append(fake.listParticipantsArgsForCall, struct {
|
||||
@@ -91,26 +91,26 @@ func (fake *FakeRORoomStore) ListParticipants(arg1 context.Context, arg2 livekit
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListParticipantsCallCount() int {
|
||||
func (fake *FakeServiceStore) ListParticipantsCallCount() int {
|
||||
fake.listParticipantsMutex.RLock()
|
||||
defer fake.listParticipantsMutex.RUnlock()
|
||||
return len(fake.listParticipantsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListParticipantsCalls(stub func(context.Context, livekit.RoomName) ([]*livekit.ParticipantInfo, error)) {
|
||||
func (fake *FakeServiceStore) ListParticipantsCalls(stub func(context.Context, livekit.RoomName) ([]*livekit.ParticipantInfo, error)) {
|
||||
fake.listParticipantsMutex.Lock()
|
||||
defer fake.listParticipantsMutex.Unlock()
|
||||
fake.ListParticipantsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListParticipantsArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
func (fake *FakeServiceStore) ListParticipantsArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.listParticipantsMutex.RLock()
|
||||
defer fake.listParticipantsMutex.RUnlock()
|
||||
argsForCall := fake.listParticipantsArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListParticipantsReturns(result1 []*livekit.ParticipantInfo, result2 error) {
|
||||
func (fake *FakeServiceStore) ListParticipantsReturns(result1 []*livekit.ParticipantInfo, result2 error) {
|
||||
fake.listParticipantsMutex.Lock()
|
||||
defer fake.listParticipantsMutex.Unlock()
|
||||
fake.ListParticipantsStub = nil
|
||||
@@ -120,7 +120,7 @@ func (fake *FakeRORoomStore) ListParticipantsReturns(result1 []*livekit.Particip
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListParticipantsReturnsOnCall(i int, result1 []*livekit.ParticipantInfo, result2 error) {
|
||||
func (fake *FakeServiceStore) ListParticipantsReturnsOnCall(i int, result1 []*livekit.ParticipantInfo, result2 error) {
|
||||
fake.listParticipantsMutex.Lock()
|
||||
defer fake.listParticipantsMutex.Unlock()
|
||||
fake.ListParticipantsStub = nil
|
||||
@@ -136,7 +136,7 @@ func (fake *FakeRORoomStore) ListParticipantsReturnsOnCall(i int, result1 []*liv
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListRooms(arg1 context.Context, arg2 []livekit.RoomName) ([]*livekit.Room, error) {
|
||||
func (fake *FakeServiceStore) ListRooms(arg1 context.Context, arg2 []livekit.RoomName) ([]*livekit.Room, error) {
|
||||
var arg2Copy []livekit.RoomName
|
||||
if arg2 != nil {
|
||||
arg2Copy = make([]livekit.RoomName, len(arg2))
|
||||
@@ -161,26 +161,26 @@ func (fake *FakeRORoomStore) ListRooms(arg1 context.Context, arg2 []livekit.Room
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListRoomsCallCount() int {
|
||||
func (fake *FakeServiceStore) ListRoomsCallCount() int {
|
||||
fake.listRoomsMutex.RLock()
|
||||
defer fake.listRoomsMutex.RUnlock()
|
||||
return len(fake.listRoomsArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListRoomsCalls(stub func(context.Context, []livekit.RoomName) ([]*livekit.Room, error)) {
|
||||
func (fake *FakeServiceStore) ListRoomsCalls(stub func(context.Context, []livekit.RoomName) ([]*livekit.Room, error)) {
|
||||
fake.listRoomsMutex.Lock()
|
||||
defer fake.listRoomsMutex.Unlock()
|
||||
fake.ListRoomsStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListRoomsArgsForCall(i int) (context.Context, []livekit.RoomName) {
|
||||
func (fake *FakeServiceStore) ListRoomsArgsForCall(i int) (context.Context, []livekit.RoomName) {
|
||||
fake.listRoomsMutex.RLock()
|
||||
defer fake.listRoomsMutex.RUnlock()
|
||||
argsForCall := fake.listRoomsArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListRoomsReturns(result1 []*livekit.Room, result2 error) {
|
||||
func (fake *FakeServiceStore) ListRoomsReturns(result1 []*livekit.Room, result2 error) {
|
||||
fake.listRoomsMutex.Lock()
|
||||
defer fake.listRoomsMutex.Unlock()
|
||||
fake.ListRoomsStub = nil
|
||||
@@ -190,7 +190,7 @@ func (fake *FakeRORoomStore) ListRoomsReturns(result1 []*livekit.Room, result2 e
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) ListRoomsReturnsOnCall(i int, result1 []*livekit.Room, result2 error) {
|
||||
func (fake *FakeServiceStore) ListRoomsReturnsOnCall(i int, result1 []*livekit.Room, result2 error) {
|
||||
fake.listRoomsMutex.Lock()
|
||||
defer fake.listRoomsMutex.Unlock()
|
||||
fake.ListRoomsStub = nil
|
||||
@@ -206,7 +206,7 @@ func (fake *FakeRORoomStore) ListRoomsReturnsOnCall(i int, result1 []*livekit.Ro
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
|
||||
func (fake *FakeServiceStore) LoadParticipant(arg1 context.Context, arg2 livekit.RoomName, arg3 livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error) {
|
||||
fake.loadParticipantMutex.Lock()
|
||||
ret, specificReturn := fake.loadParticipantReturnsOnCall[len(fake.loadParticipantArgsForCall)]
|
||||
fake.loadParticipantArgsForCall = append(fake.loadParticipantArgsForCall, struct {
|
||||
@@ -227,26 +227,26 @@ func (fake *FakeRORoomStore) LoadParticipant(arg1 context.Context, arg2 livekit.
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadParticipantCallCount() int {
|
||||
func (fake *FakeServiceStore) LoadParticipantCallCount() int {
|
||||
fake.loadParticipantMutex.RLock()
|
||||
defer fake.loadParticipantMutex.RUnlock()
|
||||
return len(fake.loadParticipantArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadParticipantCalls(stub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error)) {
|
||||
func (fake *FakeServiceStore) LoadParticipantCalls(stub func(context.Context, livekit.RoomName, livekit.ParticipantIdentity) (*livekit.ParticipantInfo, error)) {
|
||||
fake.loadParticipantMutex.Lock()
|
||||
defer fake.loadParticipantMutex.Unlock()
|
||||
fake.LoadParticipantStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadParticipantArgsForCall(i int) (context.Context, livekit.RoomName, livekit.ParticipantIdentity) {
|
||||
func (fake *FakeServiceStore) LoadParticipantArgsForCall(i int) (context.Context, livekit.RoomName, livekit.ParticipantIdentity) {
|
||||
fake.loadParticipantMutex.RLock()
|
||||
defer fake.loadParticipantMutex.RUnlock()
|
||||
argsForCall := fake.loadParticipantArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadParticipantReturns(result1 *livekit.ParticipantInfo, result2 error) {
|
||||
func (fake *FakeServiceStore) LoadParticipantReturns(result1 *livekit.ParticipantInfo, result2 error) {
|
||||
fake.loadParticipantMutex.Lock()
|
||||
defer fake.loadParticipantMutex.Unlock()
|
||||
fake.LoadParticipantStub = nil
|
||||
@@ -256,7 +256,7 @@ func (fake *FakeRORoomStore) LoadParticipantReturns(result1 *livekit.Participant
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadParticipantReturnsOnCall(i int, result1 *livekit.ParticipantInfo, result2 error) {
|
||||
func (fake *FakeServiceStore) LoadParticipantReturnsOnCall(i int, result1 *livekit.ParticipantInfo, result2 error) {
|
||||
fake.loadParticipantMutex.Lock()
|
||||
defer fake.loadParticipantMutex.Unlock()
|
||||
fake.LoadParticipantStub = nil
|
||||
@@ -272,7 +272,7 @@ func (fake *FakeRORoomStore) LoadParticipantReturnsOnCall(i int, result1 *liveki
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadRoom(arg1 context.Context, arg2 livekit.RoomName) (*livekit.Room, error) {
|
||||
func (fake *FakeServiceStore) LoadRoom(arg1 context.Context, arg2 livekit.RoomName) (*livekit.Room, error) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
ret, specificReturn := fake.loadRoomReturnsOnCall[len(fake.loadRoomArgsForCall)]
|
||||
fake.loadRoomArgsForCall = append(fake.loadRoomArgsForCall, struct {
|
||||
@@ -292,26 +292,26 @@ func (fake *FakeRORoomStore) LoadRoom(arg1 context.Context, arg2 livekit.RoomNam
|
||||
return fakeReturns.result1, fakeReturns.result2
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadRoomCallCount() int {
|
||||
func (fake *FakeServiceStore) LoadRoomCallCount() int {
|
||||
fake.loadRoomMutex.RLock()
|
||||
defer fake.loadRoomMutex.RUnlock()
|
||||
return len(fake.loadRoomArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadRoomCalls(stub func(context.Context, livekit.RoomName) (*livekit.Room, error)) {
|
||||
func (fake *FakeServiceStore) LoadRoomCalls(stub func(context.Context, livekit.RoomName) (*livekit.Room, error)) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
defer fake.loadRoomMutex.Unlock()
|
||||
fake.LoadRoomStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadRoomArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
func (fake *FakeServiceStore) LoadRoomArgsForCall(i int) (context.Context, livekit.RoomName) {
|
||||
fake.loadRoomMutex.RLock()
|
||||
defer fake.loadRoomMutex.RUnlock()
|
||||
argsForCall := fake.loadRoomArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadRoomReturns(result1 *livekit.Room, result2 error) {
|
||||
func (fake *FakeServiceStore) LoadRoomReturns(result1 *livekit.Room, result2 error) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
defer fake.loadRoomMutex.Unlock()
|
||||
fake.LoadRoomStub = nil
|
||||
@@ -321,7 +321,7 @@ func (fake *FakeRORoomStore) LoadRoomReturns(result1 *livekit.Room, result2 erro
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) LoadRoomReturnsOnCall(i int, result1 *livekit.Room, result2 error) {
|
||||
func (fake *FakeServiceStore) LoadRoomReturnsOnCall(i int, result1 *livekit.Room, result2 error) {
|
||||
fake.loadRoomMutex.Lock()
|
||||
defer fake.loadRoomMutex.Unlock()
|
||||
fake.LoadRoomStub = nil
|
||||
@@ -337,7 +337,7 @@ func (fake *FakeRORoomStore) LoadRoomReturnsOnCall(i int, result1 *livekit.Room,
|
||||
}{result1, result2}
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) Invocations() map[string][][]interface{} {
|
||||
func (fake *FakeServiceStore) Invocations() map[string][][]interface{} {
|
||||
fake.invocationsMutex.RLock()
|
||||
defer fake.invocationsMutex.RUnlock()
|
||||
fake.listParticipantsMutex.RLock()
|
||||
@@ -355,7 +355,7 @@ func (fake *FakeRORoomStore) Invocations() map[string][][]interface{} {
|
||||
return copiedInvocations
|
||||
}
|
||||
|
||||
func (fake *FakeRORoomStore) recordInvocation(key string, args []interface{}) {
|
||||
func (fake *FakeServiceStore) recordInvocation(key string, args []interface{}) {
|
||||
fake.invocationsMutex.Lock()
|
||||
defer fake.invocationsMutex.Unlock()
|
||||
if fake.invocations == nil {
|
||||
@@ -367,4 +367,4 @@ func (fake *FakeRORoomStore) recordInvocation(key string, args []interface{}) {
|
||||
fake.invocations[key] = append(fake.invocations[key], args)
|
||||
}
|
||||
|
||||
var _ service.RORoomStore = new(FakeRORoomStore)
|
||||
var _ service.ServiceStore = new(FakeServiceStore)
|
||||
+1
-1
@@ -109,7 +109,7 @@ func NewTurnServer(conf *config.Config, authHandler turn.AuthHandler) (*turn.Ser
|
||||
return turn.NewServer(serverConfig)
|
||||
}
|
||||
|
||||
func newTurnAuthHandler(roomStore RoomStore) turn.AuthHandler {
|
||||
func newTurnAuthHandler(roomStore ObjectStore) turn.AuthHandler {
|
||||
return func(username, realm string, srcAddr net.Addr) (key []byte, ok bool) {
|
||||
// room id should be the username, create a hashed room id
|
||||
rm, err := roomStore.LoadRoom(context.Background(), livekit.RoomName(username))
|
||||
|
||||
+6
-4
@@ -28,7 +28,8 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
||||
createRedisClient,
|
||||
createMessageBus,
|
||||
createStore,
|
||||
wire.Bind(new(RORoomStore), new(RoomStore)),
|
||||
wire.Bind(new(ServiceStore), new(ObjectStore)),
|
||||
wire.Bind(new(EgressStore), new(ObjectStore)),
|
||||
createKeyProvider,
|
||||
createWebhookNotifier,
|
||||
routing.CreateRouter,
|
||||
@@ -36,6 +37,7 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
||||
wire.Bind(new(livekit.RoomService), new(*RoomService)),
|
||||
telemetry.NewAnalyticsService,
|
||||
telemetry.NewTelemetryService,
|
||||
NewEgressService,
|
||||
NewRecordingService,
|
||||
NewRoomAllocator,
|
||||
NewRoomService,
|
||||
@@ -125,9 +127,9 @@ func createMessageBus(rc *redis.Client) utils.MessageBus {
|
||||
return utils.NewRedisMessageBus(rc)
|
||||
}
|
||||
|
||||
func createStore(rc *redis.Client) RoomStore {
|
||||
func createStore(rc *redis.Client) ObjectStore {
|
||||
if rc != nil {
|
||||
return NewRedisRoomStore(rc)
|
||||
return NewRedisStore(rc)
|
||||
}
|
||||
return NewLocalRoomStore()
|
||||
return NewLocalStore()
|
||||
}
|
||||
|
||||
+12
-12
@@ -1,8 +1,7 @@
|
||||
// Code generated by Wire. DO NOT EDIT.
|
||||
|
||||
//go:generate go run github.com/google/wire/cmd/wire
|
||||
//go:build !wireinject
|
||||
// +build !wireinject
|
||||
//+build !wireinject
|
||||
|
||||
package service
|
||||
|
||||
@@ -30,12 +29,12 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
||||
return nil, err
|
||||
}
|
||||
router := routing.CreateRouter(client, currentNode)
|
||||
roomStore := createStore(client)
|
||||
roomAllocator, err := NewRoomAllocator(conf, router, roomStore)
|
||||
objectStore := createStore(client)
|
||||
roomAllocator, err := NewRoomAllocator(conf, router, objectStore)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
roomService, err := NewRoomService(roomAllocator, roomStore, router)
|
||||
roomService, err := NewRoomService(roomAllocator, objectStore, router)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -50,18 +49,19 @@ func InitializeServer(conf *config.Config, currentNode routing.LocalNode) (*Live
|
||||
}
|
||||
analyticsService := telemetry.NewAnalyticsService(conf, currentNode)
|
||||
telemetryService := telemetry.NewTelemetryService(notifier, analyticsService)
|
||||
egressService := NewEgressService(messageBus, objectStore, roomService, telemetryService)
|
||||
recordingService := NewRecordingService(messageBus, telemetryService)
|
||||
rtcService := NewRTCService(conf, roomAllocator, roomStore, router, currentNode)
|
||||
roomManager, err := NewLocalRoomManager(conf, roomStore, currentNode, router, telemetryService)
|
||||
rtcService := NewRTCService(conf, roomAllocator, objectStore, router, currentNode)
|
||||
roomManager, err := NewLocalRoomManager(conf, objectStore, currentNode, router, telemetryService)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
authHandler := newTurnAuthHandler(roomStore)
|
||||
authHandler := newTurnAuthHandler(objectStore)
|
||||
server, err := NewTurnServer(conf, authHandler)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
livekitServer, err := NewLivekitServer(conf, roomService, recordingService, rtcService, keyProvider, router, roomManager, server, currentNode)
|
||||
livekitServer, err := NewLivekitServer(conf, roomService, egressService, recordingService, rtcService, keyProvider, router, roomManager, server, currentNode)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -146,9 +146,9 @@ func createMessageBus(rc *redis.Client) utils.MessageBus {
|
||||
return utils.NewRedisMessageBus(rc)
|
||||
}
|
||||
|
||||
func createStore(rc *redis.Client) RoomStore {
|
||||
func createStore(rc *redis.Client) ObjectStore {
|
||||
if rc != nil {
|
||||
return NewRedisRoomStore(rc)
|
||||
return NewRedisStore(rc)
|
||||
}
|
||||
return NewLocalRoomStore()
|
||||
return NewLocalStore()
|
||||
}
|
||||
|
||||
@@ -10,6 +10,18 @@ import (
|
||||
)
|
||||
|
||||
type FakeTelemetryService struct {
|
||||
EgressEndedStub func(context.Context, *livekit.EgressInfo)
|
||||
egressEndedMutex sync.RWMutex
|
||||
egressEndedArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}
|
||||
EgressStartedStub func(context.Context, *livekit.EgressInfo)
|
||||
egressStartedMutex sync.RWMutex
|
||||
egressStartedArgsForCall []struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}
|
||||
ParticipantActiveStub func(context.Context, livekit.ParticipantID, *livekit.AnalyticsClientMeta)
|
||||
participantActiveMutex sync.RWMutex
|
||||
participantActiveArgsForCall []struct {
|
||||
@@ -113,6 +125,72 @@ type FakeTelemetryService struct {
|
||||
invocationsMutex sync.RWMutex
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) EgressEnded(arg1 context.Context, arg2 *livekit.EgressInfo) {
|
||||
fake.egressEndedMutex.Lock()
|
||||
fake.egressEndedArgsForCall = append(fake.egressEndedArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.EgressEndedStub
|
||||
fake.recordInvocation("EgressEnded", []interface{}{arg1, arg2})
|
||||
fake.egressEndedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.EgressEndedStub(arg1, arg2)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) EgressEndedCallCount() int {
|
||||
fake.egressEndedMutex.RLock()
|
||||
defer fake.egressEndedMutex.RUnlock()
|
||||
return len(fake.egressEndedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) EgressEndedCalls(stub func(context.Context, *livekit.EgressInfo)) {
|
||||
fake.egressEndedMutex.Lock()
|
||||
defer fake.egressEndedMutex.Unlock()
|
||||
fake.EgressEndedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) EgressEndedArgsForCall(i int) (context.Context, *livekit.EgressInfo) {
|
||||
fake.egressEndedMutex.RLock()
|
||||
defer fake.egressEndedMutex.RUnlock()
|
||||
argsForCall := fake.egressEndedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) EgressStarted(arg1 context.Context, arg2 *livekit.EgressInfo) {
|
||||
fake.egressStartedMutex.Lock()
|
||||
fake.egressStartedArgsForCall = append(fake.egressStartedArgsForCall, struct {
|
||||
arg1 context.Context
|
||||
arg2 *livekit.EgressInfo
|
||||
}{arg1, arg2})
|
||||
stub := fake.EgressStartedStub
|
||||
fake.recordInvocation("EgressStarted", []interface{}{arg1, arg2})
|
||||
fake.egressStartedMutex.Unlock()
|
||||
if stub != nil {
|
||||
fake.EgressStartedStub(arg1, arg2)
|
||||
}
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) EgressStartedCallCount() int {
|
||||
fake.egressStartedMutex.RLock()
|
||||
defer fake.egressStartedMutex.RUnlock()
|
||||
return len(fake.egressStartedArgsForCall)
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) EgressStartedCalls(stub func(context.Context, *livekit.EgressInfo)) {
|
||||
fake.egressStartedMutex.Lock()
|
||||
defer fake.egressStartedMutex.Unlock()
|
||||
fake.EgressStartedStub = stub
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) EgressStartedArgsForCall(i int) (context.Context, *livekit.EgressInfo) {
|
||||
fake.egressStartedMutex.RLock()
|
||||
defer fake.egressStartedMutex.RUnlock()
|
||||
argsForCall := fake.egressStartedArgsForCall[i]
|
||||
return argsForCall.arg1, argsForCall.arg2
|
||||
}
|
||||
|
||||
func (fake *FakeTelemetryService) ParticipantActive(arg1 context.Context, arg2 livekit.ParticipantID, arg3 *livekit.AnalyticsClientMeta) {
|
||||
fake.participantActiveMutex.Lock()
|
||||
fake.participantActiveArgsForCall = append(fake.participantActiveArgsForCall, struct {
|
||||
@@ -593,6 +671,10 @@ func (fake *FakeTelemetryService) TrackUnsubscribedArgsForCall(i int) (context.C
|
||||
func (fake *FakeTelemetryService) Invocations() map[string][][]interface{} {
|
||||
fake.invocationsMutex.RLock()
|
||||
defer fake.invocationsMutex.RUnlock()
|
||||
fake.egressEndedMutex.RLock()
|
||||
defer fake.egressEndedMutex.RUnlock()
|
||||
fake.egressStartedMutex.RLock()
|
||||
defer fake.egressStartedMutex.RUnlock()
|
||||
fake.participantActiveMutex.RLock()
|
||||
defer fake.participantActiveMutex.RUnlock()
|
||||
fake.participantJoinedMutex.RLock()
|
||||
|
||||
@@ -29,6 +29,8 @@ type TelemetryService interface {
|
||||
RecordingStarted(ctx context.Context, ri *livekit.RecordingInfo)
|
||||
RecordingEnded(ctx context.Context, ri *livekit.RecordingInfo)
|
||||
ParticipantActive(ctx context.Context, participantID livekit.ParticipantID, clientMeta *livekit.AnalyticsClientMeta)
|
||||
EgressStarted(ctx context.Context, info *livekit.EgressInfo)
|
||||
EgressEnded(ctx context.Context, info *livekit.EgressInfo)
|
||||
}
|
||||
|
||||
type doWorkFunc func()
|
||||
@@ -150,3 +152,15 @@ func (t *telemetryService) TrackMaxSubscribedVideoQuality(ctx context.Context, p
|
||||
t.internalService.TrackMaxSubscribedVideoQuality(ctx, participantID, track, maxQuality)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *telemetryService) EgressStarted(ctx context.Context, info *livekit.EgressInfo) {
|
||||
t.jobQueue <- func() {
|
||||
t.internalService.EgressStarted(ctx, info)
|
||||
}
|
||||
}
|
||||
|
||||
func (t *telemetryService) EgressEnded(ctx context.Context, info *livekit.EgressInfo) {
|
||||
t.jobQueue <- func() {
|
||||
t.internalService.EgressEnded(ctx, info)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -247,3 +247,31 @@ func (t *telemetryServiceInternal) ParticipantActive(ctx context.Context, partic
|
||||
ClientMeta: clientMeta,
|
||||
})
|
||||
}
|
||||
|
||||
func (t *telemetryServiceInternal) EgressStarted(ctx context.Context, info *livekit.EgressInfo) {
|
||||
t.notifyEvent(ctx, &livekit.WebhookEvent{
|
||||
Event: webhook.EventEgressStarted,
|
||||
EgressInfo: info,
|
||||
})
|
||||
|
||||
t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_EGRESS_STARTED,
|
||||
Timestamp: timestamppb.Now(),
|
||||
EgressId: info.EgressId,
|
||||
RoomId: info.RoomId,
|
||||
})
|
||||
}
|
||||
|
||||
func (t *telemetryServiceInternal) EgressEnded(ctx context.Context, info *livekit.EgressInfo) {
|
||||
t.notifyEvent(ctx, &livekit.WebhookEvent{
|
||||
Event: webhook.EventEgressEnded,
|
||||
EgressInfo: info,
|
||||
})
|
||||
|
||||
t.analytics.SendEvent(ctx, &livekit.AnalyticsEvent{
|
||||
Type: livekit.AnalyticsEventType_EGRESS_ENDED,
|
||||
Timestamp: timestamppb.Now(),
|
||||
EgressId: info.EgressId,
|
||||
RoomId: info.RoomId,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user