github.com/livekit/protocol@v1.16.1-0.20240517185851-47e4c6bba773/rpc/sip.psrpc.go (about)

     1  // Code generated by protoc-gen-psrpc v0.5.1, DO NOT EDIT.
     2  // source: rpc/sip.proto
     3  
     4  package rpc
     5  
     6  import (
     7  	"context"
     8  
     9  	"github.com/livekit/psrpc"
    10  	"github.com/livekit/psrpc/pkg/client"
    11  	"github.com/livekit/psrpc/pkg/info"
    12  	"github.com/livekit/psrpc/pkg/rand"
    13  	"github.com/livekit/psrpc/pkg/server"
    14  	"github.com/livekit/psrpc/version"
    15  )
    16  
    17  var _ = version.PsrpcVersion_0_5
    18  
    19  // ============================
    20  // SIPInternal Client Interface
    21  // ============================
    22  
    23  type SIPInternalClient interface {
    24  	CreateSIPParticipant(ctx context.Context, topic string, req *InternalCreateSIPParticipantRequest, opts ...psrpc.RequestOption) (*InternalCreateSIPParticipantResponse, error)
    25  }
    26  
    27  // ================================
    28  // SIPInternal ServerImpl Interface
    29  // ================================
    30  
    31  type SIPInternalServerImpl interface {
    32  	CreateSIPParticipant(context.Context, *InternalCreateSIPParticipantRequest) (*InternalCreateSIPParticipantResponse, error)
    33  	CreateSIPParticipantAffinity(context.Context, *InternalCreateSIPParticipantRequest) float32
    34  }
    35  
    36  // ============================
    37  // SIPInternal Server Interface
    38  // ============================
    39  
    40  type SIPInternalServer interface {
    41  	RegisterCreateSIPParticipantTopic(topic string) error
    42  	DeregisterCreateSIPParticipantTopic(topic string)
    43  
    44  	// Close and wait for pending RPCs to complete
    45  	Shutdown()
    46  
    47  	// Close immediately, without waiting for pending RPCs
    48  	Kill()
    49  }
    50  
    51  // ==================
    52  // SIPInternal Client
    53  // ==================
    54  
    55  type sIPInternalClient struct {
    56  	client *client.RPCClient
    57  }
    58  
    59  // NewSIPInternalClient creates a psrpc client that implements the SIPInternalClient interface.
    60  func NewSIPInternalClient(bus psrpc.MessageBus, opts ...psrpc.ClientOption) (SIPInternalClient, error) {
    61  	sd := &info.ServiceDefinition{
    62  		Name: "SIPInternal",
    63  		ID:   rand.NewClientID(),
    64  	}
    65  
    66  	sd.RegisterMethod("CreateSIPParticipant", true, false, true, false)
    67  
    68  	rpcClient, err := client.NewRPCClient(sd, bus, opts...)
    69  	if err != nil {
    70  		return nil, err
    71  	}
    72  
    73  	return &sIPInternalClient{
    74  		client: rpcClient,
    75  	}, nil
    76  }
    77  
    78  func (c *sIPInternalClient) CreateSIPParticipant(ctx context.Context, topic string, req *InternalCreateSIPParticipantRequest, opts ...psrpc.RequestOption) (*InternalCreateSIPParticipantResponse, error) {
    79  	return client.RequestSingle[*InternalCreateSIPParticipantResponse](ctx, c.client, "CreateSIPParticipant", []string{topic}, req, opts...)
    80  }
    81  
    82  // ==================
    83  // SIPInternal Server
    84  // ==================
    85  
    86  type sIPInternalServer struct {
    87  	svc SIPInternalServerImpl
    88  	rpc *server.RPCServer
    89  }
    90  
    91  // NewSIPInternalServer builds a RPCServer that will route requests
    92  // to the corresponding method in the provided svc implementation.
    93  func NewSIPInternalServer(svc SIPInternalServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (SIPInternalServer, error) {
    94  	sd := &info.ServiceDefinition{
    95  		Name: "SIPInternal",
    96  		ID:   rand.NewServerID(),
    97  	}
    98  
    99  	s := server.NewRPCServer(sd, bus, opts...)
   100  
   101  	sd.RegisterMethod("CreateSIPParticipant", true, false, true, false)
   102  	return &sIPInternalServer{
   103  		svc: svc,
   104  		rpc: s,
   105  	}, nil
   106  }
   107  
   108  func (s *sIPInternalServer) RegisterCreateSIPParticipantTopic(topic string) error {
   109  	return server.RegisterHandler(s.rpc, "CreateSIPParticipant", []string{topic}, s.svc.CreateSIPParticipant, s.svc.CreateSIPParticipantAffinity)
   110  }
   111  
   112  func (s *sIPInternalServer) DeregisterCreateSIPParticipantTopic(topic string) {
   113  	s.rpc.DeregisterHandler("CreateSIPParticipant", []string{topic})
   114  }
   115  
   116  func (s *sIPInternalServer) Shutdown() {
   117  	s.rpc.Close(false)
   118  }
   119  
   120  func (s *sIPInternalServer) Kill() {
   121  	s.rpc.Close(true)
   122  }
   123  
   124  var psrpcFileDescriptor8 = []byte{
   125  	// 447 bytes of a gzipped FileDescriptorProto
   126  	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0x5f, 0x6e, 0xd3, 0x40,
   127  	0x10, 0xc6, 0xb5, 0x4d, 0xeb, 0x24, 0x93, 0xba, 0xad, 0x96, 0x00, 0xab, 0x20, 0x41, 0x49, 0x41,
   128  	0x4a, 0x5f, 0x12, 0xfe, 0x5c, 0x00, 0xd1, 0x27, 0x3f, 0x80, 0xa2, 0x14, 0x5e, 0x78, 0xb1, 0x36,
   129  	0xde, 0xa5, 0xac, 0xba, 0xde, 0x5d, 0x76, 0xc7, 0x44, 0xbd, 0x00, 0x12, 0xb7, 0xe0, 0x0c, 0x9c,
   130  	0x87, 0xc3, 0x20, 0xaf, 0x1d, 0x48, 0x4b, 0x5b, 0xf5, 0xcd, 0xdf, 0xf7, 0x9b, 0x19, 0xcf, 0x8c,
   131  	0xc7, 0x90, 0x7a, 0x57, 0xcc, 0x82, 0x72, 0x53, 0xe7, 0x2d, 0x5a, 0xda, 0xf1, 0xae, 0x18, 0xa5,
   132  	0xd6, 0xa1, 0xb2, 0x26, 0x34, 0xde, 0xf8, 0x77, 0x07, 0x8e, 0x32, 0x83, 0xd2, 0x1b, 0xae, 0x4f,
   133  	0xbc, 0xe4, 0x28, 0x4f, 0xb3, 0xf9, 0x9c, 0x7b, 0x54, 0x85, 0x72, 0xdc, 0xe0, 0x42, 0x7e, 0xad,
   134  	0x64, 0x40, 0xfa, 0x18, 0x06, 0x41, 0xb9, 0xbc, 0xe0, 0x5a, 0xe7, 0x4a, 0xb0, 0xf4, 0x90, 0x4c,
   135  	0xfa, 0x8b, 0x7e, 0x50, 0xee, 0x84, 0x6b, 0x9d, 0x09, 0xca, 0xa0, 0xcb, 0x85, 0xf0, 0x32, 0x04,
   136  	0xb6, 0x15, 0xd9, 0x5a, 0xd2, 0x07, 0x90, 0x98, 0xaa, 0x5c, 0x4a, 0xcf, 0x3a, 0x11, 0xb4, 0x8a,
   137  	0x3e, 0x84, 0x6e, 0xac, 0x86, 0x96, 0x6d, 0x37, 0xa0, 0x96, 0x1f, 0x2c, 0x1d, 0x41, 0xaf, 0x0a,
   138  	0x75, 0x43, 0xa5, 0x64, 0x3b, 0x91, 0xfc, 0xd5, 0x35, 0x73, 0x3c, 0x84, 0x95, 0xf5, 0x82, 0x25,
   139  	0x0d, 0x5b, 0x6b, 0xfa, 0x08, 0xfa, 0xde, 0xda, 0x32, 0x8f, 0x89, 0xdd, 0x06, 0xd6, 0xc6, 0xfb,
   140  	0x3a, 0xf1, 0x25, 0x0c, 0xdd, 0xbf, 0xa9, 0x72, 0x25, 0xa4, 0x41, 0x85, 0x17, 0xac, 0x17, 0xe3,
   141  	0xee, 0x6d, 0xb0, 0xac, 0x45, 0xf4, 0x18, 0x0e, 0x36, 0x53, 0x62, 0xd9, 0xbd, 0x18, 0xbe, 0xbf,
   142  	0xe1, 0x5f, 0x57, 0xbd, 0x94, 0xc8, 0x05, 0x47, 0xce, 0xf6, 0xff, 0xab, 0xfe, 0xae, 0x45, 0x74,
   143  	0x08, 0x3b, 0x68, 0xcf, 0xa5, 0x61, 0xfd, 0x18, 0xd3, 0x08, 0x7a, 0x1f, 0x92, 0x55, 0xc8, 0x2b,
   144  	0xaf, 0x19, 0x34, 0xf6, 0x2a, 0x7c, 0xf4, 0x9a, 0x52, 0xd8, 0x16, 0x58, 0x7e, 0x66, 0x83, 0x68,
   145  	0xc6, 0x67, 0x7a, 0x04, 0xa9, 0xd3, 0xfc, 0x22, 0xf7, 0xca, 0x9c, 0xa1, 0x35, 0x92, 0xed, 0x1e,
   146  	0x92, 0x49, 0x6f, 0xb1, 0x5b, 0x9b, 0x8b, 0xd6, 0x1b, 0xff, 0x24, 0xf0, 0xec, 0xf6, 0xcf, 0x1b,
   147  	0x9c, 0x35, 0x41, 0xd2, 0xe7, 0xb0, 0x77, 0x79, 0x3f, 0x8c, 0xc4, 0x77, 0xa5, 0x97, 0x36, 0x73,
   148  	0xe3, 0x1a, 0xb7, 0x6e, 0x5e, 0xe3, 0x95, 0xcb, 0xe9, 0x5c, 0xb9, 0x9c, 0x57, 0xdf, 0x09, 0x0c,
   149  	0x4e, 0xb3, 0xf9, 0xba, 0x4b, 0xba, 0x82, 0xe1, 0x75, 0x9d, 0xd2, 0xc9, 0xd4, 0xbb, 0x62, 0x7a,
   150  	0x87, 0x5b, 0x1d, 0x1d, 0xdf, 0x21, 0xb2, 0x19, 0x7b, 0x0c, 0xbf, 0x7e, 0x90, 0xe4, 0x80, 0xbc,
   151  	0x21, 0x2f, 0xc8, 0xdb, 0xa7, 0x9f, 0x9e, 0x9c, 0x29, 0xfc, 0x52, 0x2d, 0xa7, 0x85, 0x2d, 0x67,
   152  	0x5a, 0x7d, 0x93, 0xe7, 0x0a, 0x67, 0xf1, 0x37, 0x29, 0xac, 0x9e, 0x79, 0x57, 0x2c, 0x93, 0xa8,
   153  	0x5e, 0xff, 0x09, 0x00, 0x00, 0xff, 0xff, 0x00, 0x3c, 0xa1, 0x30, 0x59, 0x03, 0x00, 0x00,
   154  }