DBus server: add 'dir' key in the reports (MB#8144)

The 'dir' key is stored in each report for GetReports.
It will save the full directory and be transferred to
dbus clients.
The root cause is to give an ID to dbus clients and the
ID is used to identify the report, in the Session.Restore.
This commit is contained in:
Zhu, Yongsheng 2009-12-15 11:11:38 +08:00
parent 02f9ca171e
commit 155edfdaf8
3 changed files with 4 additions and 1 deletions

View File

@ -167,7 +167,7 @@
<arg type="aa{ss}" name="reports" direction="out">
<doc:doc><doc:summary>synchronization reports</doc:summary></doc:doc>
<doc:doc><doc:description>The array contains report dictionaries. The dictionary keys can be defined by below BNFs:
Key ::= 'peer' | 'start' | 'end' | 'status' | 'error' | SourceKey
Key ::= 'dir' | 'peer' | 'start' | 'end' | 'status' | 'error' | SourceKey
SourceKey ::= SourcePrefix SourcePart
SourcePrefix ::= 'source' Sep SourceName
SourceName ::= character+

View File

@ -1307,6 +1307,8 @@ void ReadOperations::getReports(uint32_t start, uint32_t count,
if(index >= start && index - start < count) {
const string &dir = dirs[i];
std::map<string, string> aReport;
// insert a 'dir' as an ID for the current report
aReport.insert(pair<string, string>("dir", dir));
SyncReport report;
// peerName is also extracted from the dir
string peerName = client.readSessionInfo(dir,report);

View File

@ -1066,6 +1066,7 @@ class TestSessionAPIsDummy(unittest.TestCase, DBusUtil):
# get only one report
reports = self.session.GetReports(0, 1, utf8_strings=True)
self.assertTrue(len(reports) == 1)
del reports[0]["dir"]
self.failUnlessEqual(reports[0], report0)
""" the number of reference sessions is totally 5. Check the returned count