// Copyright 2018-2021 CERN
//
// Licensed 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.
//
// In applying this license, CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.2.0
// - protoc             v3.19.1
// source: Rpc.proto

package eos_grpc

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

// EosClient is the client API for Eos 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 EosClient interface {
	// Replies to a ping
	Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingReply, error)
	// Replies to MD requests with a stream
	MD(ctx context.Context, in *MDRequest, opts ...grpc.CallOption) (Eos_MDClient, error)
	// Replies to Find requests with a stream
	Find(ctx context.Context, in *FindRequest, opts ...grpc.CallOption) (Eos_FindClient, error)
	// Replies to a NsStat operation
	NsStat(ctx context.Context, in *NsStatRequest, opts ...grpc.CallOption) (*NsStatResponse, error)
	// Replies to an insert
	ContainerInsert(ctx context.Context, in *ContainerInsertRequest, opts ...grpc.CallOption) (*InsertReply, error)
	FileInsert(ctx context.Context, in *FileInsertRequest, opts ...grpc.CallOption) (*InsertReply, error)
	// Replies to a NsRequest operation
	Exec(ctx context.Context, in *NSRequest, opts ...grpc.CallOption) (*NSResponse, error)
	// Manila Driver
	ManilaServerRequest(ctx context.Context, in *ManilaRequest, opts ...grpc.CallOption) (*ManilaResponse, error)
}

type eosClient struct {
	cc grpc.ClientConnInterface
}

func NewEosClient(cc grpc.ClientConnInterface) EosClient {
	return &eosClient{cc}
}

func (c *eosClient) Ping(ctx context.Context, in *PingRequest, opts ...grpc.CallOption) (*PingReply, error) {
	out := new(PingReply)
	err := c.cc.Invoke(ctx, "/eos.rpc.Eos/Ping", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *eosClient) MD(ctx context.Context, in *MDRequest, opts ...grpc.CallOption) (Eos_MDClient, error) {
	stream, err := c.cc.NewStream(ctx, &Eos_ServiceDesc.Streams[0], "/eos.rpc.Eos/MD", opts...)
	if err != nil {
		return nil, err
	}
	x := &eosMDClient{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 Eos_MDClient interface {
	Recv() (*MDResponse, error)
	grpc.ClientStream
}

type eosMDClient struct {
	grpc.ClientStream
}

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

func (c *eosClient) Find(ctx context.Context, in *FindRequest, opts ...grpc.CallOption) (Eos_FindClient, error) {
	stream, err := c.cc.NewStream(ctx, &Eos_ServiceDesc.Streams[1], "/eos.rpc.Eos/Find", opts...)
	if err != nil {
		return nil, err
	}
	x := &eosFindClient{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 Eos_FindClient interface {
	Recv() (*MDResponse, error)
	grpc.ClientStream
}

type eosFindClient struct {
	grpc.ClientStream
}

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

func (c *eosClient) NsStat(ctx context.Context, in *NsStatRequest, opts ...grpc.CallOption) (*NsStatResponse, error) {
	out := new(NsStatResponse)
	err := c.cc.Invoke(ctx, "/eos.rpc.Eos/NsStat", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *eosClient) ContainerInsert(ctx context.Context, in *ContainerInsertRequest, opts ...grpc.CallOption) (*InsertReply, error) {
	out := new(InsertReply)
	err := c.cc.Invoke(ctx, "/eos.rpc.Eos/ContainerInsert", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *eosClient) FileInsert(ctx context.Context, in *FileInsertRequest, opts ...grpc.CallOption) (*InsertReply, error) {
	out := new(InsertReply)
	err := c.cc.Invoke(ctx, "/eos.rpc.Eos/FileInsert", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *eosClient) Exec(ctx context.Context, in *NSRequest, opts ...grpc.CallOption) (*NSResponse, error) {
	out := new(NSResponse)
	err := c.cc.Invoke(ctx, "/eos.rpc.Eos/Exec", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

func (c *eosClient) ManilaServerRequest(ctx context.Context, in *ManilaRequest, opts ...grpc.CallOption) (*ManilaResponse, error) {
	out := new(ManilaResponse)
	err := c.cc.Invoke(ctx, "/eos.rpc.Eos/ManilaServerRequest", in, out, opts...)
	if err != nil {
		return nil, err
	}
	return out, nil
}

// EosServer is the server API for Eos service.
// All implementations must embed UnimplementedEosServer
// for forward compatibility
type EosServer interface {
	// Replies to a ping
	Ping(context.Context, *PingRequest) (*PingReply, error)
	// Replies to MD requests with a stream
	MD(*MDRequest, Eos_MDServer) error
	// Replies to Find requests with a stream
	Find(*FindRequest, Eos_FindServer) error
	// Replies to a NsStat operation
	NsStat(context.Context, *NsStatRequest) (*NsStatResponse, error)
	// Replies to an insert
	ContainerInsert(context.Context, *ContainerInsertRequest) (*InsertReply, error)
	FileInsert(context.Context, *FileInsertRequest) (*InsertReply, error)
	// Replies to a NsRequest operation
	Exec(context.Context, *NSRequest) (*NSResponse, error)
	// Manila Driver
	ManilaServerRequest(context.Context, *ManilaRequest) (*ManilaResponse, error)
	mustEmbedUnimplementedEosServer()
}

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

func (UnimplementedEosServer) Ping(context.Context, *PingRequest) (*PingReply, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Ping not implemented")
}
func (UnimplementedEosServer) MD(*MDRequest, Eos_MDServer) error {
	return status.Errorf(codes.Unimplemented, "method MD not implemented")
}
func (UnimplementedEosServer) Find(*FindRequest, Eos_FindServer) error {
	return status.Errorf(codes.Unimplemented, "method Find not implemented")
}
func (UnimplementedEosServer) NsStat(context.Context, *NsStatRequest) (*NsStatResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method NsStat not implemented")
}
func (UnimplementedEosServer) ContainerInsert(context.Context, *ContainerInsertRequest) (*InsertReply, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ContainerInsert not implemented")
}
func (UnimplementedEosServer) FileInsert(context.Context, *FileInsertRequest) (*InsertReply, error) {
	return nil, status.Errorf(codes.Unimplemented, "method FileInsert not implemented")
}
func (UnimplementedEosServer) Exec(context.Context, *NSRequest) (*NSResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method Exec not implemented")
}
func (UnimplementedEosServer) ManilaServerRequest(context.Context, *ManilaRequest) (*ManilaResponse, error) {
	return nil, status.Errorf(codes.Unimplemented, "method ManilaServerRequest not implemented")
}
func (UnimplementedEosServer) mustEmbedUnimplementedEosServer() {}

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

func RegisterEosServer(s grpc.ServiceRegistrar, srv EosServer) {
	s.RegisterService(&Eos_ServiceDesc, srv)
}

func _Eos_Ping_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(PingRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EosServer).Ping(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/eos.rpc.Eos/Ping",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EosServer).Ping(ctx, req.(*PingRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Eos_MD_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(MDRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(EosServer).MD(m, &eosMDServer{stream})
}

type Eos_MDServer interface {
	Send(*MDResponse) error
	grpc.ServerStream
}

type eosMDServer struct {
	grpc.ServerStream
}

func (x *eosMDServer) Send(m *MDResponse) error {
	return x.ServerStream.SendMsg(m)
}

func _Eos_Find_Handler(srv interface{}, stream grpc.ServerStream) error {
	m := new(FindRequest)
	if err := stream.RecvMsg(m); err != nil {
		return err
	}
	return srv.(EosServer).Find(m, &eosFindServer{stream})
}

type Eos_FindServer interface {
	Send(*MDResponse) error
	grpc.ServerStream
}

type eosFindServer struct {
	grpc.ServerStream
}

func (x *eosFindServer) Send(m *MDResponse) error {
	return x.ServerStream.SendMsg(m)
}

func _Eos_NsStat_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(NsStatRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EosServer).NsStat(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/eos.rpc.Eos/NsStat",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EosServer).NsStat(ctx, req.(*NsStatRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Eos_ContainerInsert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ContainerInsertRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EosServer).ContainerInsert(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/eos.rpc.Eos/ContainerInsert",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EosServer).ContainerInsert(ctx, req.(*ContainerInsertRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Eos_FileInsert_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(FileInsertRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EosServer).FileInsert(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/eos.rpc.Eos/FileInsert",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EosServer).FileInsert(ctx, req.(*FileInsertRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Eos_Exec_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(NSRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EosServer).Exec(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/eos.rpc.Eos/Exec",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EosServer).Exec(ctx, req.(*NSRequest))
	}
	return interceptor(ctx, in, info, handler)
}

func _Eos_ManilaServerRequest_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
	in := new(ManilaRequest)
	if err := dec(in); err != nil {
		return nil, err
	}
	if interceptor == nil {
		return srv.(EosServer).ManilaServerRequest(ctx, in)
	}
	info := &grpc.UnaryServerInfo{
		Server:     srv,
		FullMethod: "/eos.rpc.Eos/ManilaServerRequest",
	}
	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
		return srv.(EosServer).ManilaServerRequest(ctx, req.(*ManilaRequest))
	}
	return interceptor(ctx, in, info, handler)
}

// Eos_ServiceDesc is the grpc.ServiceDesc for Eos service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var Eos_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "eos.rpc.Eos",
	HandlerType: (*EosServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Ping",
			Handler:    _Eos_Ping_Handler,
		},
		{
			MethodName: "NsStat",
			Handler:    _Eos_NsStat_Handler,
		},
		{
			MethodName: "ContainerInsert",
			Handler:    _Eos_ContainerInsert_Handler,
		},
		{
			MethodName: "FileInsert",
			Handler:    _Eos_FileInsert_Handler,
		},
		{
			MethodName: "Exec",
			Handler:    _Eos_Exec_Handler,
		},
		{
			MethodName: "ManilaServerRequest",
			Handler:    _Eos_ManilaServerRequest_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "MD",
			Handler:       _Eos_MD_Handler,
			ServerStreams: true,
		},
		{
			StreamName:    "Find",
			Handler:       _Eos_Find_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "Rpc.proto",
}
