...
Code Block | ||
---|---|---|
| ||
service MilvusService { // (omit api version prefix) // POST /collections rpc CreateCollection(CreateCollectionRequest) returns (common.Status) {} // DELETE /collections/:collectionName rpc DropCollection(DropCollectionRequest) returns (common.Status) {} // GET /collections/:collectionName rpc HasCollection(HasCollectionRequest) returns (BoolResponse) {} // PUT /collections/:collectionName/load rpc LoadCollection(LoadCollectionRequest) returns (common.Status) {} // DELETE /collections/:collectionName/load rpc ReleaseCollection(ReleaseCollectionRequest) returns (common.Status) {} // GET /collections/:collectionName/schema rpc DescribeCollection(DescribeCollectionRequest) returns (DescribeCollectionResponse) {} // GET /collections/:collectionName/statistics rpc GetCollectionStatistics(GetCollectionStatisticsRequest) returns (GetCollectionStatisticsResponse) {} // GET /collections-list rpc ShowCollections(ShowCollectionsRequest) returns (ShowCollectionsResponse) {} // POST /collections/:collection/partitions rpc CreatePartition(CreatePartitionRequest) returns (common.Status) {} // DELETE /collections/:collection/partitions/:partition rpc DropPartition(DropPartitionRequest) returns (common.Status) {} // GET /collections/:collection/partitions/:partition rpc HasPartition(HasPartitionRequest) returns (BoolResponse) {} // PUT /collections/:collection/partitions/:partition/load rpc LoadPartitions(LoadPartitionsRequest) returns (common.Status) {} // DELETE /collections/:collection/partitions/:partition/load rpc ReleasePartitions(ReleasePartitionsRequest) returns (common.Status) {} // GET /collections/:collection/partitions/:partition/statistics rpc GetPartitionStatistics(GetPartitionStatisticsRequest) returns (GetPartitionStatisticsResponse) {} // GET /collections/:collection/partitions-list rpc ShowPartitions(ShowPartitionsRequest) returns (ShowPartitionsResponse) {} // ... } |
Design Details(required)
Add a http server on proxy module with a popular go HTTP framework. (GIN maybe)
The HTTP API should be designed by RESTful Principles and should implement all the methods that gRPC interface supports.
When http server receives a request, it converts the request to corresponding gRPC request, and then reuse the gRPC handling procedure to finish serving the request.Web module
As we can see from the milvus v2 architecture, all the gRPC requests first go into the Access Layer, which is the milvus-proxy service, where the requests are then propagated to other funtional services of milvus. So that's where we should put our web server.
...
After the http request parsed, it's translated into the same req struct as we mentioned above, and the rest things can be done by the gRPC handlers which were already implemented.
Web Framework
We'll use golang for easy integration with current proxy. And we'll use GIN is the most popular and also easy to use golang web framework.
TODO Tasks:
Preparation:
- Refine the design details.
- Decide on which web server framework we should use.
- Initialize the framework together with an example of API code.
...