Compare commits

...

2 Commits

Author SHA1 Message Date
github-actions
f34c9efb0c generated protobuf
Some checks failed
Generate / generate (push) Has been cancelled
2024-07-24 06:50:56 +00:00
Paul Wells
d5be804775 generate twirp proto for agents dispatch service 2024-07-23 23:50:03 -07:00
8 changed files with 1127 additions and 415 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -1,200 +0,0 @@
// Copyright 2023 LiveKit, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.4.0
// - protoc v4.23.4
// source: livekit_agent_dispatch.proto
package livekit
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.62.0 or later.
const _ = grpc.SupportPackageIsVersion8
const (
AgentDispatchService_CreateDispatch_FullMethodName = "/livekit.AgentDispatchService/CreateDispatch"
AgentDispatchService_DeleteDispatch_FullMethodName = "/livekit.AgentDispatchService/DeleteDispatch"
AgentDispatchService_ListDispatch_FullMethodName = "/livekit.AgentDispatchService/ListDispatch"
)
// AgentDispatchServiceClient is the client API for AgentDispatchService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type AgentDispatchServiceClient interface {
CreateDispatch(ctx context.Context, in *CreateAgentDispatchRequest, opts ...grpc.CallOption) (*AgentDispatch, error)
DeleteDispatch(ctx context.Context, in *DeleteAgentDispatchRequest, opts ...grpc.CallOption) (*AgentDispatch, error)
ListDispatch(ctx context.Context, in *ListAgentDispatchRequesst, opts ...grpc.CallOption) (*ListAgentDispatchResponse, error)
}
type agentDispatchServiceClient struct {
cc grpc.ClientConnInterface
}
func NewAgentDispatchServiceClient(cc grpc.ClientConnInterface) AgentDispatchServiceClient {
return &agentDispatchServiceClient{cc}
}
func (c *agentDispatchServiceClient) CreateDispatch(ctx context.Context, in *CreateAgentDispatchRequest, opts ...grpc.CallOption) (*AgentDispatch, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AgentDispatch)
err := c.cc.Invoke(ctx, AgentDispatchService_CreateDispatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentDispatchServiceClient) DeleteDispatch(ctx context.Context, in *DeleteAgentDispatchRequest, opts ...grpc.CallOption) (*AgentDispatch, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(AgentDispatch)
err := c.cc.Invoke(ctx, AgentDispatchService_DeleteDispatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentDispatchServiceClient) ListDispatch(ctx context.Context, in *ListAgentDispatchRequesst, opts ...grpc.CallOption) (*ListAgentDispatchResponse, error) {
cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
out := new(ListAgentDispatchResponse)
err := c.cc.Invoke(ctx, AgentDispatchService_ListDispatch_FullMethodName, in, out, cOpts...)
if err != nil {
return nil, err
}
return out, nil
}
// AgentDispatchServiceServer is the server API for AgentDispatchService service.
// All implementations must embed UnimplementedAgentDispatchServiceServer
// for forward compatibility
type AgentDispatchServiceServer interface {
CreateDispatch(context.Context, *CreateAgentDispatchRequest) (*AgentDispatch, error)
DeleteDispatch(context.Context, *DeleteAgentDispatchRequest) (*AgentDispatch, error)
ListDispatch(context.Context, *ListAgentDispatchRequesst) (*ListAgentDispatchResponse, error)
mustEmbedUnimplementedAgentDispatchServiceServer()
}
// UnimplementedAgentDispatchServiceServer must be embedded to have forward compatible implementations.
type UnimplementedAgentDispatchServiceServer struct {
}
func (UnimplementedAgentDispatchServiceServer) CreateDispatch(context.Context, *CreateAgentDispatchRequest) (*AgentDispatch, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateDispatch not implemented")
}
func (UnimplementedAgentDispatchServiceServer) DeleteDispatch(context.Context, *DeleteAgentDispatchRequest) (*AgentDispatch, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteDispatch not implemented")
}
func (UnimplementedAgentDispatchServiceServer) ListDispatch(context.Context, *ListAgentDispatchRequesst) (*ListAgentDispatchResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListDispatch not implemented")
}
func (UnimplementedAgentDispatchServiceServer) mustEmbedUnimplementedAgentDispatchServiceServer() {}
// UnsafeAgentDispatchServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AgentDispatchServiceServer will
// result in compilation errors.
type UnsafeAgentDispatchServiceServer interface {
mustEmbedUnimplementedAgentDispatchServiceServer()
}
func RegisterAgentDispatchServiceServer(s grpc.ServiceRegistrar, srv AgentDispatchServiceServer) {
s.RegisterService(&AgentDispatchService_ServiceDesc, srv)
}
func _AgentDispatchService_CreateDispatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateAgentDispatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentDispatchServiceServer).CreateDispatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentDispatchService_CreateDispatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentDispatchServiceServer).CreateDispatch(ctx, req.(*CreateAgentDispatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AgentDispatchService_DeleteDispatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteAgentDispatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentDispatchServiceServer).DeleteDispatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentDispatchService_DeleteDispatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentDispatchServiceServer).DeleteDispatch(ctx, req.(*DeleteAgentDispatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AgentDispatchService_ListDispatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListAgentDispatchRequesst)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentDispatchServiceServer).ListDispatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentDispatchService_ListDispatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentDispatchServiceServer).ListDispatch(ctx, req.(*ListAgentDispatchRequesst))
}
return interceptor(ctx, in, info, handler)
}
// AgentDispatchService_ServiceDesc is the grpc.ServiceDesc for AgentDispatchService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AgentDispatchService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "livekit.AgentDispatchService",
HandlerType: (*AgentDispatchServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateDispatch",
Handler: _AgentDispatchService_CreateDispatch_Handler,
},
{
MethodName: "DeleteDispatch",
Handler: _AgentDispatchService_DeleteDispatch_Handler,
},
{
MethodName: "ListDispatch",
Handler: _AgentDispatchService_ListDispatch_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "livekit_agent_dispatch.proto",
}

View File

@@ -1,197 +0,0 @@
// Copyright 2023 LiveKit, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc v5.27.0
// source: livekit_agent.proto
package livekit
import (
context "context"
grpc "google.golang.org/grpc"
codes "google.golang.org/grpc/codes"
status "google.golang.org/grpc/status"
)
// This is a compile-time assertion to ensure that this generated file
// is compatible with the grpc package it is being compiled against.
// Requires gRPC-Go v1.32.0 or later.
const _ = grpc.SupportPackageIsVersion7
const (
AgentService_CreateDispatch_FullMethodName = "/livekit.AgentService/CreateDispatch"
AgentService_DeleteDispatch_FullMethodName = "/livekit.AgentService/DeleteDispatch"
AgentService_ListDispatch_FullMethodName = "/livekit.AgentService/ListDispatch"
)
// AgentServiceClient is the client API for AgentService service.
//
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
type AgentServiceClient interface {
CreateDispatch(ctx context.Context, in *CreateAgentDispatchRequest, opts ...grpc.CallOption) (*AgentDispatch, error)
DeleteDispatch(ctx context.Context, in *DeleteAgentDispatchRequest, opts ...grpc.CallOption) (*AgentDispatch, error)
ListDispatch(ctx context.Context, in *ListAgentDispatchRequesst, opts ...grpc.CallOption) (*ListAgentDispatchResponse, error)
}
type agentServiceClient struct {
cc grpc.ClientConnInterface
}
func NewAgentServiceClient(cc grpc.ClientConnInterface) AgentServiceClient {
return &agentServiceClient{cc}
}
func (c *agentServiceClient) CreateDispatch(ctx context.Context, in *CreateAgentDispatchRequest, opts ...grpc.CallOption) (*AgentDispatch, error) {
out := new(AgentDispatch)
err := c.cc.Invoke(ctx, AgentService_CreateDispatch_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentServiceClient) DeleteDispatch(ctx context.Context, in *DeleteAgentDispatchRequest, opts ...grpc.CallOption) (*AgentDispatch, error) {
out := new(AgentDispatch)
err := c.cc.Invoke(ctx, AgentService_DeleteDispatch_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
func (c *agentServiceClient) ListDispatch(ctx context.Context, in *ListAgentDispatchRequesst, opts ...grpc.CallOption) (*ListAgentDispatchResponse, error) {
out := new(ListAgentDispatchResponse)
err := c.cc.Invoke(ctx, AgentService_ListDispatch_FullMethodName, in, out, opts...)
if err != nil {
return nil, err
}
return out, nil
}
// AgentServiceServer is the server API for AgentService service.
// All implementations must embed UnimplementedAgentServiceServer
// for forward compatibility
type AgentServiceServer interface {
CreateDispatch(context.Context, *CreateAgentDispatchRequest) (*AgentDispatch, error)
DeleteDispatch(context.Context, *DeleteAgentDispatchRequest) (*AgentDispatch, error)
ListDispatch(context.Context, *ListAgentDispatchRequesst) (*ListAgentDispatchResponse, error)
mustEmbedUnimplementedAgentServiceServer()
}
// UnimplementedAgentServiceServer must be embedded to have forward compatible implementations.
type UnimplementedAgentServiceServer struct {
}
func (UnimplementedAgentServiceServer) CreateDispatch(context.Context, *CreateAgentDispatchRequest) (*AgentDispatch, error) {
return nil, status.Errorf(codes.Unimplemented, "method CreateDispatch not implemented")
}
func (UnimplementedAgentServiceServer) DeleteDispatch(context.Context, *DeleteAgentDispatchRequest) (*AgentDispatch, error) {
return nil, status.Errorf(codes.Unimplemented, "method DeleteDispatch not implemented")
}
func (UnimplementedAgentServiceServer) ListDispatch(context.Context, *ListAgentDispatchRequesst) (*ListAgentDispatchResponse, error) {
return nil, status.Errorf(codes.Unimplemented, "method ListDispatch not implemented")
}
func (UnimplementedAgentServiceServer) mustEmbedUnimplementedAgentServiceServer() {}
// UnsafeAgentServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to AgentServiceServer will
// result in compilation errors.
type UnsafeAgentServiceServer interface {
mustEmbedUnimplementedAgentServiceServer()
}
func RegisterAgentServiceServer(s grpc.ServiceRegistrar, srv AgentServiceServer) {
s.RegisterService(&AgentService_ServiceDesc, srv)
}
func _AgentService_CreateDispatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(CreateAgentDispatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).CreateDispatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentService_CreateDispatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).CreateDispatch(ctx, req.(*CreateAgentDispatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AgentService_DeleteDispatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(DeleteAgentDispatchRequest)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).DeleteDispatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentService_DeleteDispatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).DeleteDispatch(ctx, req.(*DeleteAgentDispatchRequest))
}
return interceptor(ctx, in, info, handler)
}
func _AgentService_ListDispatch_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(ListAgentDispatchRequesst)
if err := dec(in); err != nil {
return nil, err
}
if interceptor == nil {
return srv.(AgentServiceServer).ListDispatch(ctx, in)
}
info := &grpc.UnaryServerInfo{
Server: srv,
FullMethod: AgentService_ListDispatch_FullMethodName,
}
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(AgentServiceServer).ListDispatch(ctx, req.(*ListAgentDispatchRequesst))
}
return interceptor(ctx, in, info, handler)
}
// AgentService_ServiceDesc is the grpc.ServiceDesc for AgentService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var AgentService_ServiceDesc = grpc.ServiceDesc{
ServiceName: "livekit.AgentService",
HandlerType: (*AgentServiceServer)(nil),
Methods: []grpc.MethodDesc{
{
MethodName: "CreateDispatch",
Handler: _AgentService_CreateDispatch_Handler,
},
{
MethodName: "DeleteDispatch",
Handler: _AgentService_DeleteDispatch_Handler,
},
{
MethodName: "ListDispatch",
Handler: _AgentService_ListDispatch_Handler,
},
},
Streams: []grpc.StreamDesc{},
Metadata: "livekit_agent.proto",
}

View File

@@ -92,3 +92,8 @@ func (r *RoomAgent) UnmarshalYAML(value *yaml.Node) error {
return protoyaml.Unmarshal(str, r)
}
func IsJobType(t JobType) bool {
_, ok := JobType_name[int32(t)]
return ok
}

View File

@@ -47,10 +47,10 @@ func Proto() error {
"livekit_ingress.proto",
"livekit_room.proto",
"livekit_sip.proto",
"livekit_agent_dispatch.proto",
}
protoFiles := []string{
"livekit_agent.proto",
"livekit_agent_dispatch.proto",
"livekit_analytics.proto",
"livekit_internal.proto",
"livekit_models.proto",
@@ -132,11 +132,8 @@ func Proto() error {
fmt.Println("generating protobuf")
args = append([]string{
"--go_out", target,
"--go-grpc_out", target,
"--go_opt=paths=source_relative",
"--go-grpc_opt=paths=source_relative",
"--plugin=go=" + protocGoPath,
"--plugin=go-grpc=" + protocGrpcGoPath,
"-I=./protobufs",
}, protoFiles...)
cmd = exec.Command(protoc, args...)

View File

@@ -38,7 +38,7 @@ message JobState {
string error = 2;
int64 started_at = 3;
int64 ended_at = 4;
int64 updated_at = 5;
int64 updated_at = 5;
}
// from Worker to Server
@@ -129,7 +129,7 @@ message MigrateJobRequest {
message AvailabilityRequest {
Job job = 1;
// True when the job was previously assigned to another worker but has been
// True when the job was previously assigned to another worker but has been
// migrated due to different reasons (e.g. worker failure, job migration)
bool resuming = 2;
}

View File

@@ -60,7 +60,7 @@ message AgentDispatch {
}
message AgentDispatchState {
// For dispatches of tyoe JT_ROOM, there will be at most 1 job.
// For dispatches of tyoe JT_ROOM, there will be at most 1 job.
// For dispatches of type JT_PUBLISHER, there will be 1 per publisher.
repeated Job jobs = 1;
int64 created_at = 2;

View File

@@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.34.2
// protoc v5.27.0
// protoc-gen-go v1.32.0
// protoc v4.23.4
// source: cloud_replay.proto
package replay
@@ -491,7 +491,7 @@ func file_cloud_replay_proto_rawDescGZIP() []byte {
}
var file_cloud_replay_proto_msgTypes = make([]protoimpl.MessageInfo, 8)
var file_cloud_replay_proto_goTypes = []any{
var file_cloud_replay_proto_goTypes = []interface{}{
(*ListReplaysRequest)(nil), // 0: replay.ListReplaysRequest
(*ListReplaysResponse)(nil), // 1: replay.ListReplaysResponse
(*ReplayInfo)(nil), // 2: replay.ReplayInfo
@@ -527,7 +527,7 @@ func file_cloud_replay_proto_init() {
return
}
if !protoimpl.UnsafeEnabled {
file_cloud_replay_proto_msgTypes[0].Exporter = func(v any, i int) any {
file_cloud_replay_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListReplaysRequest); i {
case 0:
return &v.state
@@ -539,7 +539,7 @@ func file_cloud_replay_proto_init() {
return nil
}
}
file_cloud_replay_proto_msgTypes[1].Exporter = func(v any, i int) any {
file_cloud_replay_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ListReplaysResponse); i {
case 0:
return &v.state
@@ -551,7 +551,7 @@ func file_cloud_replay_proto_init() {
return nil
}
}
file_cloud_replay_proto_msgTypes[2].Exporter = func(v any, i int) any {
file_cloud_replay_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ReplayInfo); i {
case 0:
return &v.state
@@ -563,7 +563,7 @@ func file_cloud_replay_proto_init() {
return nil
}
}
file_cloud_replay_proto_msgTypes[3].Exporter = func(v any, i int) any {
file_cloud_replay_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LoadReplayRequest); i {
case 0:
return &v.state
@@ -575,7 +575,7 @@ func file_cloud_replay_proto_init() {
return nil
}
}
file_cloud_replay_proto_msgTypes[4].Exporter = func(v any, i int) any {
file_cloud_replay_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*LoadReplayResponse); i {
case 0:
return &v.state
@@ -587,7 +587,7 @@ func file_cloud_replay_proto_init() {
return nil
}
}
file_cloud_replay_proto_msgTypes[5].Exporter = func(v any, i int) any {
file_cloud_replay_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*RoomSeekRequest); i {
case 0:
return &v.state
@@ -599,7 +599,7 @@ func file_cloud_replay_proto_init() {
return nil
}
}
file_cloud_replay_proto_msgTypes[6].Exporter = func(v any, i int) any {
file_cloud_replay_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*CloseReplayRequest); i {
case 0:
return &v.state
@@ -611,7 +611,7 @@ func file_cloud_replay_proto_init() {
return nil
}
}
file_cloud_replay_proto_msgTypes[7].Exporter = func(v any, i int) any {
file_cloud_replay_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*DeleteReplayRequest); i {
case 0:
return &v.state