google.golang.org/grpc@v1.72.2/profiling/proto/service_grpc.pb.go (about) 1 // Copyright 2019 gRPC authors. 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.5.1 18 // - protoc v5.27.1 19 // source: profiling/proto/service.proto 20 21 package proto 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.64.0 or later. 33 const _ = grpc.SupportPackageIsVersion9 34 35 const ( 36 Profiling_Enable_FullMethodName = "/grpc.go.profiling.v1alpha.Profiling/Enable" 37 Profiling_GetStreamStats_FullMethodName = "/grpc.go.profiling.v1alpha.Profiling/GetStreamStats" 38 ) 39 40 // ProfilingClient is the client API for Profiling 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 // 44 // The Profiling service exposes functions to remotely manage the gRPC 45 // profiling behaviour in a program. 46 type ProfilingClient interface { 47 // Enable allows users to toggle profiling on and off remotely. 48 Enable(ctx context.Context, in *EnableRequest, opts ...grpc.CallOption) (*EnableResponse, error) 49 // GetStreamStats is used to retrieve an array of stream-level stats from a 50 // gRPC client/server. 51 GetStreamStats(ctx context.Context, in *GetStreamStatsRequest, opts ...grpc.CallOption) (*GetStreamStatsResponse, error) 52 } 53 54 type profilingClient struct { 55 cc grpc.ClientConnInterface 56 } 57 58 func NewProfilingClient(cc grpc.ClientConnInterface) ProfilingClient { 59 return &profilingClient{cc} 60 } 61 62 func (c *profilingClient) Enable(ctx context.Context, in *EnableRequest, opts ...grpc.CallOption) (*EnableResponse, error) { 63 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 64 out := new(EnableResponse) 65 err := c.cc.Invoke(ctx, Profiling_Enable_FullMethodName, in, out, cOpts...) 66 if err != nil { 67 return nil, err 68 } 69 return out, nil 70 } 71 72 func (c *profilingClient) GetStreamStats(ctx context.Context, in *GetStreamStatsRequest, opts ...grpc.CallOption) (*GetStreamStatsResponse, error) { 73 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 74 out := new(GetStreamStatsResponse) 75 err := c.cc.Invoke(ctx, Profiling_GetStreamStats_FullMethodName, in, out, cOpts...) 76 if err != nil { 77 return nil, err 78 } 79 return out, nil 80 } 81 82 // ProfilingServer is the server API for Profiling service. 83 // All implementations should embed UnimplementedProfilingServer 84 // for forward compatibility. 85 // 86 // The Profiling service exposes functions to remotely manage the gRPC 87 // profiling behaviour in a program. 88 type ProfilingServer interface { 89 // Enable allows users to toggle profiling on and off remotely. 90 Enable(context.Context, *EnableRequest) (*EnableResponse, error) 91 // GetStreamStats is used to retrieve an array of stream-level stats from a 92 // gRPC client/server. 93 GetStreamStats(context.Context, *GetStreamStatsRequest) (*GetStreamStatsResponse, error) 94 } 95 96 // UnimplementedProfilingServer should be embedded to have 97 // forward compatible implementations. 98 // 99 // NOTE: this should be embedded by value instead of pointer to avoid a nil 100 // pointer dereference when methods are called. 101 type UnimplementedProfilingServer struct{} 102 103 func (UnimplementedProfilingServer) Enable(context.Context, *EnableRequest) (*EnableResponse, error) { 104 return nil, status.Errorf(codes.Unimplemented, "method Enable not implemented") 105 } 106 func (UnimplementedProfilingServer) GetStreamStats(context.Context, *GetStreamStatsRequest) (*GetStreamStatsResponse, error) { 107 return nil, status.Errorf(codes.Unimplemented, "method GetStreamStats not implemented") 108 } 109 func (UnimplementedProfilingServer) testEmbeddedByValue() {} 110 111 // UnsafeProfilingServer may be embedded to opt out of forward compatibility for this service. 112 // Use of this interface is not recommended, as added methods to ProfilingServer will 113 // result in compilation errors. 114 type UnsafeProfilingServer interface { 115 mustEmbedUnimplementedProfilingServer() 116 } 117 118 func RegisterProfilingServer(s grpc.ServiceRegistrar, srv ProfilingServer) { 119 // If the following call panics, it indicates UnimplementedProfilingServer was 120 // embedded by pointer and is nil. This will cause panics if an 121 // unimplemented method is ever invoked, so we test this at initialization 122 // time to prevent it from happening at runtime later due to I/O. 123 if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 124 t.testEmbeddedByValue() 125 } 126 s.RegisterService(&Profiling_ServiceDesc, srv) 127 } 128 129 func _Profiling_Enable_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 130 in := new(EnableRequest) 131 if err := dec(in); err != nil { 132 return nil, err 133 } 134 if interceptor == nil { 135 return srv.(ProfilingServer).Enable(ctx, in) 136 } 137 info := &grpc.UnaryServerInfo{ 138 Server: srv, 139 FullMethod: Profiling_Enable_FullMethodName, 140 } 141 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 142 return srv.(ProfilingServer).Enable(ctx, req.(*EnableRequest)) 143 } 144 return interceptor(ctx, in, info, handler) 145 } 146 147 func _Profiling_GetStreamStats_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { 148 in := new(GetStreamStatsRequest) 149 if err := dec(in); err != nil { 150 return nil, err 151 } 152 if interceptor == nil { 153 return srv.(ProfilingServer).GetStreamStats(ctx, in) 154 } 155 info := &grpc.UnaryServerInfo{ 156 Server: srv, 157 FullMethod: Profiling_GetStreamStats_FullMethodName, 158 } 159 handler := func(ctx context.Context, req interface{}) (interface{}, error) { 160 return srv.(ProfilingServer).GetStreamStats(ctx, req.(*GetStreamStatsRequest)) 161 } 162 return interceptor(ctx, in, info, handler) 163 } 164 165 // Profiling_ServiceDesc is the grpc.ServiceDesc for Profiling service. 166 // It's only intended for direct use with grpc.RegisterService, 167 // and not to be introspected or modified (even as a copy) 168 var Profiling_ServiceDesc = grpc.ServiceDesc{ 169 ServiceName: "grpc.go.profiling.v1alpha.Profiling", 170 HandlerType: (*ProfilingServer)(nil), 171 Methods: []grpc.MethodDesc{ 172 { 173 MethodName: "Enable", 174 Handler: _Profiling_Enable_Handler, 175 }, 176 { 177 MethodName: "GetStreamStats", 178 Handler: _Profiling_GetStreamStats_Handler, 179 }, 180 }, 181 Streams: []grpc.StreamDesc{}, 182 Metadata: "profiling/proto/service.proto", 183 }