DBMetaImpl.h 3.0 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 11 12 13

namespace zilliz {
namespace vecwise {
namespace engine {
14
namespace meta {
X
Xu Peng 已提交
15

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

X
Xu Peng 已提交
18 19
class DBMetaImpl : public Meta {
public:
X
Xu Peng 已提交
20
    DBMetaImpl(const DBMetaOptions& options_);
X
Xu Peng 已提交
21

22
    virtual Status CreateTable(TableSchema& table_schema) override;
23
    virtual Status get_group(TableSchema& group_info_) override;
24
    virtual Status has_group(const std::string& table_id_, bool& has_or_not_) override;
25

26
    virtual Status add_group_file(TableFileSchema& group_file_info) override;
27
    virtual Status delete_group_partitions(const std::string& table_id,
X
Xu Peng 已提交
28
            const meta::DatesT& dates) override;
X
Xu Peng 已提交
29

30
    virtual Status has_group_file(const std::string& table_id_,
31 32
                                  const std::string& file_id_,
                                  bool& has_or_not_) override;
33
    virtual Status get_group_file(const std::string& table_id_,
34
                                  const std::string& file_id_,
35 36
                                  TableFileSchema& group_file_info_) override;
    virtual Status update_group_file(TableFileSchema& group_file_) override;
37

38
    virtual Status get_group_files(const std::string& table_id_,
39
                                   const int date_delta_,
40
                                   TableFilesSchema& group_files_info_) override;
X
Xu Peng 已提交
41

42
    virtual Status update_files(TableFilesSchema& files) override;
43

44
    virtual Status files_to_merge(const std::string& table_id,
45
            DatePartionedTableFilesSchema& files) override;
X
Xu Peng 已提交
46

47
    virtual Status files_to_search(const std::string& table_id,
X
Xu Peng 已提交
48
                                  const DatesT& partition,
49
                                  DatePartionedTableFilesSchema& files) override;
X
xj.lin 已提交
50

51
    virtual Status files_to_index(TableFilesSchema&) override;
X
Xu Peng 已提交
52

X
Xu Peng 已提交
53 54
    virtual Status archive_files() override;

X
Xu Peng 已提交
55 56
    virtual Status size(long& result) override;

X
Xu Peng 已提交
57 58
    virtual Status cleanup() override;

X
Xu Peng 已提交
59 60
    virtual Status cleanup_ttl_files(uint16_t seconds) override;

X
Xu Peng 已提交
61 62
    virtual Status drop_all() override;

63
    virtual Status count(const std::string& table_id, long& result) override;
X
Xu Peng 已提交
64

X
Xu Peng 已提交
65 66
    virtual ~DBMetaImpl();

X
Xu Peng 已提交
67
private:
X
Xu Peng 已提交
68
    Status NextFileId(std::string& file_id);
69
    Status NextGroupId(std::string& table_id);
X
Xu Peng 已提交
70
    Status discard_files_of_size(long to_discard_size);
71
    Status get_group_no_lock(TableSchema& group_info);
72 73
    std::string GetGroupPath(const std::string& table_id);
    std::string GetGroupDatePartitionPath(const std::string& table_id, DateT& date);
74
    void GetGroupFilePath(TableFileSchema& group_file);
X
Xu Peng 已提交
75 76
    Status initialize();

X
Xu Peng 已提交
77
    const DBMetaOptions _options;
X
Xu Peng 已提交
78 79
}; // DBMetaImpl

80
} // namespace meta
X
Xu Peng 已提交
81 82 83
} // namespace engine
} // namespace vecwise
} // namespace zilliz