DBMetaImpl.h 2.8 KB
Newer Older
X
Xu Peng 已提交
1 2 3 4 5 6
/*******************************************************************************
 * Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
 * Unauthorized copying of this file, via any medium is strictly prohibited.
 * Proprietary and confidential.
 ******************************************************************************/
#pragma once
X
Xu Peng 已提交
7

X
Xu Peng 已提交
8 9
#include "Meta.h"
#include "Options.h"
X
Xu Peng 已提交
10

J
jinhai 已提交
11

X
Xu Peng 已提交
12
namespace zilliz {
J
jinhai 已提交
13
namespace milvus {
X
Xu Peng 已提交
14
namespace engine {
15
namespace meta {
X
Xu Peng 已提交
16

J
jinhai 已提交
17
auto StoragePrototype(const std::string &path);
X
Xu Peng 已提交
18

X
Xu Peng 已提交
19
class DBMetaImpl : public Meta {
J
jinhai 已提交
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
 public:
    explicit DBMetaImpl(const DBMetaOptions &options_);

    Status
    CreateTable(TableSchema &table_schema) override;

    Status
    DescribeTable(TableSchema &group_info_) override;

    Status
    HasTable(const std::string &table_id, bool &has_or_not) override;

    Status
    AllTables(std::vector<TableSchema> &table_schema_array) override;

    Status
    DeleteTable(const std::string &table_id) override;
X
Xu Peng 已提交
37

J
jinhai 已提交
38 39
    Status
    DeleteTableFiles(const std::string &table_id) override;
40

J
jinhai 已提交
41 42
    Status
    CreateTableFile(TableFileSchema &file_schema) override;
G
groot 已提交
43

J
jinhai 已提交
44 45
    Status
    DropPartitionsByDates(const std::string &table_id, const DatesT &dates) override;
X
Xu Peng 已提交
46

J
jinhai 已提交
47 48
    Status
    GetTableFiles(const std::string &table_id, const std::vector<size_t> &ids, TableFilesSchema &table_files) override;
X
Xu Peng 已提交
49

J
jinhai 已提交
50 51
    Status
    HasNonIndexFiles(const std::string &table_id, bool &has) override;
P
peng.xu 已提交
52

J
jinhai 已提交
53 54
    Status
    UpdateTableFilesToIndex(const std::string &table_id) override;
P
peng.xu 已提交
55

J
jinhai 已提交
56 57
    Status
    UpdateTableFile(TableFileSchema &file_schema) override;
58

J
jinhai 已提交
59 60
    Status
    UpdateTableFiles(TableFilesSchema &files) override;
61

J
jinhai 已提交
62 63
    Status
    FilesToSearch(const std::string &table_id, const DatesT &partition, DatePartionedTableFilesSchema &files) override;
X
xj.lin 已提交
64

X
xj.lin 已提交
65 66 67 68 69
    Status FilesToSearch(const std::string &table_id,
                         const std::vector<size_t> &ids,
                         const DatesT &partition,
                         DatePartionedTableFilesSchema &files) override;

J
jinhai 已提交
70 71
    Status
    FilesToMerge(const std::string &table_id, DatePartionedTableFilesSchema &files) override;
X
Xu Peng 已提交
72

J
jinhai 已提交
73 74
    Status
    FilesToIndex(TableFilesSchema &) override;
X
Xu Peng 已提交
75

J
jinhai 已提交
76 77
    Status
    Archive() override;
X
Xu Peng 已提交
78

J
jinhai 已提交
79 80
    Status
    Size(uint64_t &result) override;
X
Xu Peng 已提交
81

J
jinhai 已提交
82 83
    Status
    CleanUp() override;
X
Xu Peng 已提交
84

J
jinhai 已提交
85 86
    Status
    CleanUpFilesWithTTL(uint16_t seconds) override;
X
Xu Peng 已提交
87

J
jinhai 已提交
88 89
    Status
    DropAll() override;
X
Xu Peng 已提交
90

J
jinhai 已提交
91
    Status Count(const std::string &table_id, uint64_t &result) override;
X
Xu Peng 已提交
92

J
jinhai 已提交
93
    ~DBMetaImpl() override;
X
Xu Peng 已提交
94

J
jinhai 已提交
95 96 97
 private:
    Status NextFileId(std::string &file_id);
    Status NextTableId(std::string &table_id);
X
Xu Peng 已提交
98 99 100 101
    Status DiscardFiles(long to_discard_size);
    Status Initialize();

    const DBMetaOptions options_;
X
Xu Peng 已提交
102 103
}; // DBMetaImpl

104
} // namespace meta
X
Xu Peng 已提交
105
} // namespace engine
J
jinhai 已提交
106
} // namespace milvus
X
Xu Peng 已提交
107
} // namespace zilliz