mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-26 08:15:19 +00:00
142 lines
4.6 KiB
Go
142 lines
4.6 KiB
Go
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||
|
// versions:
|
||
|
// - protoc-gen-go-grpc v1.2.0
|
||
|
// - protoc v4.25.3
|
||
|
// source: light/light.proto
|
||
|
|
||
|
package light
|
||
|
|
||
|
import (
|
||
|
context "context"
|
||
|
grpc "google.golang.org/grpc"
|
||
|
codes "google.golang.org/grpc/codes"
|
||
|
status "google.golang.org/grpc/status"
|
||
|
)
|
||
|
|
||
|
// This is a compile-time assertion to ensure that this generated file
|
||
|
// is compatible with the grpc package it is being compiled against.
|
||
|
// Requires gRPC-Go v1.32.0 or later.
|
||
|
const _ = grpc.SupportPackageIsVersion7
|
||
|
|
||
|
// LightClient is the client API for Light service.
|
||
|
//
|
||
|
// 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.
|
||
|
type LightClient interface {
|
||
|
Sample(ctx context.Context, in *SampleRequest, opts ...grpc.CallOption) (*SampleReply, error)
|
||
|
Retrieve(ctx context.Context, in *RetrieveRequest, opts ...grpc.CallOption) (*RetrieveReply, error)
|
||
|
}
|
||
|
|
||
|
type lightClient struct {
|
||
|
cc grpc.ClientConnInterface
|
||
|
}
|
||
|
|
||
|
func NewLightClient(cc grpc.ClientConnInterface) LightClient {
|
||
|
return &lightClient{cc}
|
||
|
}
|
||
|
|
||
|
func (c *lightClient) Sample(ctx context.Context, in *SampleRequest, opts ...grpc.CallOption) (*SampleReply, error) {
|
||
|
out := new(SampleReply)
|
||
|
err := c.cc.Invoke(ctx, "/light.Light/Sample", in, out, opts...)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return out, nil
|
||
|
}
|
||
|
|
||
|
func (c *lightClient) Retrieve(ctx context.Context, in *RetrieveRequest, opts ...grpc.CallOption) (*RetrieveReply, error) {
|
||
|
out := new(RetrieveReply)
|
||
|
err := c.cc.Invoke(ctx, "/light.Light/Retrieve", in, out, opts...)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return out, nil
|
||
|
}
|
||
|
|
||
|
// LightServer is the server API for Light service.
|
||
|
// All implementations must embed UnimplementedLightServer
|
||
|
// for forward compatibility
|
||
|
type LightServer interface {
|
||
|
Sample(context.Context, *SampleRequest) (*SampleReply, error)
|
||
|
Retrieve(context.Context, *RetrieveRequest) (*RetrieveReply, error)
|
||
|
mustEmbedUnimplementedLightServer()
|
||
|
}
|
||
|
|
||
|
// UnimplementedLightServer must be embedded to have forward compatible implementations.
|
||
|
type UnimplementedLightServer struct {
|
||
|
}
|
||
|
|
||
|
func (UnimplementedLightServer) Sample(context.Context, *SampleRequest) (*SampleReply, error) {
|
||
|
return nil, status.Errorf(codes.Unimplemented, "method Sample not implemented")
|
||
|
}
|
||
|
func (UnimplementedLightServer) Retrieve(context.Context, *RetrieveRequest) (*RetrieveReply, error) {
|
||
|
return nil, status.Errorf(codes.Unimplemented, "method Retrieve not implemented")
|
||
|
}
|
||
|
func (UnimplementedLightServer) mustEmbedUnimplementedLightServer() {}
|
||
|
|
||
|
// UnsafeLightServer may be embedded to opt out of forward compatibility for this service.
|
||
|
// Use of this interface is not recommended, as added methods to LightServer will
|
||
|
// result in compilation errors.
|
||
|
type UnsafeLightServer interface {
|
||
|
mustEmbedUnimplementedLightServer()
|
||
|
}
|
||
|
|
||
|
func RegisterLightServer(s grpc.ServiceRegistrar, srv LightServer) {
|
||
|
s.RegisterService(&Light_ServiceDesc, srv)
|
||
|
}
|
||
|
|
||
|
func _Light_Sample_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
in := new(SampleRequest)
|
||
|
if err := dec(in); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if interceptor == nil {
|
||
|
return srv.(LightServer).Sample(ctx, in)
|
||
|
}
|
||
|
info := &grpc.UnaryServerInfo{
|
||
|
Server: srv,
|
||
|
FullMethod: "/light.Light/Sample",
|
||
|
}
|
||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
return srv.(LightServer).Sample(ctx, req.(*SampleRequest))
|
||
|
}
|
||
|
return interceptor(ctx, in, info, handler)
|
||
|
}
|
||
|
|
||
|
func _Light_Retrieve_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
in := new(RetrieveRequest)
|
||
|
if err := dec(in); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if interceptor == nil {
|
||
|
return srv.(LightServer).Retrieve(ctx, in)
|
||
|
}
|
||
|
info := &grpc.UnaryServerInfo{
|
||
|
Server: srv,
|
||
|
FullMethod: "/light.Light/Retrieve",
|
||
|
}
|
||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
return srv.(LightServer).Retrieve(ctx, req.(*RetrieveRequest))
|
||
|
}
|
||
|
return interceptor(ctx, in, info, handler)
|
||
|
}
|
||
|
|
||
|
// Light_ServiceDesc is the grpc.ServiceDesc for Light service.
|
||
|
// It's only intended for direct use with grpc.RegisterService,
|
||
|
// and not to be introspected or modified (even as a copy)
|
||
|
var Light_ServiceDesc = grpc.ServiceDesc{
|
||
|
ServiceName: "light.Light",
|
||
|
HandlerType: (*LightServer)(nil),
|
||
|
Methods: []grpc.MethodDesc{
|
||
|
{
|
||
|
MethodName: "Sample",
|
||
|
Handler: _Light_Sample_Handler,
|
||
|
},
|
||
|
{
|
||
|
MethodName: "Retrieve",
|
||
|
Handler: _Light_Retrieve_Handler,
|
||
|
},
|
||
|
},
|
||
|
Streams: []grpc.StreamDesc{},
|
||
|
Metadata: "light/light.proto",
|
||
|
}
|