mirror of
https://github.com/uroni/urbackup_backend.git
synced 2025-10-26 11:36:50 +00:00
33 lines
631 B
C++
33 lines
631 B
C++
#pragma once
|
|
|
|
#include "../Interface/Types.h"
|
|
#include "../Interface/Mutex.h"
|
|
#include <memory>
|
|
#include <map>
|
|
#include "../common/lrucache.h"
|
|
|
|
class DataplanDb
|
|
{
|
|
public:
|
|
DataplanDb();
|
|
|
|
static DataplanDb* getInstance();
|
|
static void init();
|
|
|
|
struct SDataplanItem
|
|
{
|
|
std::string hostname_glob;
|
|
int64 limit;
|
|
};
|
|
|
|
bool read(const std::string& fn);
|
|
|
|
bool getLimit(const std::string& hostname, std::string& pattern, int64& limit);
|
|
|
|
private:
|
|
static DataplanDb* instance;
|
|
std::unique_ptr<IMutex> mutex;
|
|
std::vector<SDataplanItem> items;
|
|
common::lrucache<std::string, SDataplanItem> cache;
|
|
|
|
}; |