Updated egress rpc (#1252)

* updated egress rpc

* check if egress exists on stop

* fix static check

* remove old migration code

* rename

* regenerate, update test

* latest staticcheck

* update to psrpc 0.1.0

* fix tests

* dual write rpcs on running egress

* remove unused field

* fix race, change service for egress impl

* return nil if bus is nil

* id -> ids

* add affinityFunc to StartEgress
This commit is contained in:
David Colburn
2022-12-22 21:03:27 -08:00
committed by GitHub
parent 05132799a5
commit 6719a3c714
15 changed files with 1031 additions and 187 deletions
+52
View File
@@ -15,6 +15,7 @@ import (
"github.com/livekit/livekit-server/version"
"github.com/livekit/mageutil"
_ "github.com/livekit/psrpc"
)
const (
@@ -144,6 +145,57 @@ func PublishDocker() error {
return nil
}
// regenerate psrpc service definitions
func Psrpc() error {
psrpcProtoFiles := []string{
"pkg/service/rpc/egress.proto",
}
fmt.Println("generating psrpc")
protocolDir, err := mageutil.GetPkgDir("github.com/livekit/protocol")
if err != nil {
return err
}
psrpcDir, err := mageutil.GetPkgDir("github.com/livekit/psrpc")
if err != nil {
return err
}
protoc, err := mageutil.GetToolPath("protoc")
if err != nil {
return err
}
protocGoPath, err := mageutil.GetToolPath("protoc-gen-go")
if err != nil {
return err
}
psrpcPath, err := mageutil.GetToolPath("protoc-gen-psrpc")
if err != nil {
return err
}
fmt.Println("generating psrpc protobuf")
args := append([]string{
"--go_out", ".",
"--psrpc_out", ".",
"--go_opt=paths=source_relative",
"--psrpc_opt=paths=source_relative",
"--plugin=go=" + protocGoPath,
"--plugin=psrpc=" + psrpcPath,
"-I" + protocolDir,
"-I" + psrpcDir + "/protoc-gen-psrpc/options",
"-I=.",
}, psrpcProtoFiles...)
cmd := exec.Command(protoc, args...)
mageutil.ConnectStd(cmd)
if err := cmd.Run(); err != nil {
return err
}
return nil
}
// run unit tests, skipping integration
func Test() error {
mg.Deps(generateWire, setULimit)