RPC call info_actions_folder seem to work almost perfectly
Use ccnpeek to test:
ccnpeek -c /localhost/<your-user-name>/chronoshare/<folder>/info/actions/folder/<nonce>/%00
or
ccnpeek -c /localhost/<your-user-name>/chronoshare/<folder>/info/actions/folder/<specific-folder>/<nonce>/%00
+ json_spirit used to format the whole message, not just parts
Change-Id: I40c15459a8ae0ef6278364c45e84e5cbd0b08241
diff --git a/src/state-server.h b/src/state-server.h
index 24c9b05..b4d69e0 100644
--- a/src/state-server.h
+++ b/src/state-server.h
@@ -32,6 +32,13 @@
#include <boost/thread/locks.hpp>
#include "executor.h"
+#include "../contrib/json_spirit/json_spirit_writer_template.h"
+#include "../contrib/json_spirit/json_spirit_value.h"
+
+#ifndef JSON_SPIRIT_VALUE_ENABLED
+#error Please define JSON_SPIRIT_VALUE_ENABLED for the Value type to be enabled
+#endif
+
/**
* @brief Class serving state information from ChronoShare
*
@@ -56,9 +63,44 @@
* Actions are ordered in decreasing order (latest will go first).
*
* Each data packet contains up to 100 actions.
+ *
+ * TEMPORARILY LIMIT IS REDUCED TO 10 ! (for debug purposes)
+ *
* If more items are available, application data will specify URL for the next packet
*
* @todo SPECIFY FORMAT OF THIS FIELD
+ * Format of returned data (JSON):
+ * {
+ * "actions": [
+ * {
+ * "id": {
+ * "userName": "<NDN-NAME-OF-THE-USER>",
+ * "seqNo": "<SEQ_NO_OF_THE_ACTION>"
+ * },
+ * "timestamp": "<ACTION-TIMESTAMP>",
+ * "filename": "<FILENAME>",
+ *
+ * "action": "UPDATE | DELETE",
+ *
+ * // only if update
+ * "update": {
+ * "hash": "<FILE-HASH>",
+ * "timestamp": "<FILE-TIMESTAMP>",
+ * "chmod": "<FILE-MODE>",
+ * "segNum": "<NUMBER-OF-SEGMENTS (~file size)>"
+ * },
+ *
+ * // if parent_device_name is set
+ * "parentId": {
+ * "userName": "<NDN-NAME-OF-THE-USER>",
+ * "seqNo": "<SEQ_NO_OF_THE_ACTION>"
+ * };
+ * },
+ *
+ * // only if there are more actions available
+ * "more": "<NDN-NAME-OF-NEXT-SEGMENT-OF-ACTION>"
+ * }
+ *
*
* - file
*
@@ -120,6 +162,9 @@
void
deregisterPrefixes ();
+ static void
+ formatActionJson (json_spirit::Array &actions, const Ccnx::Name &name, sqlite3_int64 seq_no, const ActionItem &action);
+
private:
Ccnx::CcnxWrapperPtr m_ccnx;
ActionLogPtr m_actionLog;