* move proto options to use lk reserved range * generated protobuf * Create swift-swans-sit.md --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
248 lines
11 KiB
Go
248 lines
11 KiB
Go
// Code generated by protoc-gen-psrpc v0.7.0, DO NOT EDIT.
|
|
// source: rpc/agent.proto
|
|
|
|
package rpc
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/livekit/psrpc"
|
|
"github.com/livekit/psrpc/pkg/client"
|
|
"github.com/livekit/psrpc/pkg/info"
|
|
"github.com/livekit/psrpc/pkg/rand"
|
|
"github.com/livekit/psrpc/pkg/server"
|
|
"github.com/livekit/psrpc/version"
|
|
)
|
|
import google_protobuf "google.golang.org/protobuf/types/known/emptypb"
|
|
import livekit2 "github.com/livekit/protocol/livekit"
|
|
|
|
var _ = version.PsrpcVersion_0_7
|
|
|
|
// ==============================
|
|
// AgentInternal Client Interface
|
|
// ==============================
|
|
|
|
type AgentInternalClient interface {
|
|
CheckEnabled(ctx context.Context, req *CheckEnabledRequest, opts ...psrpc.RequestOption) (<-chan *psrpc.Response[*CheckEnabledResponse], error)
|
|
|
|
JobRequest(ctx context.Context, namespace string, jobType string, req *livekit2.Job, opts ...psrpc.RequestOption) (*JobRequestResponse, error)
|
|
|
|
JobTerminate(ctx context.Context, jobId string, req *JobTerminateRequest, opts ...psrpc.RequestOption) (*JobTerminateResponse, error)
|
|
|
|
SubscribeWorkerRegistered(ctx context.Context, handlerNamespace string) (psrpc.Subscription[*google_protobuf.Empty], error)
|
|
|
|
// Close immediately, without waiting for pending RPCs
|
|
Close()
|
|
}
|
|
|
|
// ==================================
|
|
// AgentInternal ServerImpl Interface
|
|
// ==================================
|
|
|
|
type AgentInternalServerImpl interface {
|
|
CheckEnabled(context.Context, *CheckEnabledRequest) (*CheckEnabledResponse, error)
|
|
|
|
JobRequest(context.Context, *livekit2.Job) (*JobRequestResponse, error)
|
|
JobRequestAffinity(context.Context, *livekit2.Job) float32
|
|
|
|
JobTerminate(context.Context, *JobTerminateRequest) (*JobTerminateResponse, error)
|
|
}
|
|
|
|
// ==============================
|
|
// AgentInternal Server Interface
|
|
// ==============================
|
|
|
|
type AgentInternalServer interface {
|
|
RegisterJobRequestTopic(namespace string, jobType string) error
|
|
DeregisterJobRequestTopic(namespace string, jobType string)
|
|
RegisterJobTerminateTopic(jobId string) error
|
|
DeregisterJobTerminateTopic(jobId string)
|
|
PublishWorkerRegistered(ctx context.Context, handlerNamespace string, msg *google_protobuf.Empty) error
|
|
|
|
// Close and wait for pending RPCs to complete
|
|
Shutdown()
|
|
|
|
// Close immediately, without waiting for pending RPCs
|
|
Kill()
|
|
}
|
|
|
|
// ====================
|
|
// AgentInternal Client
|
|
// ====================
|
|
|
|
type agentInternalClient struct {
|
|
client *client.RPCClient
|
|
}
|
|
|
|
// NewAgentInternalClient creates a psrpc client that implements the AgentInternalClient interface.
|
|
func NewAgentInternalClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (AgentInternalClient, error) {
|
|
sd := &info.ServiceDefinition{
|
|
Name: "AgentInternal",
|
|
ID: rand.NewClientID(),
|
|
}
|
|
|
|
sd.RegisterMethod("CheckEnabled", false, true, false, false)
|
|
sd.RegisterMethod("JobRequest", true, false, true, false)
|
|
sd.RegisterMethod("JobTerminate", false, false, true, true)
|
|
sd.RegisterMethod("WorkerRegistered", false, true, false, false)
|
|
|
|
rpcClient, err := client.NewRPCClient(sd, bus, opts...)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return &agentInternalClient{
|
|
client: rpcClient,
|
|
}, nil
|
|
}
|
|
|
|
func (c *agentInternalClient) CheckEnabled(ctx context.Context, req *CheckEnabledRequest, opts ...psrpc.RequestOption) (<-chan *psrpc.Response[*CheckEnabledResponse], error) {
|
|
return client.RequestMulti[*CheckEnabledResponse](ctx, c.client, "CheckEnabled", nil, req, opts...)
|
|
}
|
|
|
|
func (c *agentInternalClient) JobRequest(ctx context.Context, namespace string, jobType string, req *livekit2.Job, opts ...psrpc.RequestOption) (*JobRequestResponse, error) {
|
|
return client.RequestSingle[*JobRequestResponse](ctx, c.client, "JobRequest", []string{namespace, jobType}, req, opts...)
|
|
}
|
|
|
|
func (c *agentInternalClient) JobTerminate(ctx context.Context, jobId string, req *JobTerminateRequest, opts ...psrpc.RequestOption) (*JobTerminateResponse, error) {
|
|
return client.RequestSingle[*JobTerminateResponse](ctx, c.client, "JobTerminate", []string{jobId}, req, opts...)
|
|
}
|
|
|
|
func (c *agentInternalClient) SubscribeWorkerRegistered(ctx context.Context, handlerNamespace string) (psrpc.Subscription[*google_protobuf.Empty], error) {
|
|
return client.Join[*google_protobuf.Empty](ctx, c.client, "WorkerRegistered", []string{handlerNamespace})
|
|
}
|
|
|
|
func (s *agentInternalClient) Close() {
|
|
s.client.Close()
|
|
}
|
|
|
|
// ====================
|
|
// AgentInternal Server
|
|
// ====================
|
|
|
|
type agentInternalServer struct {
|
|
svc AgentInternalServerImpl
|
|
rpc *server.RPCServer
|
|
}
|
|
|
|
// NewAgentInternalServer builds a RPCServer that will route requests
|
|
// to the corresponding method in the provided svc implementation.
|
|
func NewAgentInternalServer(svc AgentInternalServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (AgentInternalServer, error) {
|
|
sd := &info.ServiceDefinition{
|
|
Name: "AgentInternal",
|
|
ID: rand.NewServerID(),
|
|
}
|
|
|
|
s := server.NewRPCServer(sd, bus, opts...)
|
|
|
|
sd.RegisterMethod("CheckEnabled", false, true, false, false)
|
|
var err error
|
|
err = server.RegisterHandler(s, "CheckEnabled", nil, svc.CheckEnabled, nil)
|
|
if err != nil {
|
|
s.Close(false)
|
|
return nil, err
|
|
}
|
|
|
|
sd.RegisterMethod("JobRequest", true, false, true, false)
|
|
sd.RegisterMethod("JobTerminate", false, false, true, true)
|
|
sd.RegisterMethod("WorkerRegistered", false, true, false, false)
|
|
return &agentInternalServer{
|
|
svc: svc,
|
|
rpc: s,
|
|
}, nil
|
|
}
|
|
|
|
func (s *agentInternalServer) RegisterJobRequestTopic(namespace string, jobType string) error {
|
|
return server.RegisterHandler(s.rpc, "JobRequest", []string{namespace, jobType}, s.svc.JobRequest, s.svc.JobRequestAffinity)
|
|
}
|
|
|
|
func (s *agentInternalServer) DeregisterJobRequestTopic(namespace string, jobType string) {
|
|
s.rpc.DeregisterHandler("JobRequest", []string{namespace, jobType})
|
|
}
|
|
|
|
func (s *agentInternalServer) RegisterJobTerminateTopic(jobId string) error {
|
|
return server.RegisterHandler(s.rpc, "JobTerminate", []string{jobId}, s.svc.JobTerminate, nil)
|
|
}
|
|
|
|
func (s *agentInternalServer) DeregisterJobTerminateTopic(jobId string) {
|
|
s.rpc.DeregisterHandler("JobTerminate", []string{jobId})
|
|
}
|
|
|
|
func (s *agentInternalServer) PublishWorkerRegistered(ctx context.Context, handlerNamespace string, msg *google_protobuf.Empty) error {
|
|
return s.rpc.Publish(ctx, "WorkerRegistered", []string{handlerNamespace}, msg)
|
|
}
|
|
|
|
func (s *agentInternalServer) Shutdown() {
|
|
s.rpc.Close(false)
|
|
}
|
|
|
|
func (s *agentInternalServer) Kill() {
|
|
s.rpc.Close(true)
|
|
}
|
|
|
|
// ==================================
|
|
// AgentInternal Unimplemented Server
|
|
// ==================================
|
|
|
|
type UnimplementedAgentInternalServer struct{}
|
|
|
|
func (UnimplementedAgentInternalServer) CheckEnabled(context.Context, *CheckEnabledRequest) (*CheckEnabledResponse, error) {
|
|
return nil, psrpc.ErrUnimplemented
|
|
}
|
|
|
|
func (UnimplementedAgentInternalServer) JobRequest(context.Context, *livekit2.Job) (*JobRequestResponse, error) {
|
|
return nil, psrpc.ErrUnimplemented
|
|
}
|
|
func (UnimplementedAgentInternalServer) JobRequestAffinity(context.Context, *livekit2.Job) float32 {
|
|
return -1
|
|
}
|
|
|
|
func (UnimplementedAgentInternalServer) JobTerminate(context.Context, *JobTerminateRequest) (*JobTerminateResponse, error) {
|
|
return nil, psrpc.ErrUnimplemented
|
|
}
|
|
|
|
func (UnimplementedAgentInternalServer) WorkerRegistered(context.Context, *google_protobuf.Empty) (*google_protobuf.Empty, error) {
|
|
return nil, psrpc.ErrUnimplemented
|
|
}
|
|
|
|
var psrpcFileDescriptor0 = []byte{
|
|
// 583 bytes of a gzipped FileDescriptorProto
|
|
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x6e, 0xd3, 0x40,
|
|
0x18, 0x64, 0xd3, 0x1f, 0xb9, 0xdb, 0x94, 0xba, 0xeb, 0x16, 0x52, 0x23, 0xd4, 0xd6, 0x17, 0x2a,
|
|
0x90, 0x6c, 0x54, 0xce, 0x88, 0x36, 0xc4, 0xa0, 0x44, 0x24, 0x01, 0xd7, 0x05, 0x89, 0x8b, 0x65,
|
|
0x3b, 0x1f, 0x8e, 0x1b, 0xc7, 0xbb, 0xac, 0x37, 0x48, 0x7d, 0x84, 0xbc, 0x4e, 0x8e, 0x3c, 0x0b,
|
|
0x8f, 0xc1, 0x03, 0x20, 0xaf, 0x1d, 0xe3, 0x54, 0xe1, 0xc0, 0x29, 0xda, 0x99, 0xc9, 0xa7, 0x6f,
|
|
0x66, 0x76, 0x8d, 0xf7, 0x39, 0x0b, 0x2d, 0x3f, 0x82, 0x54, 0x98, 0x8c, 0x53, 0x41, 0xc9, 0x06,
|
|
0x67, 0xa1, 0xfe, 0x24, 0xa2, 0x34, 0x4a, 0xc0, 0x92, 0x50, 0x30, 0xfb, 0x66, 0xc1, 0x94, 0x89,
|
|
0xbb, 0x42, 0xa1, 0xef, 0x51, 0x26, 0x62, 0x9a, 0x66, 0xe5, 0x51, 0x4b, 0xe2, 0x1f, 0x30, 0x89,
|
|
0x85, 0x57, 0x9b, 0xa2, 0x1f, 0x26, 0x34, 0x8a, 0x80, 0x5b, 0x2b, 0x52, 0xe3, 0x08, 0x6b, 0x6f,
|
|
0xc7, 0x10, 0x4e, 0xec, 0xd4, 0x0f, 0x12, 0x18, 0x39, 0xf0, 0x7d, 0x06, 0x99, 0x30,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