github.com/cosmos/cosmos-sdk@v0.50.10/client/grpc/node/query.pb.gw.go (about) 1 // Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. 2 // source: cosmos/base/node/v1beta1/query.proto 3 4 /* 5 Package node is a reverse proxy. 6 7 It translates gRPC into RESTful JSON APIs. 8 */ 9 package node 10 11 import ( 12 "context" 13 "io" 14 "net/http" 15 16 "github.com/golang/protobuf/descriptor" 17 "github.com/golang/protobuf/proto" 18 "github.com/grpc-ecosystem/grpc-gateway/runtime" 19 "github.com/grpc-ecosystem/grpc-gateway/utilities" 20 "google.golang.org/grpc" 21 "google.golang.org/grpc/codes" 22 "google.golang.org/grpc/grpclog" 23 "google.golang.org/grpc/metadata" 24 "google.golang.org/grpc/status" 25 ) 26 27 // Suppress "imported and not used" errors 28 var _ codes.Code 29 var _ io.Reader 30 var _ status.Status 31 var _ = runtime.String 32 var _ = utilities.NewDoubleArray 33 var _ = descriptor.ForMessage 34 var _ = metadata.Join 35 36 func request_Service_Config_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 37 var protoReq ConfigRequest 38 var metadata runtime.ServerMetadata 39 40 msg, err := client.Config(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 41 return msg, metadata, err 42 43 } 44 45 func local_request_Service_Config_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 46 var protoReq ConfigRequest 47 var metadata runtime.ServerMetadata 48 49 msg, err := server.Config(ctx, &protoReq) 50 return msg, metadata, err 51 52 } 53 54 func request_Service_Status_0(ctx context.Context, marshaler runtime.Marshaler, client ServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 55 var protoReq StatusRequest 56 var metadata runtime.ServerMetadata 57 58 msg, err := client.Status(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) 59 return msg, metadata, err 60 61 } 62 63 func local_request_Service_Status_0(ctx context.Context, marshaler runtime.Marshaler, server ServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { 64 var protoReq StatusRequest 65 var metadata runtime.ServerMetadata 66 67 msg, err := server.Status(ctx, &protoReq) 68 return msg, metadata, err 69 70 } 71 72 // RegisterServiceHandlerServer registers the http handlers for service Service to "mux". 73 // UnaryRPC :call ServiceServer directly. 74 // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. 75 // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterServiceHandlerFromEndpoint instead. 76 func RegisterServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server ServiceServer) error { 77 78 mux.Handle("GET", pattern_Service_Config_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 79 ctx, cancel := context.WithCancel(req.Context()) 80 defer cancel() 81 var stream runtime.ServerTransportStream 82 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 83 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 84 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 85 if err != nil { 86 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 87 return 88 } 89 resp, md, err := local_request_Service_Config_0(rctx, inboundMarshaler, server, req, pathParams) 90 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 91 ctx = runtime.NewServerMetadataContext(ctx, md) 92 if err != nil { 93 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 94 return 95 } 96 97 forward_Service_Config_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 98 99 }) 100 101 mux.Handle("GET", pattern_Service_Status_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 102 ctx, cancel := context.WithCancel(req.Context()) 103 defer cancel() 104 var stream runtime.ServerTransportStream 105 ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) 106 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 107 rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) 108 if err != nil { 109 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 110 return 111 } 112 resp, md, err := local_request_Service_Status_0(rctx, inboundMarshaler, server, req, pathParams) 113 md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) 114 ctx = runtime.NewServerMetadataContext(ctx, md) 115 if err != nil { 116 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 117 return 118 } 119 120 forward_Service_Status_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 121 122 }) 123 124 return nil 125 } 126 127 // RegisterServiceHandlerFromEndpoint is same as RegisterServiceHandler but 128 // automatically dials to "endpoint" and closes the connection when "ctx" gets done. 129 func RegisterServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { 130 conn, err := grpc.Dial(endpoint, opts...) 131 if err != nil { 132 return err 133 } 134 defer func() { 135 if err != nil { 136 if cerr := conn.Close(); cerr != nil { 137 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 138 } 139 return 140 } 141 go func() { 142 <-ctx.Done() 143 if cerr := conn.Close(); cerr != nil { 144 grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) 145 } 146 }() 147 }() 148 149 return RegisterServiceHandler(ctx, mux, conn) 150 } 151 152 // RegisterServiceHandler registers the http handlers for service Service to "mux". 153 // The handlers forward requests to the grpc endpoint over "conn". 154 func RegisterServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { 155 return RegisterServiceHandlerClient(ctx, mux, NewServiceClient(conn)) 156 } 157 158 // RegisterServiceHandlerClient registers the http handlers for service Service 159 // to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "ServiceClient". 160 // Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "ServiceClient" 161 // doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in 162 // "ServiceClient" to call the correct interceptors. 163 func RegisterServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client ServiceClient) error { 164 165 mux.Handle("GET", pattern_Service_Config_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 166 ctx, cancel := context.WithCancel(req.Context()) 167 defer cancel() 168 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 169 rctx, err := runtime.AnnotateContext(ctx, mux, req) 170 if err != nil { 171 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 172 return 173 } 174 resp, md, err := request_Service_Config_0(rctx, inboundMarshaler, client, req, pathParams) 175 ctx = runtime.NewServerMetadataContext(ctx, md) 176 if err != nil { 177 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 178 return 179 } 180 181 forward_Service_Config_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 182 183 }) 184 185 mux.Handle("GET", pattern_Service_Status_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { 186 ctx, cancel := context.WithCancel(req.Context()) 187 defer cancel() 188 inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) 189 rctx, err := runtime.AnnotateContext(ctx, mux, req) 190 if err != nil { 191 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 192 return 193 } 194 resp, md, err := request_Service_Status_0(rctx, inboundMarshaler, client, req, pathParams) 195 ctx = runtime.NewServerMetadataContext(ctx, md) 196 if err != nil { 197 runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) 198 return 199 } 200 201 forward_Service_Status_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) 202 203 }) 204 205 return nil 206 } 207 208 var ( 209 pattern_Service_Config_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmos", "base", "node", "v1beta1", "config"}, "", runtime.AssumeColonVerbOpt(false))) 210 211 pattern_Service_Status_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3, 2, 4}, []string{"cosmos", "base", "node", "v1beta1", "status"}, "", runtime.AssumeColonVerbOpt(false))) 212 ) 213 214 var ( 215 forward_Service_Config_0 = runtime.ForwardResponseMessage 216 217 forward_Service_Status_0 = runtime.ForwardResponseMessage 218 )