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 creator |
19 | */ |
20 | |
21 | #pragma once |
22 | |
23 | #include <memory> |
24 | #include "common/macro_define.h" |
25 | #include "collection.h" |
26 | |
27 | namespace proxima { |
28 | namespace be { |
29 | namespace repository { |
30 | |
31 | class CollectionCreator; |
32 | using CollectionCreatorPtr = std::shared_ptr<CollectionCreator>; |
33 | |
34 | /*! Collection Creator |
35 | */ |
36 | class CollectionCreator { |
37 | public: |
38 | //! Destructor |
39 | virtual ~CollectionCreator() = default; |
40 | |
41 | //! Create collection |
42 | virtual CollectionPtr create(const CollectionInfo &info) const = 0; |
43 | }; |
44 | |
45 | /*! Collection Creator Implication |
46 | */ |
47 | class CollectionCreatorImpl : public CollectionCreator { |
48 | public: |
49 | //! Constructor |
50 | CollectionCreatorImpl() = default; |
51 | |
52 | //! Destructor |
53 | ~CollectionCreatorImpl() = default; |
54 | |
55 | //! Create collection |
56 | CollectionPtr create(const CollectionInfo &info) const override; |
57 | }; |
58 | |
59 | } // end namespace repository |
60 | } // namespace be |
61 | } // end namespace proxima |
62 | |