syntax = "proto3";

package milvus.proto.service;
option go_package="github.com/zilliztech/milvus-distributed/internal/proto/servicepb";

import "common.proto";
import "service_msg.proto";
import "schema.proto";

service MilvusService {
    /**
     * @brief This method is used to create collection
     *
     * @param CollectionSchema, use to provide collection information to be created.
     *
     * @return Status
     */
    rpc CreateCollection(schema.CollectionSchema) returns (common.Status){}
    
    /**
     * @brief This method is used to delete collection.
     *
     * @param CollectionName, collection name is going to be deleted.
     *
     * @return Status
     */
    rpc DropCollection(CollectionName) returns (common.Status) {}

    /**
     * @brief This method is used to test collection existence.
     *
     * @param CollectionName, collection name is going to be tested.
     *
     * @return BoolResponse
     */
    rpc HasCollection(CollectionName) returns (BoolResponse) {}

    /**
     * @brief This method is used to get collection schema.
     *
     * @param CollectionName, target collection name.
     *
     * @return CollectionDescription
     */
    rpc DescribeCollection(CollectionName) returns (CollectionDescription) {}

    /**
     * @brief This method is used to list all collections.
     *
     * @return CollectionNameList
     */
    rpc ShowCollections(common.Empty) returns (StringListResponse) {}

    /**
     * @brief This method is used to create partition
     *
     * @return Status
     */
    rpc CreatePartition(PartitionName) returns (common.Status) {}

    /**
     * @brief This method is used to drop partition
     *
     * @return Status
     */
    rpc DropPartition(PartitionName) returns (common.Status) {}

    /**
     * @brief This method is used to test partition existence.
     *
     * @return BoolResponse
     */
    rpc HasPartition(PartitionName) returns (BoolResponse) {}

    /**
     * @brief This method is used to get basic partition infomation.
     *
     * @return PartitionDescription
     */
    rpc DescribePartition(PartitionName) returns (PartitionDescription) {}

    /**
     * @brief This method is used to show partition information
     *
     * @param CollectionName, target collection name.
     *
     * @return StringListResponse
     */
    rpc ShowPartitions(CollectionName) returns (StringListResponse) {}

    /**
     * @brief This method is used to add vector array to collection.
     *
     * @param RowBatch, insert rows.
     *
     * @return IntegerRangeResponse contains id of the inserted rows.
     */
    rpc Insert(RowBatch) returns (IntegerRangeResponse) {}

    /**
     * @brief This method is used to query vector in collection.
     *
     * @param Query.
     *
     * @return QueryResult
     */
    rpc Search(Query) returns (QueryResult) {}
}