db_impl.h 1.0 KB
Newer Older
X
Xu Peng 已提交
1 2 3
#ifndef VECENGINE_DB_IMPL_H_
#define VECENGINE_DB_IMPL_H_

X
Xu Peng 已提交
4 5
#include <mutex>
#include <condition_variable>
X
Xu Peng 已提交
6 7
#include "db.h"

X
Xu Peng 已提交
8 9 10
namespace zilliz {
namespace vecwise {
namespace engine {
X
Xu Peng 已提交
11 12 13 14 15 16 17

class Env;

class DBImpl : public DB {
public:
    DBImpl(const Options& options_, const std::string& name_);

X
Xu Peng 已提交
18 19 20 21
    virtual Status add_group(GroupOptions options_,
            const std::string& group_id_,
            std::string& gid_) override;

X
Xu Peng 已提交
22 23
    void try_schedule_compaction();

X
Xu Peng 已提交
24 25
    virtual ~DBImpl();
private:
X
Xu Peng 已提交
26

X
Xu Peng 已提交
27 28 29 30
    static void BGWork(void* db);
    void background_call();
    void background_compaction();

X
Xu Peng 已提交
31 32 33
    Status meta_add_group(const std::string& group_id_);
    Status meta_add_group_file(const std::string& group_id_);

X
Xu Peng 已提交
34 35 36 37
    const _dbname;
    Env* const _env;
    const Options _options;

X
Xu Peng 已提交
38 39 40 41 42
    std::mutex _mutex;
    std::condition_variable _bg_work_finish_signal;
    bool _bg_compaction_scheduled;
    Status _bg_error;

X
Xu Peng 已提交
43 44
}; // DBImpl

X
Xu Peng 已提交
45 46 47 48 49
} // namespace engine
} // namespace vecwise
} // namespace zilliz

#endif // VECENGINE_DB_META_IMPL_H_
X
Xu Peng 已提交
50 51

#endif // VECENGINE_DB_IMPL_H_