Refactored into strapp Modules. All in progress with File System current focus
[henge/kiak.git] / strappProtocolManager.js
diff --git a/strappProtocolManager.js b/strappProtocolManager.js
new file mode 100644 (file)
index 0000000..8aa9bfb
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * @file      Strapp Protocol Manager
+ * @author    Jordan Lavatai and Ken Grimes
+ * @version   0.0.1
+ * @license   AGPL-3.0
+ * @copyright Strapp.io
+ */
+
+import send from 'spc'
+
+/* KLMID == Key Location Method msgID Data */
+/* Convert from KLMID to HTTP  */
+/* Convert from HTTP to KLMID */
+/* Parse KLMID -> Execute method based on location */
+/* Convert Object with KLMID keys to a string */
+
+/** @func Parse the strapp protocol string 
+  * @desc KLMID stands for Location Key Method ID Data 
+  *       [Optional] Key is the clientKey that is used to authorize the method
+  *                    If not specified, this message will not have any authorizations
+  *       [Optional] Location is the location of the target file that the method will execute upon
+  *                    If not specified, target file is the current file
+  *       [Required] Method is one of the file commands available 
+  *       [Required] ID is the message ID, used when multiple messages are being sent and received
+  *       [Optional] Data is a parameter for the method e.g. PUT will replace the target files data property
+  * 
+  *        An unincluded message part needs to be indicated by a whitespace, i.e. ' ' i.e. /u{0020}.
+  *       This function is mainly called by a SPCs receive event that processes every message that a SPC
+  *       receives
+  * @arg {String} msg - String conforming to the strapp protocol 
+  * @return {Object} - Parsed object with keys corresponding to segments of strapp Protocol 
+  */
+function parseSPM(msg) {
+  /* if no location, then call the method in LMKID on the local file, i.e. "." */
+}