Skip to content

Commit

Permalink
chore: Move tools/ and proto/ to internal/ (#55)
Browse files Browse the repository at this point in the history
  • Loading branch information
Anush008 authored Sep 12, 2024
1 parent e52189d commit 427aa60
Show file tree
Hide file tree
Showing 10 changed files with 11 additions and 1,967 deletions.
12 changes: 6 additions & 6 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,22 +63,22 @@ The client uses generated stubs from upstream Qdrant proto definitions, which ar
1. Download and generate the latest client stubs by running the following command from the project root:

```bash
BRANCH=dev sh tools/sync_proto.sh
BRANCH=dev sh internal/tools/sync_proto.sh
```

2. Update the test image value in [`qdrant_test/image_test.go`](https://github.com/qdrant/go-client/blob/new-client/qdrant_test/image_test.go) to `qdrant/qdrant:dev`.
2. Update the test image value in [`qdrant_test/image_test.go`](https://github.com/qdrant/go-client/blob/master/qdrant_test/image_test.go) to `qdrant/qdrant:dev`.

3. Remove the gRPC server definitions from the auto-generated code.

There is currently [no way](https://github.com/golang/protobuf/issues/373) to skip generating Go server definitions.

You’ll need to manually delete them from [`snapshots_service_grpc.pb.go`](https://github.com/qdrant/go-client/blob/new-client/qdrant/snapshots_service_grpc.pb.go), [`points_service_grpc.pb.go`](https://github.com/qdrant/go-client/blob/new-client/qdrant/points_service.pb.go), and [`collections_service_grpc.pb.go`](https://github.com/qdrant/go-client/blob/new-client/qdrant/collections_service_grpc.pb.go).
You’ll need to manually delete them from [`snapshots_service_grpc.pb.go`](https://github.com/qdrant/go-client/blob/master/qdrant/snapshots_service_grpc.pb.go), [`points_service_grpc.pb.go`](https://github.com/qdrant/go-client/blob/master/qdrant/points_service.pb.go), and [`collections_service_grpc.pb.go`](https://github.com/qdrant/go-client/blob/master/qdrant/collections_service_grpc.pb.go).

Remove lines starting from comments like `// CollectionsServer is the server API for Collections service.` until the end of the file. [Here’s an example commit](https://github.com/qdrant/go-client/commit/6d04e31bb2acccf54f964a634df8930533642892).

4. Implement new Qdrant methods in [`points.go`](https://github.com/qdrant/go-client/blob/new-client/qdrant/points.go), [`collections.go`](https://github.com/qdrant/go-client/blob/new-client/qdrant/collections.go), or [`qdrant.go`](https://github.com/qdrant/go-client/blob/new-client/qdrant/qdrant.go) as needed.
4. Implement new Qdrant methods in [`points.go`](https://github.com/qdrant/go-client/blob/master/qdrant/points.go), [`collections.go`](https://github.com/qdrant/go-client/blob/master/qdrant/collections.go), or [`qdrant.go`](https://github.com/qdrant/go-client/blob/master/qdrant/qdrant.go) as needed.

5. If there are any new `oneOf` properties in the proto definitions, add helper constructors in [`oneof_factory.go`](https://github.com/qdrant/go-client/blob/new-client/qdrant/oneof_factory.go) following the existing patterns.
5. If there are any new `oneOf` properties in the proto definitions, add helper constructors in [`oneof_factory.go`](https://github.com/qdrant/go-client/blob/master/qdrant/oneof_factory.go) following the existing patterns.

6. Submit your pull request and get those approvals.

Expand All @@ -89,7 +89,7 @@ Once the new Qdrant version is live:
1. Run the following command:

```bash
BRANCH=master sh tools/sync_proto.sh
BRANCH=master sh internal/tools/sync_proto.sh
```

2. Update the test image value in `qdrant_test/image_test.go` to `qdrant/qdrant:NEW_VERSION`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ PROJECT_ROOT="$(pwd)/$(dirname "$0")/../"

QDRANT_PROTO_DIR='proto'

go install google.golang.org/protobuf/cmd/protoc-gen-go@1.34.2
go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.34.2
go install google.golang.org/grpc/cmd/[email protected]

export PATH="$PATH:$(go env GOPATH)/bin"

PROTO_DIR=./proto
PROTO_DIR=./internal/proto
OUT_DIR=./qdrant
PACKAGE_NAME="github.com/qdrant/go-client;qdrant"

Expand Down
6 changes: 3 additions & 3 deletions tools/sync_proto.sh → internal/tools/sync_proto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
set -e

BRANCH=${BRANCH:-"master"}
PROJECT_ROOT="$(pwd)/$(dirname "$0")/../"
PROJECT_ROOT="$(pwd)/$(dirname "$0")/../../"

cd $(mktemp -d)

Expand All @@ -16,7 +16,7 @@ PROTO_DIR="$(pwd)/lib/api/src/grpc/proto"
# Ensure current path is project root
cd $PROJECT_ROOT

CLIENT_DIR="proto"
CLIENT_DIR="internal/proto"

cp $PROTO_DIR/*.proto $CLIENT_DIR/

Expand All @@ -39,4 +39,4 @@ sed -i '
# Remove csharp option from proto files
sed -i '/option csharp_namespace = .*/d' $CLIENT_DIR/*.proto

sh tools/generate_proto_go.sh
./internal/tools/generate_proto_go.sh
Loading

0 comments on commit 427aa60

Please sign in to comment.