1/**
2 * Copyright 2021 Alibaba, Inc. and its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * \author guonix
17 * \date Dec 2020
18 * \brief
19 */
20
21#pragma once
22
23#include "agent/index_agent.h"
24#include "meta/meta_agent.h"
25#include "query/query_agent.h"
26
27namespace proxima {
28namespace be {
29namespace admin {
30
31class AdminAgent;
32//! Alias Pointer for AdminAgent
33using AdminAgentPtr = std::shared_ptr<AdminAgent>;
34
35/**
36 * Proxima BE Admin module
37 */
38class AdminAgent {
39 public:
40 //! Create AdminAgent Object
41 static AdminAgentPtr Create(const meta::MetaAgentPtr &meta,
42 const agent::IndexAgentPtr &index,
43 const query::QueryAgentPtr &query);
44
45 public:
46 //! Destructor
47 virtual ~AdminAgent() = default;
48
49 public:
50 //! Init Meta Agent
51 virtual int init() = 0;
52
53 //! Clean up object
54 virtual int cleanup() = 0;
55
56 //! Start background service
57 virtual int start() = 0;
58
59 //! Stop background service
60 virtual int stop() = 0;
61
62 public:
63 //! Create collection
64 virtual int create_collection(const proto::CollectionConfig &request) = 0;
65
66 //! Describe collection
67 virtual int describe_collection(
68 const std::string &collection_name,
69 proto::DescribeCollectionResponse *collection_info) = 0;
70
71 //! Drop collection
72 virtual int drop_collection(const std::string &collection_name) = 0;
73
74 //! Retrieve collections
75 virtual int list_collections(const proto::ListCondition &condition,
76 proto::ListCollectionsResponse *response) = 0;
77
78 //! Retrieve collection stats
79 virtual int stats_collection(const std::string &collection_name,
80 proto::StatsCollectionResponse *stats) = 0;
81
82 //! Reload meta from meta store
83 virtual int reload_meta() = 0;
84
85 //! Start query service
86 virtual int start_query_service() = 0;
87
88 //! Stop query service
89 virtual int stop_query_service() = 0;
90
91 //! Get query service status
92 virtual int get_query_service_status() = 0;
93};
94
95} // namespace admin
96} // namespace be
97} // namespace proxima
98