Debugging ActionLog. Corrections in dispatcher (filename in DB should be in a "generic" format)
diff --git a/src/dispatcher.cc b/src/dispatcher.cc
index d48bb43..bdcc469 100644
--- a/src/dispatcher.cc
+++ b/src/dispatcher.cc
@@ -39,7 +39,7 @@
, m_sharedFolder(sharedFolder)
{
m_syncLog = make_shared<SyncLog>(path, localUserName);
- m_actionLog = make_shared<ActionLog>(m_ccnx, path, m_syncLog, localUserName, sharedFolder);
+ m_actionLog = make_shared<ActionLog>(m_ccnx, path, m_syncLog, sharedFolder);
Name syncPrefix(BROADCAST_DOMAIN + sharedFolder);
m_core = new SyncCore (m_syncLog, localUserName, localPrefix, syncPrefix,
@@ -102,7 +102,7 @@
if (filesystem::exists(absolutePath))
{
HashPtr hash = Hash::FromFileContent(absolutePath);
- if (m_actionLog->KnownFileState(relativeFilePath.string(), *hash))
+ if (m_actionLog->KnownFileState(relativeFilePath.generic_string(), *hash))
{
// the file state is known; i.e. the detected changed file is identical to
// the file state kept in FileState table
@@ -112,13 +112,16 @@
else
{
uintmax_t fileSize = filesystem::file_size(absolutePath);
- int seg_num = fileSize / MAX_FILE_SEGMENT_SIZE + ((fileSize % MAX_FILE_SEGMENT_SIZE == 0) ? 0 : 1);
- time_t wtime = filesystem::last_write_time(absolutePath);
- filesystem::file_status stat = filesystem::status(absolutePath);
+ int seg_num;
+ tie (hash, seg_num) = m_objectManager.localFileToObjects (absolutePath, m_localUserName);
+
+ time_t wtime = filesystem::last_write_time (absolutePath);
+ filesystem::file_status stat = filesystem::status (absolutePath);
int mode = stat.permissions();
- m_actionLog->AddActionUpdate (relativeFilePath.string(), *hash, wtime, mode, seg_num);
+
+ m_actionLog->AddLocalActionUpdate (relativeFilePath.generic_string(), *hash, wtime, mode, seg_num);
// publish the file
- m_objectManager.localFileToObjects(relativeFilePath, m_localUserName);
+
// notify SyncCore to propagate the change
m_core->localStateChanged();
}
@@ -131,7 +134,7 @@
}
case DELETE:
{
- m_actionLog->AddActionDelete (relativeFilePath.string());
+ m_actionLog->AddLocalActionDelete (relativeFilePath.generic_string());
// notify SyncCore to propagate the change
m_core->localStateChanged();
break;