github.com/livekit/protocol@v1.16.1-0.20240517185851-47e4c6bba773/infra/link_grpc.pb.go (about)

     1  // Copyright 2023 LiveKit, Inc.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
    16  // versions:
    17  // - protoc-gen-go-grpc v1.3.0
    18  // - protoc             v4.23.4
    19  // source: infra/link.proto
    20  
    21  package infra
    22  
    23  import (
    24  	context "context"
    25  	grpc "google.golang.org/grpc"
    26  	codes "google.golang.org/grpc/codes"
    27  	status "google.golang.org/grpc/status"
    28  )
    29  
    30  // This is a compile-time assertion to ensure that this generated file
    31  // is compatible with the grpc package it is being compiled against.
    32  // Requires gRPC-Go v1.32.0 or later.
    33  const _ = grpc.SupportPackageIsVersion7
    34  
    35  const (
    36  	Link_WatchLocalLinks_FullMethodName   = "/rpc.Link/WatchLocalLinks"
    37  	Link_SimulateLinkState_FullMethodName = "/rpc.Link/SimulateLinkState"
    38  )
    39  
    40  // LinkClient is the client API for Link service.
    41  //
    42  // 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.
    43  type LinkClient interface {
    44  	WatchLocalLinks(ctx context.Context, in *WatchLocalLinksRequest, opts ...grpc.CallOption) (Link_WatchLocalLinksClient, error)
    45  	SimulateLinkState(ctx context.Context, in *SimulateLinkStateRequest, opts ...grpc.CallOption) (*SimulateLinkStateResponse, error)
    46  }
    47  
    48  type linkClient struct {
    49  	cc grpc.ClientConnInterface
    50  }
    51  
    52  func NewLinkClient(cc grpc.ClientConnInterface) LinkClient {
    53  	return &linkClient{cc}
    54  }
    55  
    56  func (c *linkClient) WatchLocalLinks(ctx context.Context, in *WatchLocalLinksRequest, opts ...grpc.CallOption) (Link_WatchLocalLinksClient, error) {
    57  	stream, err := c.cc.NewStream(ctx, &Link_ServiceDesc.Streams[0], Link_WatchLocalLinks_FullMethodName, opts...)
    58  	if err != nil {
    59  		return nil, err
    60  	}
    61  	x := &linkWatchLocalLinksClient{stream}
    62  	if err := x.ClientStream.SendMsg(in); err != nil {
    63  		return nil, err
    64  	}
    65  	if err := x.ClientStream.CloseSend(); err != nil {
    66  		return nil, err
    67  	}
    68  	return x, nil
    69  }
    70  
    71  type Link_WatchLocalLinksClient interface {
    72  	Recv() (*WatchLocalLinksResponse, error)
    73  	grpc.ClientStream
    74  }
    75  
    76  type linkWatchLocalLinksClient struct {
    77  	grpc.ClientStream
    78  }
    79  
    80  func (x *linkWatchLocalLinksClient) Recv() (*WatchLocalLinksResponse, error) {
    81  	m := new(WatchLocalLinksResponse)
    82  	if err := x.ClientStream.RecvMsg(m); err != nil {
    83  		return nil, err
    84  	}
    85  	return m, nil
    86  }
    87  
    88  func (c *linkClient) SimulateLinkState(ctx context.Context, in *SimulateLinkStateRequest, opts ...grpc.CallOption) (*SimulateLinkStateResponse, error) {
    89  	out := new(SimulateLinkStateResponse)
    90  	err := c.cc.Invoke(ctx, Link_SimulateLinkState_FullMethodName, in, out, opts...)
    91  	if err != nil {
    92  		return nil, err
    93  	}
    94  	return out, nil
    95  }
    96  
    97  // LinkServer is the server API for Link service.
    98  // All implementations must embed UnimplementedLinkServer
    99  // for forward compatibility
   100  type LinkServer interface {
   101  	WatchLocalLinks(*WatchLocalLinksRequest, Link_WatchLocalLinksServer) error
   102  	SimulateLinkState(context.Context, *SimulateLinkStateRequest) (*SimulateLinkStateResponse, error)
   103  	mustEmbedUnimplementedLinkServer()
   104  }
   105  
   106  // UnimplementedLinkServer must be embedded to have forward compatible implementations.
   107  type UnimplementedLinkServer struct {
   108  }
   109  
   110  func (UnimplementedLinkServer) WatchLocalLinks(*WatchLocalLinksRequest, Link_WatchLocalLinksServer) error {
   111  	return status.Errorf(codes.Unimplemented, "method WatchLocalLinks not implemented")
   112  }
   113  func (UnimplementedLinkServer) SimulateLinkState(context.Context, *SimulateLinkStateRequest) (*SimulateLinkStateResponse, error) {
   114  	return nil, status.Errorf(codes.Unimplemented, "method SimulateLinkState not implemented")
   115  }
   116  func (UnimplementedLinkServer) mustEmbedUnimplementedLinkServer() {}
   117  
   118  // UnsafeLinkServer may be embedded to opt out of forward compatibility for this service.
   119  // Use of this interface is not recommended, as added methods to LinkServer will
   120  // result in compilation errors.
   121  type UnsafeLinkServer interface {
   122  	mustEmbedUnimplementedLinkServer()
   123  }
   124  
   125  func RegisterLinkServer(s grpc.ServiceRegistrar, srv LinkServer) {
   126  	s.RegisterService(&Link_ServiceDesc, srv)
   127  }
   128  
   129  func _Link_WatchLocalLinks_Handler(srv interface{}, stream grpc.ServerStream) error {
   130  	m := new(WatchLocalLinksRequest)
   131  	if err := stream.RecvMsg(m); err != nil {
   132  		return err
   133  	}
   134  	return srv.(LinkServer).WatchLocalLinks(m, &linkWatchLocalLinksServer{stream})
   135  }
   136  
   137  type Link_WatchLocalLinksServer interface {
   138  	Send(*WatchLocalLinksResponse) error
   139  	grpc.ServerStream
   140  }
   141  
   142  type linkWatchLocalLinksServer struct {
   143  	grpc.ServerStream
   144  }
   145  
   146  func (x *linkWatchLocalLinksServer) Send(m *WatchLocalLinksResponse) error {
   147  	return x.ServerStream.SendMsg(m)
   148  }
   149  
   150  func _Link_SimulateLinkState_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   151  	in := new(SimulateLinkStateRequest)
   152  	if err := dec(in); err != nil {
   153  		return nil, err
   154  	}
   155  	if interceptor == nil {
   156  		return srv.(LinkServer).SimulateLinkState(ctx, in)
   157  	}
   158  	info := &grpc.UnaryServerInfo{
   159  		Server:     srv,
   160  		FullMethod: Link_SimulateLinkState_FullMethodName,
   161  	}
   162  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   163  		return srv.(LinkServer).SimulateLinkState(ctx, req.(*SimulateLinkStateRequest))
   164  	}
   165  	return interceptor(ctx, in, info, handler)
   166  }
   167  
   168  // Link_ServiceDesc is the grpc.ServiceDesc for Link service.
   169  // It's only intended for direct use with grpc.RegisterService,
   170  // and not to be introspected or modified (even as a copy)
   171  var Link_ServiceDesc = grpc.ServiceDesc{
   172  	ServiceName: "rpc.Link",
   173  	HandlerType: (*LinkServer)(nil),
   174  	Methods: []grpc.MethodDesc{
   175  		{
   176  			MethodName: "SimulateLinkState",
   177  			Handler:    _Link_SimulateLinkState_Handler,
   178  		},
   179  	},
   180  	Streams: []grpc.StreamDesc{
   181  		{
   182  			StreamName:    "WatchLocalLinks",
   183  			Handler:       _Link_WatchLocalLinks_Handler,
   184  			ServerStreams: true,
   185  		},
   186  	},
   187  	Metadata: "infra/link.proto",
   188  }