blob: 005ab39130e09874f966733ab7389e367f60592e [file] [log] [blame]
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// Code generated by protoc-gen-triple. DO NOT EDIT.
//
// Source: reflection.proto
package triple_reflection
import (
"context"
"net/http"
)
import (
"dubbo.apache.org/dubbo-go/v3"
"dubbo.apache.org/dubbo-go/v3/client"
"dubbo.apache.org/dubbo-go/v3/common"
"dubbo.apache.org/dubbo-go/v3/common/constant"
"dubbo.apache.org/dubbo-go/v3/protocol/triple/triple_protocol"
"dubbo.apache.org/dubbo-go/v3/server"
)
// This is a compile-time assertion to ensure that this generated file and the Triple package
// are compatible. If you get a compiler error that this constant is not defined, this code was
// generated with a version of Triple newer than the one compiled into your binary. You can fix the
// problem by either regenerating this code with an older version of Triple or updating the Triple
// version compiled into your binary.
const _ = triple_protocol.IsAtLeastVersion0_1_0
const (
// ServerReflectionName is the fully-qualified name of the ServerReflection service.
ServerReflectionName = "dubbo.reflection.v1alpha.ServerReflection"
)
// These constants are the fully-qualified names of the RPCs defined in this package. They're
// exposed at runtime as procedure and as the final two segments of the HTTP route.
//
// Note that these are different from the fully-qualified method names used by
// google.golang.org/protobuf/reflect/protoreflect. To convert from these constants to
// reflection-formatted method names, remove the leading slash and convert the remaining slash to a
// period.
const (
// ServerReflectionServerReflectionInfoProcedure is the fully-qualified name of the ServerReflection's ServerReflectionInfo RPC.
ServerReflectionServerReflectionInfoProcedure = "/dubbo.reflection.v1alpha.ServerReflection/ServerReflectionInfo"
)
var (
_ ServerReflection = (*ServerReflectionImpl)(nil)
_ ServerReflection_ServerReflectionInfoClient = (*ServerReflectionServerReflectionInfoClient)(nil)
_ ServerReflection_ServerReflectionInfoServer = (*ServerReflectionServerReflectionInfoServer)(nil)
)
// ServerReflection is a client for the dubbo.reflection.v1alpha.ServerReflection service.
type ServerReflection interface {
ServerReflectionInfo(ctx context.Context, opts ...client.CallOption) (ServerReflection_ServerReflectionInfoClient, error)
}
// NewServerReflection constructs a client for the dubbo.reflection.v1alpha.ServerReflection service.
func NewServerReflection(cli *client.Client, opts ...client.ReferenceOption) (ServerReflection, error) {
conn, err := cli.DialWithInfo("dubbo.reflection.v1alpha.ServerReflection", &ServerReflection_ClientInfo, opts...)
if err != nil {
return nil, err
}
return &ServerReflectionImpl{
conn: conn,
}, nil
}
func SetConsumerService(srv common.RPCService) {
dubbo.SetConsumerServiceWithInfo(srv, &ServerReflection_ClientInfo)
}
// ServerReflectionImpl implements ServerReflection.
type ServerReflectionImpl struct {
conn *client.Connection
}
func (c *ServerReflectionImpl) ServerReflectionInfo(ctx context.Context, opts ...client.CallOption) (ServerReflection_ServerReflectionInfoClient, error) {
stream, err := c.conn.CallBidiStream(ctx, "ServerReflectionInfo", opts...)
if err != nil {
return nil, err
}
rawStream := stream.(*triple_protocol.BidiStreamForClient)
return &ServerReflectionServerReflectionInfoClient{rawStream}, nil
}
type ServerReflection_ServerReflectionInfoClient interface {
Spec() triple_protocol.Spec
Peer() triple_protocol.Peer
Send(*ServerReflectionRequest) error
RequestHeader() http.Header
CloseRequest() error
Recv() (*ServerReflectionResponse, error)
ResponseHeader() http.Header
ResponseTrailer() http.Header
CloseResponse() error
}
type ServerReflectionServerReflectionInfoClient struct {
*triple_protocol.BidiStreamForClient
}
func (cli *ServerReflectionServerReflectionInfoClient) Send(msg *ServerReflectionRequest) error {
return cli.BidiStreamForClient.Send(msg)
}
func (cli *ServerReflectionServerReflectionInfoClient) Recv() (*ServerReflectionResponse, error) {
msg := new(ServerReflectionResponse)
if err := cli.BidiStreamForClient.Receive(msg); err != nil {
return nil, err
}
return msg, nil
}
var ServerReflection_ClientInfo = client.ClientInfo{
InterfaceName: "dubbo.reflection.v1alpha.ServerReflection",
MethodNames: []string{"ServerReflectionInfo"},
ConnectionInjectFunc: func(dubboCliRaw interface{}, conn *client.Connection) {
dubboCli := dubboCliRaw.(*ServerReflectionImpl)
dubboCli.conn = conn
},
}
// ServerReflectionHandler is an implementation of the dubbo.reflection.v1alpha.ServerReflection service.
type ServerReflectionHandler interface {
ServerReflectionInfo(context.Context, ServerReflection_ServerReflectionInfoServer) error
}
func RegisterServerReflectionHandler(srv *server.Server, hdlr ServerReflectionHandler, opts ...server.ServiceOption) error {
return srv.Register(hdlr, &ServerReflection_ServiceInfo, opts...)
}
func SetProviderService(srv common.RPCService) {
dubbo.SetProviderServiceWithInfo(srv, &ServerReflection_ServiceInfo)
}
type ServerReflection_ServerReflectionInfoServer interface {
Send(*ServerReflectionResponse) error
Recv() (*ServerReflectionRequest, error)
Spec() triple_protocol.Spec
Peer() triple_protocol.Peer
RequestHeader() http.Header
ResponseHeader() http.Header
ResponseTrailer() http.Header
Conn() triple_protocol.StreamingHandlerConn
}
type ServerReflectionServerReflectionInfoServer struct {
*triple_protocol.BidiStream
}
func (srv *ServerReflectionServerReflectionInfoServer) Send(msg *ServerReflectionResponse) error {
return srv.BidiStream.Send(msg)
}
func (srv ServerReflectionServerReflectionInfoServer) Recv() (*ServerReflectionRequest, error) {
msg := new(ServerReflectionRequest)
if err := srv.BidiStream.Receive(msg); err != nil {
return nil, err
}
return msg, nil
}
var ServerReflection_ServiceInfo = server.ServiceInfo{
InterfaceName: "dubbo.reflection.v1alpha.ServerReflection",
ServiceType: (*ServerReflectionHandler)(nil),
Methods: []server.MethodInfo{
{
Name: "ServerReflectionInfo",
Type: constant.CallBidiStream,
StreamInitFunc: func(baseStream interface{}) interface{} {
return &ServerReflectionServerReflectionInfoServer{baseStream.(*triple_protocol.BidiStream)}
},
MethodFunc: func(ctx context.Context, args []interface{}, handler interface{}) (interface{}, error) {
stream := args[0].(ServerReflection_ServerReflectionInfoServer)
if err := handler.(ServerReflectionHandler).ServerReflectionInfo(ctx, stream); err != nil {
return nil, err
}
return nil, nil
},
},
},
}