// Copyright AGNTCY Contributors (https://github.com/agntcy)
// SPDX-License-Identifier: Apache-2.0

// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
// versions:
// - protoc-gen-go-grpc v1.5.1
// - protoc             (unknown)
// source: agntcy/dir/store/v1/store_service.proto

package v1

import (
	context "context"
	v1 "github.com/agntcy/dir/api/core/v1"
	grpc "google.golang.org/grpc"
	codes "google.golang.org/grpc/codes"
	status "google.golang.org/grpc/status"
	emptypb "google.golang.org/protobuf/types/known/emptypb"
)

// 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.62.0 or later.
const _ = grpc.SupportPackageIsVersion8

const (
	StoreService_Push_FullMethodName         = "/agntcy.dir.store.v1.StoreService/Push"
	StoreService_Pull_FullMethodName         = "/agntcy.dir.store.v1.StoreService/Pull"
	StoreService_Lookup_FullMethodName       = "/agntcy.dir.store.v1.StoreService/Lookup"
	StoreService_Delete_FullMethodName       = "/agntcy.dir.store.v1.StoreService/Delete"
	StoreService_PushReferrer_FullMethodName = "/agntcy.dir.store.v1.StoreService/PushReferrer"
	StoreService_PullReferrer_FullMethodName = "/agntcy.dir.store.v1.StoreService/PullReferrer"
)

// StoreServiceClient is the client API for StoreService 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.
//
// Defines an interface for content-addressable storage
// service for objects.
//
// Max object size: 4MB (to fully fit in a single request)
// Max metadata size: 100KB
//
// Store service can be implemented by various storage backends,
// such as local file system, OCI registry, etc.
//
// Middleware should be used to control who can perform these RPCs.
// Policies for the middleware can be handled via separate service.
//
// Each operation is performed sequentially, meaning that
// for the N-th request, N-th response will be returned.
// If an error occurs, the stream will be cancelled.
type StoreServiceClient interface {
	// Push performs write operation for given records.
	Push(ctx context.Context, opts ...grpc.CallOption) (StoreService_PushClient, error)
	// Pull performs read operation for given records.
	Pull(ctx context.Context, opts ...grpc.CallOption) (StoreService_PullClient, error)
	// Lookup resolves basic metadata for the records.
	Lookup(ctx context.Context, opts ...grpc.CallOption) (StoreService_LookupClient, error)
	// Remove performs delete operation for the records.
	Delete(ctx context.Context, opts ...grpc.CallOption) (StoreService_DeleteClient, error)
	// PushReferrer performs write operation for record referrers.
	PushReferrer(ctx context.Context, opts ...grpc.CallOption) (StoreService_PushReferrerClient, error)
	// PullReferrer performs read operation for record referrers.
	PullReferrer(ctx context.Context, opts ...grpc.CallOption) (StoreService_PullReferrerClient, error)
}

type storeServiceClient struct {
	cc grpc.ClientConnInterface
}

func NewStoreServiceClient(cc grpc.ClientConnInterface) StoreServiceClient {
	return &storeServiceClient{cc}
}

func (c *storeServiceClient) Push(ctx context.Context, opts ...grpc.CallOption) (StoreService_PushClient, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &StoreService_ServiceDesc.Streams[0], StoreService_Push_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &storeServicePushClient{ClientStream: stream}
	return x, nil
}

type StoreService_PushClient interface {
	Send(*v1.Record) error
	Recv() (*v1.RecordRef, error)
	grpc.ClientStream
}

type storeServicePushClient struct {
	grpc.ClientStream
}

func (x *storeServicePushClient) Send(m *v1.Record) error {
	return x.ClientStream.SendMsg(m)
}

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

func (c *storeServiceClient) Pull(ctx context.Context, opts ...grpc.CallOption) (StoreService_PullClient, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &StoreService_ServiceDesc.Streams[1], StoreService_Pull_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &storeServicePullClient{ClientStream: stream}
	return x, nil
}

type StoreService_PullClient interface {
	Send(*v1.RecordRef) error
	Recv() (*v1.Record, error)
	grpc.ClientStream
}

type storeServicePullClient struct {
	grpc.ClientStream
}

func (x *storeServicePullClient) Send(m *v1.RecordRef) error {
	return x.ClientStream.SendMsg(m)
}

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

func (c *storeServiceClient) Lookup(ctx context.Context, opts ...grpc.CallOption) (StoreService_LookupClient, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &StoreService_ServiceDesc.Streams[2], StoreService_Lookup_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &storeServiceLookupClient{ClientStream: stream}
	return x, nil
}

type StoreService_LookupClient interface {
	Send(*v1.RecordRef) error
	Recv() (*v1.RecordMeta, error)
	grpc.ClientStream
}

type storeServiceLookupClient struct {
	grpc.ClientStream
}

func (x *storeServiceLookupClient) Send(m *v1.RecordRef) error {
	return x.ClientStream.SendMsg(m)
}

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

func (c *storeServiceClient) Delete(ctx context.Context, opts ...grpc.CallOption) (StoreService_DeleteClient, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &StoreService_ServiceDesc.Streams[3], StoreService_Delete_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &storeServiceDeleteClient{ClientStream: stream}
	return x, nil
}

type StoreService_DeleteClient interface {
	Send(*v1.RecordRef) error
	CloseAndRecv() (*emptypb.Empty, error)
	grpc.ClientStream
}

type storeServiceDeleteClient struct {
	grpc.ClientStream
}

func (x *storeServiceDeleteClient) Send(m *v1.RecordRef) error {
	return x.ClientStream.SendMsg(m)
}

func (x *storeServiceDeleteClient) CloseAndRecv() (*emptypb.Empty, error) {
	if err := x.ClientStream.CloseSend(); err != nil {
		return nil, err
	}
	m := new(emptypb.Empty)
	if err := x.ClientStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func (c *storeServiceClient) PushReferrer(ctx context.Context, opts ...grpc.CallOption) (StoreService_PushReferrerClient, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &StoreService_ServiceDesc.Streams[4], StoreService_PushReferrer_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &storeServicePushReferrerClient{ClientStream: stream}
	return x, nil
}

type StoreService_PushReferrerClient interface {
	Send(*PushReferrerRequest) error
	Recv() (*PushReferrerResponse, error)
	grpc.ClientStream
}

type storeServicePushReferrerClient struct {
	grpc.ClientStream
}

func (x *storeServicePushReferrerClient) Send(m *PushReferrerRequest) error {
	return x.ClientStream.SendMsg(m)
}

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

func (c *storeServiceClient) PullReferrer(ctx context.Context, opts ...grpc.CallOption) (StoreService_PullReferrerClient, error) {
	cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
	stream, err := c.cc.NewStream(ctx, &StoreService_ServiceDesc.Streams[5], StoreService_PullReferrer_FullMethodName, cOpts...)
	if err != nil {
		return nil, err
	}
	x := &storeServicePullReferrerClient{ClientStream: stream}
	return x, nil
}

type StoreService_PullReferrerClient interface {
	Send(*PullReferrerRequest) error
	Recv() (*PullReferrerResponse, error)
	grpc.ClientStream
}

type storeServicePullReferrerClient struct {
	grpc.ClientStream
}

func (x *storeServicePullReferrerClient) Send(m *PullReferrerRequest) error {
	return x.ClientStream.SendMsg(m)
}

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

// StoreServiceServer is the server API for StoreService service.
// All implementations should embed UnimplementedStoreServiceServer
// for forward compatibility.
//
// Defines an interface for content-addressable storage
// service for objects.
//
// Max object size: 4MB (to fully fit in a single request)
// Max metadata size: 100KB
//
// Store service can be implemented by various storage backends,
// such as local file system, OCI registry, etc.
//
// Middleware should be used to control who can perform these RPCs.
// Policies for the middleware can be handled via separate service.
//
// Each operation is performed sequentially, meaning that
// for the N-th request, N-th response will be returned.
// If an error occurs, the stream will be cancelled.
type StoreServiceServer interface {
	// Push performs write operation for given records.
	Push(StoreService_PushServer) error
	// Pull performs read operation for given records.
	Pull(StoreService_PullServer) error
	// Lookup resolves basic metadata for the records.
	Lookup(StoreService_LookupServer) error
	// Remove performs delete operation for the records.
	Delete(StoreService_DeleteServer) error
	// PushReferrer performs write operation for record referrers.
	PushReferrer(StoreService_PushReferrerServer) error
	// PullReferrer performs read operation for record referrers.
	PullReferrer(StoreService_PullReferrerServer) error
}

// UnimplementedStoreServiceServer 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 UnimplementedStoreServiceServer struct{}

func (UnimplementedStoreServiceServer) Push(StoreService_PushServer) error {
	return status.Errorf(codes.Unimplemented, "method Push not implemented")
}
func (UnimplementedStoreServiceServer) Pull(StoreService_PullServer) error {
	return status.Errorf(codes.Unimplemented, "method Pull not implemented")
}
func (UnimplementedStoreServiceServer) Lookup(StoreService_LookupServer) error {
	return status.Errorf(codes.Unimplemented, "method Lookup not implemented")
}
func (UnimplementedStoreServiceServer) Delete(StoreService_DeleteServer) error {
	return status.Errorf(codes.Unimplemented, "method Delete not implemented")
}
func (UnimplementedStoreServiceServer) PushReferrer(StoreService_PushReferrerServer) error {
	return status.Errorf(codes.Unimplemented, "method PushReferrer not implemented")
}
func (UnimplementedStoreServiceServer) PullReferrer(StoreService_PullReferrerServer) error {
	return status.Errorf(codes.Unimplemented, "method PullReferrer not implemented")
}
func (UnimplementedStoreServiceServer) testEmbeddedByValue() {}

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

func RegisterStoreServiceServer(s grpc.ServiceRegistrar, srv StoreServiceServer) {
	// If the following call pancis, it indicates UnimplementedStoreServiceServer 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()
	}
	s.RegisterService(&StoreService_ServiceDesc, srv)
}

func _StoreService_Push_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(StoreServiceServer).Push(&storeServicePushServer{ServerStream: stream})
}

type StoreService_PushServer interface {
	Send(*v1.RecordRef) error
	Recv() (*v1.Record, error)
	grpc.ServerStream
}

type storeServicePushServer struct {
	grpc.ServerStream
}

func (x *storeServicePushServer) Send(m *v1.RecordRef) error {
	return x.ServerStream.SendMsg(m)
}

func (x *storeServicePushServer) Recv() (*v1.Record, error) {
	m := new(v1.Record)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _StoreService_Pull_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(StoreServiceServer).Pull(&storeServicePullServer{ServerStream: stream})
}

type StoreService_PullServer interface {
	Send(*v1.Record) error
	Recv() (*v1.RecordRef, error)
	grpc.ServerStream
}

type storeServicePullServer struct {
	grpc.ServerStream
}

func (x *storeServicePullServer) Send(m *v1.Record) error {
	return x.ServerStream.SendMsg(m)
}

func (x *storeServicePullServer) Recv() (*v1.RecordRef, error) {
	m := new(v1.RecordRef)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _StoreService_Lookup_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(StoreServiceServer).Lookup(&storeServiceLookupServer{ServerStream: stream})
}

type StoreService_LookupServer interface {
	Send(*v1.RecordMeta) error
	Recv() (*v1.RecordRef, error)
	grpc.ServerStream
}

type storeServiceLookupServer struct {
	grpc.ServerStream
}

func (x *storeServiceLookupServer) Send(m *v1.RecordMeta) error {
	return x.ServerStream.SendMsg(m)
}

func (x *storeServiceLookupServer) Recv() (*v1.RecordRef, error) {
	m := new(v1.RecordRef)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _StoreService_Delete_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(StoreServiceServer).Delete(&storeServiceDeleteServer{ServerStream: stream})
}

type StoreService_DeleteServer interface {
	SendAndClose(*emptypb.Empty) error
	Recv() (*v1.RecordRef, error)
	grpc.ServerStream
}

type storeServiceDeleteServer struct {
	grpc.ServerStream
}

func (x *storeServiceDeleteServer) SendAndClose(m *emptypb.Empty) error {
	return x.ServerStream.SendMsg(m)
}

func (x *storeServiceDeleteServer) Recv() (*v1.RecordRef, error) {
	m := new(v1.RecordRef)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _StoreService_PushReferrer_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(StoreServiceServer).PushReferrer(&storeServicePushReferrerServer{ServerStream: stream})
}

type StoreService_PushReferrerServer interface {
	Send(*PushReferrerResponse) error
	Recv() (*PushReferrerRequest, error)
	grpc.ServerStream
}

type storeServicePushReferrerServer struct {
	grpc.ServerStream
}

func (x *storeServicePushReferrerServer) Send(m *PushReferrerResponse) error {
	return x.ServerStream.SendMsg(m)
}

func (x *storeServicePushReferrerServer) Recv() (*PushReferrerRequest, error) {
	m := new(PushReferrerRequest)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

func _StoreService_PullReferrer_Handler(srv interface{}, stream grpc.ServerStream) error {
	return srv.(StoreServiceServer).PullReferrer(&storeServicePullReferrerServer{ServerStream: stream})
}

type StoreService_PullReferrerServer interface {
	Send(*PullReferrerResponse) error
	Recv() (*PullReferrerRequest, error)
	grpc.ServerStream
}

type storeServicePullReferrerServer struct {
	grpc.ServerStream
}

func (x *storeServicePullReferrerServer) Send(m *PullReferrerResponse) error {
	return x.ServerStream.SendMsg(m)
}

func (x *storeServicePullReferrerServer) Recv() (*PullReferrerRequest, error) {
	m := new(PullReferrerRequest)
	if err := x.ServerStream.RecvMsg(m); err != nil {
		return nil, err
	}
	return m, nil
}

// StoreService_ServiceDesc is the grpc.ServiceDesc for StoreService service.
// It's only intended for direct use with grpc.RegisterService,
// and not to be introspected or modified (even as a copy)
var StoreService_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "agntcy.dir.store.v1.StoreService",
	HandlerType: (*StoreServiceServer)(nil),
	Methods:     []grpc.MethodDesc{},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Push",
			Handler:       _StoreService_Push_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "Pull",
			Handler:       _StoreService_Pull_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "Lookup",
			Handler:       _StoreService_Lookup_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "Delete",
			Handler:       _StoreService_Delete_Handler,
			ClientStreams: true,
		},
		{
			StreamName:    "PushReferrer",
			Handler:       _StoreService_PushReferrer_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "PullReferrer",
			Handler:       _StoreService_PullReferrer_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "agntcy/dir/store/v1/store_service.proto",
}
