// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.3.0
// - protoc             v3.19.4
// source: pkg/net/gobus.proto

//
//Файл содержит описание сервиса шины данных с необходимыми
//структурами.

package netapi

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

const (
	GoBus_Public_FullMethodName          = "/parserin.GoBus/Public"
	GoBus_SendSync_FullMethodName        = "/parserin.GoBus/SendSync"
	GoBus_Subscribe_FullMethodName       = "/parserin.GoBus/Subscribe"
	GoBus_SubscribeBuffer_FullMethodName = "/parserin.GoBus/SubscribeBuffer"
	GoBus_Get_FullMethodName             = "/parserin.GoBus/Get"
)

// GoBusClient is the client API for GoBus 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 GoBusClient interface {
	// Public -- создаёт запись в открытом разделе хранилище
	Public(ctx context.Context, in *PublicRequest, opts ...grpc.CallOption) (*DefaultResponse, error)
	// SendSync -- синхронный запрос в топик
	SendSync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error)
	// Subscribe -- подписка по шаблону
	Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (GoBus_SubscribeClient, error)
	// SubscribeBuffer -- подписка по шаблону с буфером на выход
	SubscribeBuffer(ctx context.Context, in *BuffRequest, opts ...grpc.CallOption) (GoBus_SubscribeBufferClient, error)
	// Get -- возвращает значения топиков по шаблону
	Get(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (*SyncResponse, error)
}

type goBusClient struct {
	cc grpc.ClientConnInterface
}

func NewGoBusClient(cc grpc.ClientConnInterface) GoBusClient {
	return &goBusClient{cc}
}

func (c *goBusClient) Public(ctx context.Context, in *PublicRequest, opts ...grpc.CallOption) (*DefaultResponse, error) {
	out := new(DefaultResponse)
	err := c.cc.Invoke(ctx, GoBus_Public_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *goBusClient) SendSync(ctx context.Context, in *SyncRequest, opts ...grpc.CallOption) (*SyncResponse, error) {
	out := new(SyncResponse)
	err := c.cc.Invoke(ctx, GoBus_SendSync_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *goBusClient) Subscribe(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (GoBus_SubscribeClient, error) {
	stream, err := c.cc.NewStream(ctx, &GoBus_ServiceDesc.Streams[0], GoBus_Subscribe_FullMethodName, opts...)
	if err != nil {
		return nil, err
	}
	x := &goBusSubscribeClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type GoBus_SubscribeClient interface {
	Recv() (*SyncResponse, error)
	grpc.ClientStream
}

type goBusSubscribeClient struct {
	grpc.ClientStream
}

func (x *goBusSubscribeClient) Recv() (*SyncResponse, error) {
	m := new(SyncResponse)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *goBusClient) SubscribeBuffer(ctx context.Context, in *BuffRequest, opts ...grpc.CallOption) (GoBus_SubscribeBufferClient, error) {
	stream, err := c.cc.NewStream(ctx, &GoBus_ServiceDesc.Streams[1], GoBus_SubscribeBuffer_FullMethodName, opts...)
	if err != nil {
		return nil, err
	}
	x := &goBusSubscribeBufferClient{stream}
	if err := x.ClientStream.SendMsg(in); err != nil {
		return nil, err
	}
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	return x, nil
}

type GoBus_SubscribeBufferClient interface {
	Recv() (*BuffResponse, error)
	grpc.ClientStream
}

type goBusSubscribeBufferClient struct {
	grpc.ClientStream
}

func (x *goBusSubscribeBufferClient) Recv() (*BuffResponse, error) {
	m := new(BuffResponse)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *goBusClient) Get(ctx context.Context, in *SubscribeRequest, opts ...grpc.CallOption) (*SyncResponse, error) {
	out := new(SyncResponse)
	err := c.cc.Invoke(ctx, GoBus_Get_FullMethodName, in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// GoBusServer is the server API for GoBus service.
// All implementations must embed UnimplementedGoBusServer
// for forward compatibility
type GoBusServer interface {
	// Public -- создаёт запись в открытом разделе хранилище
	Public(context.Context, *PublicRequest) (*DefaultResponse, error)
	// SendSync -- синхронный запрос в топик
	SendSync(context.Context, *SyncRequest) (*SyncResponse, error)
	// Subscribe -- подписка по шаблону
	Subscribe(*SubscribeRequest, GoBus_SubscribeServer) error
	// SubscribeBuffer -- подписка по шаблону с буфером на выход
	SubscribeBuffer(*BuffRequest, GoBus_SubscribeBufferServer) error
	// Get -- возвращает значения топиков по шаблону
	Get(context.Context, *SubscribeRequest) (*SyncResponse, error)
	mustEmbedUnimplementedGoBusServer()
}

// UnimplementedGoBusServer must be embedded to have forward compatible implementations.
type UnimplementedGoBusServer struct {
}

func (UnimplementedGoBusServer) Public(context.Context, *PublicRequest) (*DefaultResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Public not implemented")
}
func (UnimplementedGoBusServer) SendSync(context.Context, *SyncRequest) (*SyncResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method SendSync not implemented")
}
func (UnimplementedGoBusServer) Subscribe(*SubscribeRequest, GoBus_SubscribeServer) error {
	return status.Errorf(codes.Unimplemented, "method Subscribe not implemented")
}
func (UnimplementedGoBusServer) SubscribeBuffer(*BuffRequest, GoBus_SubscribeBufferServer) error {
	return status.Errorf(codes.Unimplemented, "method SubscribeBuffer not implemented")
}
func (UnimplementedGoBusServer) Get(context.Context, *SubscribeRequest) (*SyncResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Get not implemented")
}
func (UnimplementedGoBusServer) mustEmbedUnimplementedGoBusServer() {}

// UnsafeGoBusServer may be embedded to opt out of forward compatibility for this service.
// Use of this interface is not recommended, as added methods to GoBusServer will
// result in compilation errors.
type UnsafeGoBusServer interface {
	mustEmbedUnimplementedGoBusServer()
}

func RegisterGoBusServer(s grpc.ServiceRegistrar, srv GoBusServer) {
	s.RegisterService(&GoBus_ServiceDesc, srv)
}

func _GoBus_Public_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(PublicRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(GoBusServer).Public(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: GoBus_Public_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(GoBusServer).Public(ctx, req.(*PublicRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _GoBus_SendSync_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SyncRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(GoBusServer).SendSync(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: GoBus_SendSync_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(GoBusServer).SendSync(ctx, req.(*SyncRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _GoBus_Subscribe_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(SubscribeRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(GoBusServer).Subscribe(m, &goBusSubscribeServer{stream})
}

type GoBus_SubscribeServer interface {
	Send(*SyncResponse) error
	grpc.ServerStream
}

type goBusSubscribeServer struct {
	grpc.ServerStream
}

func (x *goBusSubscribeServer) Send(m *SyncResponse) error {
	return x.ServerStream.SendMsg(m)
}

func _GoBus_SubscribeBuffer_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(BuffRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(GoBusServer).SubscribeBuffer(m, &goBusSubscribeBufferServer{stream})
}

type GoBus_SubscribeBufferServer interface {
	Send(*BuffResponse) error
	grpc.ServerStream
}

type goBusSubscribeBufferServer struct {
	grpc.ServerStream
}

func (x *goBusSubscribeBufferServer) Send(m *BuffResponse) error {
	return x.ServerStream.SendMsg(m)
}

func _GoBus_Get_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(SubscribeRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(GoBusServer).Get(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: GoBus_Get_FullMethodName,
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(GoBusServer).Get(ctx, req.(*SubscribeRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// GoBus_ServiceDesc is the grpc.ServiceDesc for GoBus service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var GoBus_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "parserin.GoBus",
	HandlerType: (*GoBusServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Public",
			Handler:    _GoBus_Public_Handler,
		},
		{
			MethodName: "SendSync",
			Handler:    _GoBus_SendSync_Handler,
		},
		{
			MethodName: "Get",
			Handler:    _GoBus_Get_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Subscribe",
			Handler:       _GoBus_Subscribe_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "SubscribeBuffer",
			Handler:       _GoBus_SubscribeBuffer_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "pkg/net/gobus.proto",
}
