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
aa0f06d6
Commit
aa0f06d6
authored
Jul 29, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/Interface: add virtual method Update()
For database plugins that don't use the UpdateService.
parent
0c47685e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
OtherCommands.cxx
src/command/OtherCommands.cxx
+24
-0
Interface.hxx
src/db/Interface.hxx
+12
-0
No files found.
src/command/OtherCommands.cxx
View file @
aa0f06d6
...
...
@@ -49,6 +49,7 @@
#ifdef ENABLE_DATABASE
#include "DatabaseCommands.hxx"
#include "db/Interface.hxx"
#include "db/update/Service.hxx"
#endif
...
...
@@ -242,6 +243,25 @@ handle_update(Client &client, UpdateService &update,
}
}
static
CommandResult
handle_update
(
Client
&
client
,
Database
&
db
,
const
char
*
uri_utf8
,
bool
discard
)
{
Error
error
;
unsigned
id
=
db
.
Update
(
uri_utf8
,
discard
,
error
);
if
(
id
>
0
)
{
client_printf
(
client
,
"updating_db: %i
\n
"
,
id
);
return
CommandResult
::
OK
;
}
else
if
(
error
.
IsDefined
())
{
return
print_error
(
client
,
error
);
}
else
{
/* Database::Update() has returned 0 without setting
the Error: the method is not implemented */
command_error
(
client
,
ACK_ERROR_NO_EXIST
,
"Not implemented"
);
return
CommandResult
::
ERROR
;
}
}
#endif
static
CommandResult
...
...
@@ -267,6 +287,10 @@ handle_update(Client &client, unsigned argc, char *argv[], bool discard)
UpdateService
*
update
=
client
.
partition
.
instance
.
update
;
if
(
update
!=
nullptr
)
return
handle_update
(
client
,
*
update
,
path
,
discard
);
Database
*
db
=
client
.
partition
.
instance
.
database
;
if
(
db
!=
nullptr
)
return
handle_update
(
client
,
*
db
,
path
,
discard
);
#else
(
void
)
argc
;
(
void
)
argv
;
...
...
src/db/Interface.hxx
View file @
aa0f06d6
...
...
@@ -116,6 +116,18 @@ public:
Error
&
error
)
const
=
0
;
/**
* Update the database. Returns the job id on success, 0 on
* error (with #Error set) and 0 if not implemented (#Error
* not set).
*/
virtual
unsigned
Update
(
gcc_unused
const
char
*
uri_utf8
,
gcc_unused
bool
discard
,
gcc_unused
Error
&
error
)
{
/* not implemented: return 0 and don't set an Error */
return
0
;
}
/**
* Returns the time stamp of the last database update.
* Returns 0 if that is not not known/available.
*/
...
...
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