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
ad866f7a
Commit
ad866f7a
authored
Jul 17, 2018
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/update/Config: use struct ConfigData
parent
338a6f2a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
21 additions
and
13 deletions
+21
-13
Main.cxx
src/Main.cxx
+6
-5
Config.cxx
src/db/update/Config.cxx
+6
-4
Config.hxx
src/db/update/Config.hxx
+3
-1
Service.cxx
src/db/update/Service.cxx
+4
-2
Service.hxx
src/db/update/Service.hxx
+2
-1
No files found.
src/Main.cxx
View file @
ad866f7a
...
...
@@ -181,7 +181,7 @@ InitStorage(EventLoop &event_loop)
* process has been daemonized.
*/
static
bool
glue_db_init_and_load
(
void
)
glue_db_init_and_load
(
const
ConfigData
&
config
)
{
instance
->
database
=
CreateConfiguredDatabase
(
instance
->
event_loop
,
...
...
@@ -218,7 +218,8 @@ glue_db_init_and_load(void)
return
true
;
SimpleDatabase
&
db
=
*
(
SimpleDatabase
*
)
instance
->
database
;
instance
->
update
=
new
UpdateService
(
instance
->
event_loop
,
db
,
instance
->
update
=
new
UpdateService
(
config
,
instance
->
event_loop
,
db
,
static_cast
<
CompositeStorage
&>
(
*
instance
->
storage
),
*
instance
);
...
...
@@ -227,9 +228,9 @@ glue_db_init_and_load(void)
}
static
bool
InitDatabaseAndStorage
()
InitDatabaseAndStorage
(
const
ConfigData
&
config
)
{
const
bool
create_db
=
!
glue_db_init_and_load
();
const
bool
create_db
=
!
glue_db_init_and_load
(
config
);
return
create_db
;
}
...
...
@@ -555,7 +556,7 @@ try {
decoder_plugin_init_all
(
GetGlobalConfig
());
#ifdef ENABLE_DATABASE
const
bool
create_db
=
InitDatabaseAndStorage
();
const
bool
create_db
=
InitDatabaseAndStorage
(
GetGlobalConfig
()
);
#endif
glue_sticker_init
();
...
...
src/db/update/Config.cxx
View file @
ad866f7a
...
...
@@ -19,18 +19,20 @@
#include "config.h"
#include "Config.hxx"
#include "config/
Global
.hxx"
#include "config/
Data
.hxx"
#include "config/Option.hxx"
UpdateConfig
::
UpdateConfig
()
UpdateConfig
::
UpdateConfig
(
const
ConfigData
&
config
)
{
#ifndef _WIN32
follow_inside_symlinks
=
config
_get_b
ool
(
ConfigOption
::
FOLLOW_INSIDE_SYMLINKS
,
config
.
GetB
ool
(
ConfigOption
::
FOLLOW_INSIDE_SYMLINKS
,
DEFAULT_FOLLOW_INSIDE_SYMLINKS
);
follow_outside_symlinks
=
config
_get_b
ool
(
ConfigOption
::
FOLLOW_OUTSIDE_SYMLINKS
,
config
.
GetB
ool
(
ConfigOption
::
FOLLOW_OUTSIDE_SYMLINKS
,
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS
);
#else
(
void
)
config
;
#endif
}
src/db/update/Config.hxx
View file @
ad866f7a
...
...
@@ -22,6 +22,8 @@
#include "check.h"
struct
ConfigData
;
struct
UpdateConfig
{
#ifndef _WIN32
static
constexpr
bool
DEFAULT_FOLLOW_INSIDE_SYMLINKS
=
true
;
...
...
@@ -31,7 +33,7 @@ struct UpdateConfig {
bool
follow_outside_symlinks
=
DEFAULT_FOLLOW_OUTSIDE_SYMLINKS
;
#endif
UpdateConfig
(
);
explicit
UpdateConfig
(
const
ConfigData
&
config
);
};
#endif
src/db/update/Service.cxx
View file @
ad866f7a
...
...
@@ -38,10 +38,12 @@
#include <assert.h>
UpdateService
::
UpdateService
(
EventLoop
&
_loop
,
SimpleDatabase
&
_db
,
UpdateService
::
UpdateService
(
const
ConfigData
&
_config
,
EventLoop
&
_loop
,
SimpleDatabase
&
_db
,
CompositeStorage
&
_storage
,
DatabaseListener
&
_listener
)
:
defer
(
_loop
,
BIND_THIS_METHOD
(
RunDeferred
)),
:
config
(
_config
),
defer
(
_loop
,
BIND_THIS_METHOD
(
RunDeferred
)),
db
(
_db
),
storage
(
_storage
),
listener
(
_listener
),
update_thread
(
BIND_THIS_METHOD
(
Task
))
...
...
src/db/update/Service.hxx
View file @
ad866f7a
...
...
@@ -60,7 +60,8 @@ class UpdateService final {
UpdateWalk
*
walk
=
nullptr
;
public
:
UpdateService
(
EventLoop
&
_loop
,
SimpleDatabase
&
_db
,
UpdateService
(
const
ConfigData
&
_config
,
EventLoop
&
_loop
,
SimpleDatabase
&
_db
,
CompositeStorage
&
_storage
,
DatabaseListener
&
_listener
);
...
...
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