Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
7e76656a
Commit
7e76656a
authored
Aug 24, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/DatabasePlugin: add #EventLoop parameter documentation
parent
0b93f52b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
9 deletions
+20
-9
Configured.cxx
src/db/Configured.cxx
+8
-4
Configured.hxx
src/db/Configured.hxx
+2
-1
DatabaseGlue.cxx
src/db/DatabaseGlue.cxx
+3
-2
DatabaseGlue.hxx
src/db/DatabaseGlue.hxx
+2
-1
DatabasePlugin.hxx
src/db/DatabasePlugin.hxx
+5
-1
No files found.
src/db/Configured.cxx
View file @
7e76656a
...
...
@@ -28,7 +28,8 @@
#include "util/RuntimeError.hxx"
Database
*
CreateConfiguredDatabase
(
EventLoop
&
loop
,
DatabaseListener
&
listener
)
CreateConfiguredDatabase
(
EventLoop
&
main_event_loop
,
DatabaseListener
&
listener
)
{
const
auto
*
param
=
config_get_block
(
ConfigBlockOption
::
DATABASE
);
const
auto
*
path
=
config_get_param
(
ConfigOption
::
DB_FILE
);
...
...
@@ -38,11 +39,13 @@ CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener)
param
->
line
,
path
->
line
);
if
(
param
!=
nullptr
)
return
DatabaseGlobalInit
(
loop
,
listener
,
*
param
);
return
DatabaseGlobalInit
(
main_event_loop
,
listener
,
*
param
);
else
if
(
path
!=
nullptr
)
{
ConfigBlock
block
(
path
->
line
);
block
.
AddBlockParam
(
"path"
,
path
->
value
.
c_str
(),
path
->
line
);
return
DatabaseGlobalInit
(
loop
,
listener
,
block
);
return
DatabaseGlobalInit
(
main_event_loop
,
listener
,
block
);
}
else
{
/* if there is no override, use the cache directory */
...
...
@@ -58,6 +61,7 @@ CreateConfiguredDatabase(EventLoop &loop, DatabaseListener &listener)
ConfigBlock
block
;
block
.
AddBlockParam
(
"path"
,
db_file_utf8
.
c_str
(),
-
1
);
return
DatabaseGlobalInit
(
loop
,
listener
,
block
);
return
DatabaseGlobalInit
(
main_event_loop
,
listener
,
block
);
}
}
src/db/Configured.hxx
View file @
7e76656a
...
...
@@ -34,6 +34,7 @@ class Database;
* Throws #std::runtime_error on error.
*/
Database
*
CreateConfiguredDatabase
(
EventLoop
&
loop
,
DatabaseListener
&
listener
);
CreateConfiguredDatabase
(
EventLoop
&
main_event_loop
,
DatabaseListener
&
listener
);
#endif
src/db/DatabaseGlue.cxx
View file @
7e76656a
...
...
@@ -26,7 +26,8 @@
#include "DatabasePlugin.hxx"
Database
*
DatabaseGlobalInit
(
EventLoop
&
loop
,
DatabaseListener
&
listener
,
DatabaseGlobalInit
(
EventLoop
&
main_event_loop
,
DatabaseListener
&
listener
,
const
ConfigBlock
&
block
)
{
const
char
*
plugin_name
=
...
...
@@ -38,7 +39,7 @@ DatabaseGlobalInit(EventLoop &loop, DatabaseListener &listener,
plugin_name
);
try
{
return
plugin
->
create
(
loop
,
listener
,
block
);
return
plugin
->
create
(
main_event_
loop
,
listener
,
block
);
}
catch
(...)
{
std
::
throw_with_nested
(
FormatRuntimeError
(
"Failed to initialize database plugin '%s'"
,
plugin_name
));
...
...
src/db/DatabaseGlue.hxx
View file @
7e76656a
...
...
@@ -35,7 +35,8 @@ class Database;
* @param block the database configuration block
*/
Database
*
DatabaseGlobalInit
(
EventLoop
&
loop
,
DatabaseListener
&
listener
,
DatabaseGlobalInit
(
EventLoop
&
main_event_loop
,
DatabaseListener
&
listener
,
const
ConfigBlock
&
block
);
#endif
src/db/DatabasePlugin.hxx
View file @
7e76656a
...
...
@@ -46,8 +46,12 @@ struct DatabasePlugin {
* Allocates and configures a database.
*
* Throws #std::runtime_error on error.
*
* @param main_event_loop the #EventLoop running in the same
* thread which invokes #Database methods
*/
Database
*
(
*
create
)(
EventLoop
&
loop
,
DatabaseListener
&
listener
,
Database
*
(
*
create
)(
EventLoop
&
main_event_loop
,
DatabaseListener
&
listener
,
const
ConfigBlock
&
block
);
constexpr
bool
RequireStorage
()
const
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment