ASAPCabinetFE
 
Loading...
Searching...
No Matches
vpsdb_catalog_json.h
1#ifndef VPSDB_CATALOG_JSON_H
2#define VPSDB_CATALOG_JSON_H
3
4#include "vpsdb_metadata.h"
6#include "config/settings.h"
7#include "log/logging.h"
8#include <string>
9#include <vector>
10#include <memory>
11#include <atomic>
12#include <thread>
13
14namespace vpsdb {
15
17public:
18 VpsdbJsonLoader(const std::string& vpsdbFilePath, const Settings& settings);
20 void initialize();
21 bool isLoaded() const { return loaded_; }
22 const std::vector<TableIndex>& getIndex() const { return index_; }
23 int getProgressStage() const { return progressStage_; }
24 bool isLoading() const { return isLoading_; }
25
26private:
27 std::string vpsdbFilePath_;
28 const Settings& settings_;
29 std::vector<TableIndex> index_;
30 bool loaded_;
31 std::atomic<bool> isLoading_;
32 std::atomic<int> progressStage_; // 0: Not started, 1: Fetching, 2: Loading JSON, 3: Done
33 std::unique_ptr<VpsDatabaseClient> vpsDbClient_;
34 std::thread initThread_;
35
36 void loadJson();
37 void initInBackground();
38};
39
40} // namespace vpsdb
41
42#endif // VPSDB_CATALOG_JSON_H
Definition vpsdb_catalog_json.h:16
Definition settings.h:12
Defines the VpsDatabaseClient class for managing the VPS database in ASAPCabinetFE.
Data structures for parsing VPSDB JSON in ASAPCabinetFE.