qdrant / go-client

Go client for Qdrant vector search engine
Apache License 2.0
166 stars 15 forks source link

allow grpc server code generation stubs #61

Open aria3ppp opened 4 days ago

aria3ppp commented 4 days ago

i need to run integration tests on qdrant server but i do not want to go down with testcontainers heavy stuffs so i just create mock servers and let clients request go through network but hit an especially forged mock server on the other side for http server it is simple for grpc i need server stubs too but the qdrant go client have striped the server parts so i propose to let the server stubs into the package to be able test the client in isolation to qdrant server

Current Behavior and Steps to Reproduce

at this time i created a script to locate proto files in qdrant go client module on go module cache and then generate the go code from those files but i need to remove the client stubs bc they cannot co-exists in the same package bc of protobuf namespaces

panic: proto: file "collections.proto" is already registered
                previously from: "github.com/aria3ppp/rag-server/gen/go/qdrantpb"
                currently from:  "github.com/qdrant/go-client/qdrant"
        See https://protobuf.dev/reference/go/faq#namespace-conflict

so i have to remove the client parts and also link the proto messges to qdrant client

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

package qdrantpb

import (
    context "context"
    grpc "google.golang.org/grpc"
    codes "google.golang.org/grpc/codes"
    status "google.golang.org/grpc/status"
    . "github.com/qdrant/go-client/qdrant"
)

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

// CollectionsServer is the server API for Collections service.
// All implementations must embed UnimplementedCollectionsServer
// for forward compatibility.
type CollectionsServer interface {
    // Get detailed information about specified existing collection
    Get(context.Context, *GetCollectionInfoRequest) (*GetCollectionInfoResponse, error)
    // Get list name of all existing collections
    List(context.Context, *ListCollectionsRequest) (*ListCollectionsResponse, error)
}
Anush008 commented 4 days ago

Hey @aria3ppp. We've been skipping the server stubs generation when releasing new versions. As described here in step 3. https://github.com/qdrant/go-client/blob/master/CONTRIBUTING.md#preparing-for-a-new-release

We should also be fine with including them. Since it helps with your use case of mock testing, we'll do so in the next release.

aria3ppp commented 3 days ago

excellent so i'll keep this issue open until the next version is released thank you