redis based router & roomstore

This commit is contained in:
David Zhao
2021-01-17 00:12:05 -08:00
parent 9064f6ade1
commit 30e99e8c6b
28 changed files with 1559 additions and 404 deletions
+11 -7
View File
@@ -1,6 +1,8 @@
package routing
import (
"google.golang.org/protobuf/proto"
"github.com/livekit/livekit-server/proto/livekit"
)
@@ -9,13 +11,14 @@ import (
// routes signaling message
//counterfeiter:generate . MessageSink
type MessageSink interface {
WriteMessage(msg interface{}) error
WriteMessage(msg proto.Message) error
Close()
OnClose(f func())
}
//counterfeiter:generate . MessageSource
type MessageSource interface {
ReadMessage() (interface{}, error)
ReadMessage() (proto.Message, error)
}
type ParticipantCallback func(roomId, participantId, participantName string, requestSource MessageSource, responseSink MessageSink)
@@ -23,14 +26,15 @@ type ParticipantCallback func(roomId, participantId, participantName string, req
//counterfeiter:generate . Router
type Router interface {
GetNodeIdForRoom(roomName string) (string, error)
RegisterNode(node *livekit.Node) error
RegisterNode() error
UnregisterNode() error
GetNode(nodeId string) (*livekit.Node, error)
StartParticipant(roomName, participantId, participantName, nodeId string) error
SetRTCNode(participantId, nodeId string) error
SetParticipantRTCNode(participantId, nodeId string) error
// functions for websocket handler
GetRequestSink(participantId string) MessageSink
GetResponseSource(participantId string) MessageSource
GetRequestSink(participantId string) (MessageSink, error)
GetResponseSource(participantId string) (MessageSource, error)
StartParticipant(roomName, participantId, participantName string) error
OnNewParticipant(callback ParticipantCallback)
Start() error