ConnectionImpl.cpp 3.6 KB
Newer Older
K
kun yu 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/*******************************************************************************
* Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
* Unauthorized copying of this file, via any medium is strictly prohibited.
* Proprietary and confidential.
******************************************************************************/
#include "ConnectionImpl.h"

namespace milvus {

std::shared_ptr<Connection>
Connection::Create() {
    return std::shared_ptr<Connection>(new ConnectionImpl());
}

Status
K
kun yu 已提交
16 17 18 19
Connection::Destroy(std::shared_ptr<milvus::Connection>& connection_ptr) {
    if (connection_ptr != nullptr) {
        return connection_ptr->Disconnect();
    }
K
kun yu 已提交
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
    return Status::OK();
}

//////////////////////////////////////////////////////////////////////////////////////////////
ConnectionImpl::ConnectionImpl() {
    client_proxy_ = std::make_shared<ClientProxy>();
}

Status
ConnectionImpl::Connect(const ConnectParam &param) {
    return client_proxy_->Connect(param);
}

Status
ConnectionImpl::Connect(const std::string &uri) {
    return client_proxy_->Connect(uri);
}

Status
ConnectionImpl::Connected() const {
    return client_proxy_->Connected();
}

Status
ConnectionImpl::Disconnect() {
    return client_proxy_->Disconnect();
}

std::string
ConnectionImpl::ClientVersion() const {
K
kun yu 已提交
50
    return client_proxy_->ClientVersion();
K
kun yu 已提交
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
}

Status
ConnectionImpl::CreateTable(const TableSchema &param) {
    return client_proxy_->CreateTable(param);
}

bool
ConnectionImpl::HasTable(const std::string &table_name) {
    return client_proxy_->HasTable(table_name);
}

Status
ConnectionImpl::DropTable(const std::string &table_name) {
    return client_proxy_->DropTable(table_name);
}

K
kun yu 已提交
68
Status
Y
Yu Kun 已提交
69 70
ConnectionImpl::CreateIndex(const IndexParam &index_param) {
    return client_proxy_->CreateIndex(index_param);
K
kun yu 已提交
71 72 73
}

Status
Y
Yu Kun 已提交
74
ConnectionImpl::Insert(const std::string &table_name,
K
kun yu 已提交
75 76
                          const std::vector<RowRecord> &record_array,
                          std::vector<int64_t> &id_array) {
Y
Yu Kun 已提交
77
    return client_proxy_->Insert(table_name, record_array, id_array);
K
kun yu 已提交
78 79
}

K
kun yu 已提交
80

K
kun yu 已提交
81
Status
Y
Yu Kun 已提交
82
ConnectionImpl::Search(const std::string &table_name,
K
kun yu 已提交
83 84 85
                             const std::vector<RowRecord> &query_record_array,
                             const std::vector<Range> &query_range_array,
                             int64_t topk,
Y
Yu Kun 已提交
86
                             int64_t nprobe,
K
kun yu 已提交
87
                             std::vector<TopKQueryResult> &topk_query_result_array) {
Y
Yu Kun 已提交
88
    return client_proxy_->Search(table_name, query_record_array, query_range_array, topk,
Y
Yu Kun 已提交
89
                                 nprobe, topk_query_result_array);
K
kun yu 已提交
90 91 92 93 94 95 96 97
}

Status
ConnectionImpl::DescribeTable(const std::string &table_name, TableSchema &table_schema) {
    return client_proxy_->DescribeTable(table_name, table_schema);
}

Status
Y
Yu Kun 已提交
98 99
ConnectionImpl::CountTable(const std::string &table_name, int64_t &row_count) {
    return client_proxy_->CountTable(table_name, row_count);
K
kun yu 已提交
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116
}

Status
ConnectionImpl::ShowTables(std::vector<std::string> &table_array) {
    return client_proxy_->ShowTables(table_array);
}

std::string
ConnectionImpl::ServerVersion() const {
    return client_proxy_->ServerVersion();
}

std::string
ConnectionImpl::ServerStatus() const {
    return client_proxy_->ServerStatus();
}

Y
Yu Kun 已提交
117 118 119 120 121 122 123 124
Status
ConnectionImpl::DeleteByRange(Range &range,
              const std::string &table_name) {

}

Status
ConnectionImpl::PreloadTable(const std::string &table_name) const {
Y
Yu Kun 已提交
125
    return client_proxy_->PreloadTable(table_name);
Y
Yu Kun 已提交
126 127 128 129 130 131 132 133 134 135 136 137
}

IndexParam
ConnectionImpl::DescribeIndex(const std::string &table_name) const {

}

Status
ConnectionImpl::DropIndex(const std::string &table_name) const {

}

K
kun yu 已提交
138
}