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 Dianzhang.Chen
17 * \date Oct 2020
18 * \brief Interface of collection
19 */
20
21#pragma once
22
23#include "common/macro_define.h"
24#include "common_types.h"
25
26namespace proxima {
27namespace be {
28namespace repository {
29
30class Collection;
31using CollectionPtr = std::shared_ptr<Collection>;
32
33/*! Collection Interface
34 */
35class Collection {
36 public:
37 virtual ~Collection() = default;
38
39 public:
40 //! Initialize Collection
41 virtual int init() = 0;
42
43 //! Start collection
44 virtual void run() = 0;
45
46 //! Stop collection
47 virtual void stop() = 0;
48
49 //! Update Collection
50 virtual void update() = 0;
51
52 //! Drop Collection
53 virtual void drop() = 0;
54
55 //! If collection is finished
56 virtual bool finished() const = 0;
57
58 //! Get collection state
59 virtual CollectionStatus state() const = 0;
60
61 //! Get collection schema revision
62 virtual uint32_t schema_revision() const = 0;
63};
64
65} // end namespace repository
66} // namespace be
67} // end namespace proxima
68