github.com/whoyao/protocol@v0.0.0-20230519045905-2d8ace718ca5/rpc/io.psrpc.go (about) 1 // Code generated by protoc-gen-psrpc v0.3.0, DO NOT EDIT. 2 // source: rpc/io.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/server" 13 "github.com/livekit/psrpc/version" 14 ) 15 import google_protobuf2 "google.golang.org/protobuf/types/known/emptypb" 16 import livekit1 "github.com/whoyao/protocol/livekit" 17 18 var _ = version.PsrpcVersion_0_3_0 19 20 // ======================= 21 // IOInfo Client Interface 22 // ======================= 23 24 type IOInfoClient interface { 25 UpdateEgressInfo(ctx context.Context, req *livekit1.EgressInfo, opts ...psrpc.RequestOption) (*google_protobuf2.Empty, error) 26 27 GetIngressInfo(ctx context.Context, req *GetIngressInfoRequest, opts ...psrpc.RequestOption) (*GetIngressInfoResponse, error) 28 29 UpdateIngressState(ctx context.Context, req *UpdateIngressStateRequest, opts ...psrpc.RequestOption) (*google_protobuf2.Empty, error) 30 } 31 32 // =========================== 33 // IOInfo ServerImpl Interface 34 // =========================== 35 36 type IOInfoServerImpl interface { 37 UpdateEgressInfo(context.Context, *livekit1.EgressInfo) (*google_protobuf2.Empty, error) 38 39 GetIngressInfo(context.Context, *GetIngressInfoRequest) (*GetIngressInfoResponse, error) 40 41 UpdateIngressState(context.Context, *UpdateIngressStateRequest) (*google_protobuf2.Empty, error) 42 } 43 44 // ======================= 45 // IOInfo Server Interface 46 // ======================= 47 48 type IOInfoServer interface { 49 50 // Close and wait for pending RPCs to complete 51 Shutdown() 52 53 // Close immediately, without waiting for pending RPCs 54 Kill() 55 } 56 57 // ============= 58 // IOInfo Client 59 // ============= 60 61 type iOInfoClient struct { 62 client *client.RPCClient 63 } 64 65 // NewIOInfoClient creates a psrpc client that implements the IOInfoClient interface. 66 func NewIOInfoClient(clientID string, bus psrpc.MessageBus, opts ...psrpc.ClientOption) (IOInfoClient, error) { 67 sd := &info.ServiceDefinition{ 68 Name: "IOInfo", 69 ID: clientID, 70 } 71 72 sd.RegisterMethod("UpdateEgressInfo", false, false, true) 73 sd.RegisterMethod("GetIngressInfo", false, false, true) 74 sd.RegisterMethod("UpdateIngressState", false, false, true) 75 76 rpcClient, err := client.NewRPCClient(sd, bus, opts...) 77 if err != nil { 78 return nil, err 79 } 80 81 return &iOInfoClient{ 82 client: rpcClient, 83 }, nil 84 } 85 86 func (c *iOInfoClient) UpdateEgressInfo(ctx context.Context, req *livekit1.EgressInfo, opts ...psrpc.RequestOption) (*google_protobuf2.Empty, error) { 87 return client.RequestSingle[*google_protobuf2.Empty](ctx, c.client, "UpdateEgressInfo", nil, req, opts...) 88 } 89 90 func (c *iOInfoClient) GetIngressInfo(ctx context.Context, req *GetIngressInfoRequest, opts ...psrpc.RequestOption) (*GetIngressInfoResponse, error) { 91 return client.RequestSingle[*GetIngressInfoResponse](ctx, c.client, "GetIngressInfo", nil, req, opts...) 92 } 93 94 func (c *iOInfoClient) UpdateIngressState(ctx context.Context, req *UpdateIngressStateRequest, opts ...psrpc.RequestOption) (*google_protobuf2.Empty, error) { 95 return client.RequestSingle[*google_protobuf2.Empty](ctx, c.client, "UpdateIngressState", nil, req, opts...) 96 } 97 98 // ============= 99 // IOInfo Server 100 // ============= 101 102 type iOInfoServer struct { 103 svc IOInfoServerImpl 104 rpc *server.RPCServer 105 } 106 107 // NewIOInfoServer builds a RPCServer that will route requests 108 // to the corresponding method in the provided svc implementation. 109 func NewIOInfoServer(serverID string, svc IOInfoServerImpl, bus psrpc.MessageBus, opts ...psrpc.ServerOption) (IOInfoServer, error) { 110 sd := &info.ServiceDefinition{ 111 Name: "IOInfo", 112 ID: serverID, 113 } 114 115 s := server.NewRPCServer(sd, bus, opts...) 116 117 sd.RegisterMethod("UpdateEgressInfo", false, false, true) 118 var err error 119 err = server.RegisterHandler(s, "UpdateEgressInfo", nil, svc.UpdateEgressInfo, nil) 120 if err != nil { 121 s.Close(false) 122 return nil, err 123 } 124 125 sd.RegisterMethod("GetIngressInfo", false, false, true) 126 err = server.RegisterHandler(s, "GetIngressInfo", nil, svc.GetIngressInfo, nil) 127 if err != nil { 128 s.Close(false) 129 return nil, err 130 } 131 132 sd.RegisterMethod("UpdateIngressState", false, false, true) 133 err = server.RegisterHandler(s, "UpdateIngressState", nil, svc.UpdateIngressState, nil) 134 if err != nil { 135 s.Close(false) 136 return nil, err 137 } 138 139 return &iOInfoServer{ 140 svc: svc, 141 rpc: s, 142 }, nil 143 } 144 145 func (s *iOInfoServer) Shutdown() { 146 s.rpc.Close(false) 147 } 148 149 func (s *iOInfoServer) Kill() { 150 s.rpc.Close(true) 151 } 152 153 var psrpcFileDescriptor2 = []byte{ 154 // 348 bytes of a gzipped FileDescriptorProto 155 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x51, 0x61, 0x4b, 0x02, 0x41, 156 0x10, 0xc5, 0x4c, 0xc1, 0x31, 0x22, 0x36, 0x4f, 0xec, 0xa4, 0x08, 0x3f, 0x49, 0xc5, 0x1e, 0xd8, 157 0x0f, 0x08, 0x02, 0x89, 0xa3, 0x20, 0x30, 0xfc, 0xd2, 0x97, 0x43, 0xcf, 0xf1, 0x5a, 0xee, 0xbc, 158 0xdd, 0x76, 0xf7, 0x14, 0xff, 0x6e, 0xbf, 0x24, 0xee, 0x76, 0xbd, 0xcc, 0x14, 0xfa, 0xb4, 0xec, 159 0x7b, 0x33, 0x6f, 0xde, 0xcc, 0x83, 0x13, 0x29, 0x42, 0x8f, 0x71, 0x2a, 0x24, 0xd7, 0x9c, 0x54, 160 0xa5, 0x08, 0xdd, 0x56, 0xc2, 0x96, 0x18, 0x33, 0x1d, 0x60, 0x24, 0x51, 0x29, 0x43, 0xb9, 0xce, 161 0x06, 0x65, 0xe9, 0x36, 0xdc, 0x8d, 0x38, 0x8f, 0x12, 0xf4, 0x8a, 0xdf, 0x34, 0x9b, 0x7b, 0xb8, 162 0x10, 0x7a, 0x6d, 0xc8, 0xde, 0x18, 0x9c, 0x27, 0xd4, 0xbe, 0x69, 0xf0, 0xd3, 0x39, 0x1f, 0xe1, 163 0x67, 0x86, 0x4a, 0x93, 0x4b, 0x00, 0x2b, 0x13, 0xb0, 0x59, 0xa7, 0x72, 0x5d, 0xe9, 0x37, 0x46, 164 0x0d, 0x8b, 0xf8, 0xb3, 0x9c, 0x56, 0x5a, 0xe2, 0x64, 0x11, 0xc4, 0xb8, 0xee, 0x1c, 0x19, 0xda, 165 0x20, 0xcf, 0xb8, 0xee, 0x71, 0x68, 0xef, 0xca, 0x2a, 0xc1, 0x53, 0x85, 0xa4, 0x0f, 0xc7, 0x2c, 166 0x9d, 0xf3, 0x42, 0xb1, 0x39, 0x68, 0x51, 0xeb, 0x99, 0x6e, 0xd7, 0x16, 0x15, 0xa4, 0x05, 0x35, 167 0xcd, 0x63, 0x4c, 0xad, 0xba, 0xf9, 0x10, 0x07, 0xea, 0x2b, 0x15, 0x64, 0x32, 0xe9, 0x54, 0x0d, 168 0xbc, 0x52, 0x63, 0x99, 0xf4, 0x22, 0xb8, 0x18, 0x8b, 0xd9, 0x44, 0xa3, 0xd5, 0x79, 0xd3, 0x13, 169 0x8d, 0xff, 0xdc, 0xe5, 0x16, 0x6a, 0x2a, 0x2f, 0x2f, 0x06, 0x35, 0x07, 0xce, 0xae, 0x27, 0xa3, 170 0x65, 0x6a, 0x06, 0x5f, 0x15, 0xa8, 0xfb, 0xaf, 0xb9, 0x4d, 0xf2, 0x00, 0x67, 0x66, 0xe6, 0xb0, 171 0xb4, 0x4e, 0xce, 0xcb, 0xe6, 0x1f, 0xd0, 0x6d, 0x53, 0x13, 0x01, 0xdd, 0x44, 0x40, 0x87, 0x79, 172 0x04, 0xc4, 0x87, 0xd3, 0xdf, 0x57, 0x22, 0x2e, 0x95, 0x22, 0xa4, 0x7b, 0x13, 0x71, 0xbb, 0x7b, 173 0x39, 0x7b, 0xd6, 0x17, 0x20, 0x7f, 0xf7, 0x27, 0x57, 0x45, 0xcb, 0xc1, 0xc3, 0x1c, 0x32, 0xf6, 174 0x78, 0xf7, 0x7e, 0x13, 0x31, 0xfd, 0x91, 0x4d, 0x69, 0xc8, 0x17, 0x9e, 0xdd, 0xa8, 0x7c, 0x45, 175 0x1c, 0x79, 0x0a, 0xe5, 0x92, 0x85, 0xe8, 0x49, 0x11, 0x4e, 0xeb, 0x45, 0xf7, 0xfd, 0x77, 0x00, 176 0x00, 0x00, 0xff, 0xff, 0xc0, 0x02, 0x76, 0x1c, 0xa9, 0x02, 0x00, 0x00, 177 }