2023-04-25 23:16:36 -04:00
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
2024-10-24 08:41:47 -04:00
// - protoc-gen-go-grpc v1.5.1
2024-11-22 09:40:43 -05:00
// - protoc v5.28.3
2023-04-25 23:16:36 -04:00
// source: proto/nezha.proto
package proto
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.
2024-10-24 08:41:47 -04:00
// Requires gRPC-Go v1.64.0 or later.
const _ = grpc . SupportPackageIsVersion9
2023-04-25 23:16:36 -04:00
const (
NezhaService_ReportSystemState_FullMethodName = "/proto.NezhaService/ReportSystemState"
NezhaService_ReportSystemInfo_FullMethodName = "/proto.NezhaService/ReportSystemInfo"
NezhaService_ReportTask_FullMethodName = "/proto.NezhaService/ReportTask"
NezhaService_RequestTask_FullMethodName = "/proto.NezhaService/RequestTask"
2024-07-14 00:47:36 -04:00
NezhaService_IOStream_FullMethodName = "/proto.NezhaService/IOStream"
2024-11-22 09:40:43 -05:00
NezhaService_ReportGeoIP_FullMethodName = "/proto.NezhaService/ReportGeoIP"
2023-04-25 23:16:36 -04:00
)
// NezhaServiceClient is the client API for NezhaService 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 NezhaServiceClient interface {
ReportSystemState ( ctx context . Context , in * State , opts ... grpc . CallOption ) ( * Receipt , error )
ReportSystemInfo ( ctx context . Context , in * Host , opts ... grpc . CallOption ) ( * Receipt , error )
ReportTask ( ctx context . Context , in * TaskResult , opts ... grpc . CallOption ) ( * Receipt , error )
2024-10-24 08:41:47 -04:00
RequestTask ( ctx context . Context , in * Host , opts ... grpc . CallOption ) ( grpc . ServerStreamingClient [ Task ] , error )
IOStream ( ctx context . Context , opts ... grpc . CallOption ) ( grpc . BidiStreamingClient [ IOStreamData , IOStreamData ] , error )
2024-11-22 09:40:43 -05:00
ReportGeoIP ( ctx context . Context , in * GeoIP , opts ... grpc . CallOption ) ( * GeoIP , error )
2023-04-25 23:16:36 -04:00
}
type nezhaServiceClient struct {
cc grpc . ClientConnInterface
}
func NewNezhaServiceClient ( cc grpc . ClientConnInterface ) NezhaServiceClient {
return & nezhaServiceClient { cc }
}
func ( c * nezhaServiceClient ) ReportSystemState ( ctx context . Context , in * State , opts ... grpc . CallOption ) ( * Receipt , error ) {
2024-10-24 08:41:47 -04:00
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
2023-04-25 23:16:36 -04:00
out := new ( Receipt )
2024-10-24 08:41:47 -04:00
err := c . cc . Invoke ( ctx , NezhaService_ReportSystemState_FullMethodName , in , out , cOpts ... )
2023-04-25 23:16:36 -04:00
if err != nil {
return nil , err
}
return out , nil
}
func ( c * nezhaServiceClient ) ReportSystemInfo ( ctx context . Context , in * Host , opts ... grpc . CallOption ) ( * Receipt , error ) {
2024-10-24 08:41:47 -04:00
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
2023-04-25 23:16:36 -04:00
out := new ( Receipt )
2024-10-24 08:41:47 -04:00
err := c . cc . Invoke ( ctx , NezhaService_ReportSystemInfo_FullMethodName , in , out , cOpts ... )
2023-04-25 23:16:36 -04:00
if err != nil {
return nil , err
}
return out , nil
}
func ( c * nezhaServiceClient ) ReportTask ( ctx context . Context , in * TaskResult , opts ... grpc . CallOption ) ( * Receipt , error ) {
2024-10-24 08:41:47 -04:00
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
2023-04-25 23:16:36 -04:00
out := new ( Receipt )
2024-10-24 08:41:47 -04:00
err := c . cc . Invoke ( ctx , NezhaService_ReportTask_FullMethodName , in , out , cOpts ... )
2023-04-25 23:16:36 -04:00
if err != nil {
return nil , err
}
return out , nil
}
2024-10-24 08:41:47 -04:00
func ( c * nezhaServiceClient ) RequestTask ( ctx context . Context , in * Host , opts ... grpc . CallOption ) ( grpc . ServerStreamingClient [ Task ] , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
stream , err := c . cc . NewStream ( ctx , & NezhaService_ServiceDesc . Streams [ 0 ] , NezhaService_RequestTask_FullMethodName , cOpts ... )
2023-04-25 23:16:36 -04:00
if err != nil {
return nil , err
}
2024-10-24 08:41:47 -04:00
x := & grpc . GenericClientStream [ Host , Task ] { ClientStream : stream }
2023-04-25 23:16:36 -04:00
if err := x . ClientStream . SendMsg ( in ) ; err != nil {
return nil , err
}
if err := x . ClientStream . CloseSend ( ) ; err != nil {
return nil , err
}
return x , nil
}
2024-10-24 08:41:47 -04:00
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type NezhaService_RequestTaskClient = grpc . ServerStreamingClient [ Task ]
2023-04-25 23:16:36 -04:00
2024-10-24 08:41:47 -04:00
func ( c * nezhaServiceClient ) IOStream ( ctx context . Context , opts ... grpc . CallOption ) ( grpc . BidiStreamingClient [ IOStreamData , IOStreamData ] , error ) {
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
stream , err := c . cc . NewStream ( ctx , & NezhaService_ServiceDesc . Streams [ 1 ] , NezhaService_IOStream_FullMethodName , cOpts ... )
2024-07-14 00:47:36 -04:00
if err != nil {
return nil , err
}
2024-10-24 08:41:47 -04:00
x := & grpc . GenericClientStream [ IOStreamData , IOStreamData ] { ClientStream : stream }
2024-07-14 00:47:36 -04:00
return x , nil
}
2024-10-24 08:41:47 -04:00
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type NezhaService_IOStreamClient = grpc . BidiStreamingClient [ IOStreamData , IOStreamData ]
2024-07-14 00:47:36 -04:00
2024-11-22 09:40:43 -05:00
func ( c * nezhaServiceClient ) ReportGeoIP ( ctx context . Context , in * GeoIP , opts ... grpc . CallOption ) ( * GeoIP , error ) {
2024-10-24 08:41:47 -04:00
cOpts := append ( [ ] grpc . CallOption { grpc . StaticMethod ( ) } , opts ... )
2024-07-28 01:59:58 -04:00
out := new ( GeoIP )
2024-11-22 09:40:43 -05:00
err := c . cc . Invoke ( ctx , NezhaService_ReportGeoIP_FullMethodName , in , out , cOpts ... )
2024-07-28 01:59:58 -04:00
if err != nil {
return nil , err
}
return out , nil
}
2023-04-25 23:16:36 -04:00
// NezhaServiceServer is the server API for NezhaService service.
// All implementations should embed UnimplementedNezhaServiceServer
2024-10-24 08:41:47 -04:00
// for forward compatibility.
2023-04-25 23:16:36 -04:00
type NezhaServiceServer interface {
ReportSystemState ( context . Context , * State ) ( * Receipt , error )
ReportSystemInfo ( context . Context , * Host ) ( * Receipt , error )
ReportTask ( context . Context , * TaskResult ) ( * Receipt , error )
2024-10-24 08:41:47 -04:00
RequestTask ( * Host , grpc . ServerStreamingServer [ Task ] ) error
IOStream ( grpc . BidiStreamingServer [ IOStreamData , IOStreamData ] ) error
2024-11-22 09:40:43 -05:00
ReportGeoIP ( context . Context , * GeoIP ) ( * GeoIP , error )
2023-04-25 23:16:36 -04:00
}
2024-10-24 08:41:47 -04:00
// UnimplementedNezhaServiceServer should be embedded to have
// forward compatible implementations.
//
// NOTE: this should be embedded by value instead of pointer to avoid a nil
// pointer dereference when methods are called.
type UnimplementedNezhaServiceServer struct { }
2023-04-25 23:16:36 -04:00
func ( UnimplementedNezhaServiceServer ) ReportSystemState ( context . Context , * State ) ( * Receipt , error ) {
return nil , status . Errorf ( codes . Unimplemented , "method ReportSystemState not implemented" )
}
func ( UnimplementedNezhaServiceServer ) ReportSystemInfo ( context . Context , * Host ) ( * Receipt , error ) {
return nil , status . Errorf ( codes . Unimplemented , "method ReportSystemInfo not implemented" )
}
func ( UnimplementedNezhaServiceServer ) ReportTask ( context . Context , * TaskResult ) ( * Receipt , error ) {
return nil , status . Errorf ( codes . Unimplemented , "method ReportTask not implemented" )
}
2024-10-24 08:41:47 -04:00
func ( UnimplementedNezhaServiceServer ) RequestTask ( * Host , grpc . ServerStreamingServer [ Task ] ) error {
2023-04-25 23:16:36 -04:00
return status . Errorf ( codes . Unimplemented , "method RequestTask not implemented" )
}
2024-10-24 08:41:47 -04:00
func ( UnimplementedNezhaServiceServer ) IOStream ( grpc . BidiStreamingServer [ IOStreamData , IOStreamData ] ) error {
2024-07-14 00:47:36 -04:00
return status . Errorf ( codes . Unimplemented , "method IOStream not implemented" )
}
2024-11-22 09:40:43 -05:00
func ( UnimplementedNezhaServiceServer ) ReportGeoIP ( context . Context , * GeoIP ) ( * GeoIP , error ) {
return nil , status . Errorf ( codes . Unimplemented , "method ReportGeoIP not implemented" )
2024-07-28 01:59:58 -04:00
}
2024-10-24 08:41:47 -04:00
func ( UnimplementedNezhaServiceServer ) testEmbeddedByValue ( ) { }
2023-04-25 23:16:36 -04:00
// UnsafeNezhaServiceServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to NezhaServiceServer will
// result in compilation errors.
type UnsafeNezhaServiceServer interface {
mustEmbedUnimplementedNezhaServiceServer ( )
}
func RegisterNezhaServiceServer ( s grpc . ServiceRegistrar , srv NezhaServiceServer ) {
2024-10-24 08:41:47 -04:00
// If the following call panics, it indicates UnimplementedNezhaServiceServer was
// embedded by pointer and is nil. This will cause panics if an
// unimplemented method is ever invoked, so we test this at initialization
// time to prevent it from happening at runtime later due to I/O.
if t , ok := srv . ( interface { testEmbeddedByValue ( ) } ) ; ok {
t . testEmbeddedByValue ( )
}
2023-04-25 23:16:36 -04:00
s . RegisterService ( & NezhaService_ServiceDesc , srv )
}
func _NezhaService_ReportSystemState_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( State )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( NezhaServiceServer ) . ReportSystemState ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : NezhaService_ReportSystemState_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( NezhaServiceServer ) . ReportSystemState ( ctx , req . ( * State ) )
}
return interceptor ( ctx , in , info , handler )
}
func _NezhaService_ReportSystemInfo_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( Host )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( NezhaServiceServer ) . ReportSystemInfo ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : NezhaService_ReportSystemInfo_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( NezhaServiceServer ) . ReportSystemInfo ( ctx , req . ( * Host ) )
}
return interceptor ( ctx , in , info , handler )
}
func _NezhaService_ReportTask_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
in := new ( TaskResult )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
return srv . ( NezhaServiceServer ) . ReportTask ( ctx , in )
}
info := & grpc . UnaryServerInfo {
Server : srv ,
FullMethod : NezhaService_ReportTask_FullMethodName ,
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
return srv . ( NezhaServiceServer ) . ReportTask ( ctx , req . ( * TaskResult ) )
}
return interceptor ( ctx , in , info , handler )
}
func _NezhaService_RequestTask_Handler ( srv interface { } , stream grpc . ServerStream ) error {
m := new ( Host )
if err := stream . RecvMsg ( m ) ; err != nil {
return err
}
2024-10-24 08:41:47 -04:00
return srv . ( NezhaServiceServer ) . RequestTask ( m , & grpc . GenericServerStream [ Host , Task ] { ServerStream : stream } )
2023-04-25 23:16:36 -04:00
}
2024-10-24 08:41:47 -04:00
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type NezhaService_RequestTaskServer = grpc . ServerStreamingServer [ Task ]
2023-04-25 23:16:36 -04:00
2024-07-14 00:47:36 -04:00
func _NezhaService_IOStream_Handler ( srv interface { } , stream grpc . ServerStream ) error {
2024-10-24 08:41:47 -04:00
return srv . ( NezhaServiceServer ) . IOStream ( & grpc . GenericServerStream [ IOStreamData , IOStreamData ] { ServerStream : stream } )
2024-07-14 00:47:36 -04:00
}
2024-10-24 08:41:47 -04:00
// This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.
type NezhaService_IOStreamServer = grpc . BidiStreamingServer [ IOStreamData , IOStreamData ]
2024-07-14 00:47:36 -04:00
2024-11-22 09:40:43 -05:00
func _NezhaService_ReportGeoIP_Handler ( srv interface { } , ctx context . Context , dec func ( interface { } ) error , interceptor grpc . UnaryServerInterceptor ) ( interface { } , error ) {
2024-07-28 01:59:58 -04:00
in := new ( GeoIP )
if err := dec ( in ) ; err != nil {
return nil , err
}
if interceptor == nil {
2024-11-22 09:40:43 -05:00
return srv . ( NezhaServiceServer ) . ReportGeoIP ( ctx , in )
2024-07-28 01:59:58 -04:00
}
info := & grpc . UnaryServerInfo {
Server : srv ,
2024-11-22 09:40:43 -05:00
FullMethod : NezhaService_ReportGeoIP_FullMethodName ,
2024-07-28 01:59:58 -04:00
}
handler := func ( ctx context . Context , req interface { } ) ( interface { } , error ) {
2024-11-22 09:40:43 -05:00
return srv . ( NezhaServiceServer ) . ReportGeoIP ( ctx , req . ( * GeoIP ) )
2024-07-28 01:59:58 -04:00
}
return interceptor ( ctx , in , info , handler )
}
2023-04-25 23:16:36 -04:00
// NezhaService_ServiceDesc is the grpc.ServiceDesc for NezhaService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var NezhaService_ServiceDesc = grpc . ServiceDesc {
ServiceName : "proto.NezhaService" ,
HandlerType : ( * NezhaServiceServer ) ( nil ) ,
Methods : [ ] grpc . MethodDesc {
{
MethodName : "ReportSystemState" ,
Handler : _NezhaService_ReportSystemState_Handler ,
} ,
{
MethodName : "ReportSystemInfo" ,
Handler : _NezhaService_ReportSystemInfo_Handler ,
} ,
{
MethodName : "ReportTask" ,
Handler : _NezhaService_ReportTask_Handler ,
} ,
2024-07-28 01:59:58 -04:00
{
2024-11-22 09:40:43 -05:00
MethodName : "ReportGeoIP" ,
Handler : _NezhaService_ReportGeoIP_Handler ,
2024-07-28 01:59:58 -04:00
} ,
2023-04-25 23:16:36 -04:00
} ,
Streams : [ ] grpc . StreamDesc {
{
StreamName : "RequestTask" ,
Handler : _NezhaService_RequestTask_Handler ,
ServerStreams : true ,
} ,
2024-07-14 00:47:36 -04:00
{
StreamName : "IOStream" ,
Handler : _NezhaService_IOStream_Handler ,
ServerStreams : true ,
ClientStreams : true ,
} ,
2023-04-25 23:16:36 -04:00
} ,
Metadata : "proto/nezha.proto" ,
}