Adding and finishing test for adding remotely fetched actions
diff --git a/src/action-log.cc b/src/action-log.cc
index 6254e1e..becbfe3 100644
--- a/src/action-log.cc
+++ b/src/action-log.cc
@@ -498,6 +498,25 @@
Name name = actionPco->name ();
// <device_name>/"action"/<shared_folder_name_one_component>/<seqno>
+ uint64_t seqno = name.getCompFromBackAsInt (0);
+ string sharedFolder = name.getCompFromBackAsString (1);
+
+ if (sharedFolder != m_sharedFolderName)
+ {
+ BOOST_THROW_EXCEPTION (Error::ActionLog () << errmsg_info_str ("Action doesn't belong to this shared folder"));
+ }
+
+ string action = name.getCompFromBackAsString (2);
+
+ if (action != "action")
+ {
+ BOOST_THROW_EXCEPTION (Error::ActionLog () << errmsg_info_str ("not an action"));
+ }
+ Name deviceName = name.getPartialName (0, name.size ()-3);
+
+ _LOG_DEBUG ("From [" << name << "] extracted deviceName: " << deviceName << ", sharedFolder: " << sharedFolder << ", seqno: " << seqno);
+
+ AddRemoteAction (deviceName, seqno, actionPco);
}
///////////////////////////////////////////////////////////////////////////////////
diff --git a/src/file-item.proto b/src/file-item.proto
new file mode 100644
index 0000000..937226b
--- /dev/null
+++ b/src/file-item.proto
@@ -0,0 +1,18 @@
+message FileItem
+{
+ enum FileType
+ {
+ LATEST = 0;
+ OLDEST = 1;
+ }
+ required FileType type = 1;
+
+ required string filename = 2;
+ required bytes device_name = 3;
+ required uint64 seq_no = 4;
+
+ required bytes file_hash = 5;
+ required uint32 mtime = 6;
+ required uint32 mode = 7;
+ required uint64 seg_num = 8;
+}
diff --git a/src/sync-core.cc b/src/sync-core.cc
index d85093b..9d2003d 100644
--- a/src/sync-core.cc
+++ b/src/sync-core.cc
@@ -82,7 +82,7 @@
// reply sync Interest with oldHash as last component
Name syncName = Name (m_syncPrefix)(oldHash->GetHash(), oldHash->GetHashBytes());
- BytesPtr syncData = serializeMsg (msg);
+ BytesPtr syncData = serializeMsg (*msg);
m_ccnx->publishData(syncName, *syncData, FRESHNESS);
_LOG_TRACE (m_log->GetLocalName () << " publishes: " << *oldHash);
@@ -125,7 +125,7 @@
// we know the hash, should reply everything
SyncStateMsgPtr msg = m_log->FindStateDifferences(*(Hash::Origin), *m_rootHash);
- BytesPtr syncData = serializeMsg (msg);
+ BytesPtr syncData = serializeMsg (*msg);
m_ccnx->publishData(name, *syncData, FRESHNESS);
_LOG_TRACE (m_log->GetLocalName () << " publishes " << hash);
_LOG_TRACE (msg);
@@ -153,7 +153,7 @@
_LOG_TRACE ("found hash in sync log");
SyncStateMsgPtr msg = m_log->FindStateDifferences(*hash, *m_rootHash);
- BytesPtr syncData = serializeMsg (msg);
+ BytesPtr syncData = serializeMsg (*msg);
m_ccnx->publishData(name, *syncData, FRESHNESS);
_LOG_TRACE (m_log->GetLocalName () << " publishes: " << *hash);
_LOG_TRACE (msg);