DatabasePlugin: add FLAG_REQUIRE_STORAGE
Ignore the storage configuration if FLAG_REQUIRE_STORAGE is not set in the DatabasePlugin.
This commit is contained in:
@@ -33,6 +33,12 @@ class DatabaseListener;
|
||||
class Database;
|
||||
|
||||
struct DatabasePlugin {
|
||||
/**
|
||||
* This plugin requires a #Storage instance. It contains only
|
||||
* cached metadata from files in the #Storage.
|
||||
*/
|
||||
static constexpr unsigned FLAG_REQUIRE_STORAGE = 0x1;
|
||||
|
||||
const char *name;
|
||||
|
||||
unsigned flags;
|
||||
@@ -43,6 +49,10 @@ struct DatabasePlugin {
|
||||
Database *(*create)(EventLoop &loop, DatabaseListener &listener,
|
||||
const config_param ¶m,
|
||||
Error &error);
|
||||
|
||||
constexpr bool RequireStorage() const {
|
||||
return flags & FLAG_REQUIRE_STORAGE;
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -780,6 +780,6 @@ ProxyDatabase::GetStats(const DatabaseSelection &selection,
|
||||
|
||||
const DatabasePlugin proxy_db_plugin = {
|
||||
"proxy",
|
||||
0,
|
||||
DatabasePlugin::FLAG_REQUIRE_STORAGE,
|
||||
ProxyDatabase::Create,
|
||||
};
|
||||
|
@@ -337,6 +337,6 @@ SimpleDatabase::Save(Error &error)
|
||||
|
||||
const DatabasePlugin simple_db_plugin = {
|
||||
"simple",
|
||||
0,
|
||||
DatabasePlugin::FLAG_REQUIRE_STORAGE,
|
||||
SimpleDatabase::Create,
|
||||
};
|
||||
|
Reference in New Issue
Block a user