{"action":"created","comment":{"url":"https://api.github.com/repos/MitocGroup/deep-framework/pulls/comments/47782012","id":47782012,"diff_hunk":"@@ -0,0 +1,133 @@\n+/**\n+ * Created by CCristi <ccovali@mitocgroup.com> on 12/10/15.\n+ */\n+\n+'use strict';\n+\n+import {AbstractFsDriver} from './AbstractFsDriver';\n+import {MethodNotAvailableException} from '../Exception/MethodNotAvailableException';\n+import {Exception} from '../Exception/Exception';\n+\n+/**\n+ * CloudFront Cache Driver\n+ */\n+export class CloudFrontDriver extends AbstractFsDriver {\n+\n+  /**\n+   * @todo: Find better way to extract the working microservice identifier\n+   *\n+   * @param {ContainerAware} containerAware\n+   * @param {String} directory\n+   */\n+  constructor(containerAware, directory = AbstractFsDriver.DEFAULT_DIRECTORY) {\n+    super(directory);\n+\n+    this._containerAware = containerAware;\n+  }\n+\n+  /**\n+   * @param {String} key\n+   * @param {Function} callback\n+   * @private\n+   */\n+  _has(key, callback = () => {}) {\n+    this._get(key, (err, data) => {\n+      callback(err, data !== null);\n+    });\n+  }\n+\n+  /**\n+   * @param {String} key\n+   * @param {Function} callback\n+   * @private\n+   */\n+  _get(key, callback = () => {}) {\n+    this._request(key, (err, data) => {\n+      if (err) {\n+        return callback(err, null);\n+      }\n+\n+      try {\n+        let parsedData = JSON.parse(data);\n+\n+        if (parsedData.expires && parsedData.expires < AbstractFsDriver._now) {\n+          throw new Exception('Expired');\n+        }\n+\n+        callback(null, parsedData.value);\n+      } catch (e) {\n+        // @todo: Find a way to invalidate broken or expired keys\n+        callback(null, null);\n+      }\n+    });\n+  }\n+\n+  /**\n+   * @param {String} key\n+   * @param {Object} value\n+   * @param {Function} callback\n+   * @private\n+   */\n+  _set(key, value, callback = () => {}) {\n+    throw new MethodNotAvailableException('set');\n+  }\n+\n+  /**\n+   * @param key\n+   * @param timeout\n+   * @param callback\n+   * @private\n+   */\n+  _invalidate(key, timeout = 0, callback = () => {}) {\n+    throw new MethodNotAvailableException('invalidate');\n+  }\n+\n+  /**\n+   * @param {String} key\n+   * @returns {String}\n+   * @private\n+   */\n+  _buildKey(key) {\n+    return this._asset.locate(`@${this._microservice}:${super._buildKey(key)}`);\n+  }\n+\n+  /**\n+   * @param {String} url\n+   * @param {Function} callback\n+   * @private\n+   */\n+  _request(url, callback) {\n+    var client = new XMLHttpRequest();\n+\n+    client.onreadystatechange = function() {\n+      if (client.readyState == 4) {\n+        if (client.status != 200) {","path":"src/deep-cache/lib/Driver/CloudFrontDriver.js","position":104,"original_position":104,"commit_id":"12aefc3017d93875fbc85aee1bfa1a16fc6fa583","original_commit_id":"12aefc3017d93875fbc85aee1bfa1a16fc6fa583","user":{"login":"devs-deep","id":14040097,"avatar_url":"https://avatars.githubusercontent.com/u/14040097?v=3","gravatar_id":"","url":"https://api.github.com/users/devs-deep","html_url":"https://github.com/devs-deep","followers_url":"https://api.github.com/users/devs-deep/followers","following_url":"https://api.github.com/users/devs-deep/following{/other_user}","gists_url":"https://api.github.com/users/devs-deep/gists{/gist_id}","starred_url":"https://api.github.com/users/devs-deep/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/devs-deep/subscriptions","organizations_url":"https://api.github.com/users/devs-deep/orgs","repos_url":"https://api.github.com/users/devs-deep/repos","events_url":"https://api.github.com/users/devs-deep/events{/privacy}","received_events_url":"https://api.github.com/users/devs-deep/received_events","type":"User","site_admin":false},"body":"![Codacy](https://www.codacy.com/versioned/images/favicon.png) Issue found: [Expected '!==' and instead saw '!='.](https://www.codacy.com/app/MitocGroup/deep-framework/file/1585049076/issues/source?bid=2895475&fileBranchId=3024729#l104)","created_at":"2015-12-16T14:35:06Z","updated_at":"2015-12-16T14:35:06Z","html_url":"https://github.com/MitocGroup/deep-framework/pull/152#discussion_r47782012","pull_request_url":"https://api.github.com/repos/MitocGroup/deep-framework/pulls/152","_links":{"self":{"href":"https://api.github.com/repos/MitocGroup/deep-framework/pulls/comments/47782012"},"html":{"href":"https://github.com/MitocGroup/deep-framework/pull/152#discussion_r47782012"},"pull_request":{"href":"https://api.github.com/repos/MitocGroup/deep-framework/pulls/152"}}},"pull_request":{"url":"https://api.github.com/repos/MitocGroup/deep-framework/pulls/152","id":53838241,"html_url":"https://github.com/MitocGroup/deep-framework/pull/152","diff_url":"https://github.com/MitocGroup/deep-framework/pull/152.diff","patch_url":"https://github.com/MitocGroup/deep-framework/pull/152.patch","issue_url":"https://api.github.com/repos/MitocGroup/deep-framework/issues/152","number":152,"state":"open","locked":false,"title":"Shared cache","user":{"login":"CCristi","id":8135089,"avatar_url":"https://avatars.githubusercontent.com/u/8135089?v=3","gravatar_id":"","url":"https://api.github.com/users/CCristi","html_url":"https://github.com/CCristi","followers_url":"https://api.github.com/users/CCristi/followers","following_url":"https://api.github.com/users/CCristi/following{/other_user}","gists_url":"https://api.github.com/users/CCristi/gists{/gist_id}","starred_url":"https://api.github.com/users/CCristi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CCristi/subscriptions","organizations_url":"https://api.github.com/users/CCristi/orgs","repos_url":"https://api.github.com/users/CCristi/repos","events_url":"https://api.github.com/users/CCristi/events{/privacy}","received_events_url":"https://api.github.com/users/CCristi/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-12-16T13:02:52Z","updated_at":"2015-12-16T14:35:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8c194a349b95d21df35f9121bebc852a8cd824a6","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MitocGroup/deep-framework/pulls/152/commits","review_comments_url":"https://api.github.com/repos/MitocGroup/deep-framework/pulls/152/comments","review_comment_url":"https://api.github.com/repos/MitocGroup/deep-framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MitocGroup/deep-framework/issues/152/comments","statuses_url":"https://api.github.com/repos/MitocGroup/deep-framework/statuses/12aefc3017d93875fbc85aee1bfa1a16fc6fa583","head":{"label":"MitocGroup:shared_cache","ref":"shared_cache","sha":"12aefc3017d93875fbc85aee1bfa1a16fc6fa583","user":{"login":"MitocGroup","id":8398780,"avatar_url":"https://avatars.githubusercontent.com/u/8398780?v=3","gravatar_id":"","url":"https://api.github.com/users/MitocGroup","html_url":"https://github.com/MitocGroup","followers_url":"https://api.github.com/users/MitocGroup/followers","following_url":"https://api.github.com/users/MitocGroup/following{/other_user}","gists_url":"https://api.github.com/users/MitocGroup/gists{/gist_id}","starred_url":"https://api.github.com/users/MitocGroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MitocGroup/subscriptions","organizations_url":"https://api.github.com/users/MitocGroup/orgs","repos_url":"https://api.github.com/users/MitocGroup/repos","events_url":"https://api.github.com/users/MitocGroup/events{/privacy}","received_events_url":"https://api.github.com/users/MitocGroup/received_events","type":"Organization","site_admin":false},"repo":{"id":43718196,"name":"deep-framework","full_name":"MitocGroup/deep-framework","owner":{"login":"MitocGroup","id":8398780,"avatar_url":"https://avatars.githubusercontent.com/u/8398780?v=3","gravatar_id":"","url":"https://api.github.com/users/MitocGroup","html_url":"https://github.com/MitocGroup","followers_url":"https://api.github.com/users/MitocGroup/followers","following_url":"https://api.github.com/users/MitocGroup/following{/other_user}","gists_url":"https://api.github.com/users/MitocGroup/gists{/gist_id}","starred_url":"https://api.github.com/users/MitocGroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MitocGroup/subscriptions","organizations_url":"https://api.github.com/users/MitocGroup/orgs","repos_url":"https://api.github.com/users/MitocGroup/repos","events_url":"https://api.github.com/users/MitocGroup/events{/privacy}","received_events_url":"https://api.github.com/users/MitocGroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MitocGroup/deep-framework","description":"Serverless Web Framework for Cloud-Native Applications and Platforms using Microservices Architecture","fork":false,"url":"https://api.github.com/repos/MitocGroup/deep-framework","forks_url":"https://api.github.com/repos/MitocGroup/deep-framework/forks","keys_url":"https://api.github.com/repos/MitocGroup/deep-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MitocGroup/deep-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MitocGroup/deep-framework/teams","hooks_url":"https://api.github.com/repos/MitocGroup/deep-framework/hooks","issue_events_url":"https://api.github.com/repos/MitocGroup/deep-framework/issues/events{/number}","events_url":"https://api.github.com/repos/MitocGroup/deep-framework/events","assignees_url":"https://api.github.com/repos/MitocGroup/deep-framework/assignees{/user}","branches_url":"https://api.github.com/repos/MitocGroup/deep-framework/branches{/branch}","tags_url":"https://api.github.com/repos/MitocGroup/deep-framework/tags","blobs_url":"https://api.github.com/repos/MitocGroup/deep-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MitocGroup/deep-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MitocGroup/deep-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/MitocGroup/deep-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MitocGroup/deep-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/MitocGroup/deep-framework/languages","stargazers_url":"https://api.github.com/repos/MitocGroup/deep-framework/stargazers","contributors_url":"https://api.github.com/repos/MitocGroup/deep-framework/contributors","subscribers_url":"https://api.github.com/repos/MitocGroup/deep-framework/subscribers","subscription_url":"https://api.github.com/repos/MitocGroup/deep-framework/subscription","commits_url":"https://api.github.com/repos/MitocGroup/deep-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/MitocGroup/deep-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/MitocGroup/deep-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/MitocGroup/deep-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/MitocGroup/deep-framework/contents/{+path}","compare_url":"https://api.github.com/repos/MitocGroup/deep-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MitocGroup/deep-framework/merges","archive_url":"https://api.github.com/repos/MitocGroup/deep-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MitocGroup/deep-framework/downloads","issues_url":"https://api.github.com/repos/MitocGroup/deep-framework/issues{/number}","pulls_url":"https://api.github.com/repos/MitocGroup/deep-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/MitocGroup/deep-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/MitocGroup/deep-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MitocGroup/deep-framework/labels{/name}","releases_url":"https://api.github.com/repos/MitocGroup/deep-framework/releases{/id}","created_at":"2015-10-05T22:48:47Z","updated_at":"2015-12-16T12:25:58Z","pushed_at":"2015-12-16T13:02:53Z","git_url":"git://github.com/MitocGroup/deep-framework.git","ssh_url":"git@github.com:MitocGroup/deep-framework.git","clone_url":"https://github.com/MitocGroup/deep-framework.git","svn_url":"https://github.com/MitocGroup/deep-framework","homepage":"http://docs.deep.mg","size":6201,"stargazers_count":151,"watchers_count":151,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":8,"forks":19,"open_issues":8,"watchers":151,"default_branch":"master"}},"base":{"label":"MitocGroup:dev","ref":"dev","sha":"3bc0e3ceea58543b38ca0669a7145a45598b005e","user":{"login":"MitocGroup","id":8398780,"avatar_url":"https://avatars.githubusercontent.com/u/8398780?v=3","gravatar_id":"","url":"https://api.github.com/users/MitocGroup","html_url":"https://github.com/MitocGroup","followers_url":"https://api.github.com/users/MitocGroup/followers","following_url":"https://api.github.com/users/MitocGroup/following{/other_user}","gists_url":"https://api.github.com/users/MitocGroup/gists{/gist_id}","starred_url":"https://api.github.com/users/MitocGroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MitocGroup/subscriptions","organizations_url":"https://api.github.com/users/MitocGroup/orgs","repos_url":"https://api.github.com/users/MitocGroup/repos","events_url":"https://api.github.com/users/MitocGroup/events{/privacy}","received_events_url":"https://api.github.com/users/MitocGroup/received_events","type":"Organization","site_admin":false},"repo":{"id":43718196,"name":"deep-framework","full_name":"MitocGroup/deep-framework","owner":{"login":"MitocGroup","id":8398780,"avatar_url":"https://avatars.githubusercontent.com/u/8398780?v=3","gravatar_id":"","url":"https://api.github.com/users/MitocGroup","html_url":"https://github.com/MitocGroup","followers_url":"https://api.github.com/users/MitocGroup/followers","following_url":"https://api.github.com/users/MitocGroup/following{/other_user}","gists_url":"https://api.github.com/users/MitocGroup/gists{/gist_id}","starred_url":"https://api.github.com/users/MitocGroup/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MitocGroup/subscriptions","organizations_url":"https://api.github.com/users/MitocGroup/orgs","repos_url":"https://api.github.com/users/MitocGroup/repos","events_url":"https://api.github.com/users/MitocGroup/events{/privacy}","received_events_url":"https://api.github.com/users/MitocGroup/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MitocGroup/deep-framework","description":"Serverless Web Framework for Cloud-Native Applications and Platforms using Microservices Architecture","fork":false,"url":"https://api.github.com/repos/MitocGroup/deep-framework","forks_url":"https://api.github.com/repos/MitocGroup/deep-framework/forks","keys_url":"https://api.github.com/repos/MitocGroup/deep-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MitocGroup/deep-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MitocGroup/deep-framework/teams","hooks_url":"https://api.github.com/repos/MitocGroup/deep-framework/hooks","issue_events_url":"https://api.github.com/repos/MitocGroup/deep-framework/issues/events{/number}","events_url":"https://api.github.com/repos/MitocGroup/deep-framework/events","assignees_url":"https://api.github.com/repos/MitocGroup/deep-framework/assignees{/user}","branches_url":"https://api.github.com/repos/MitocGroup/deep-framework/branches{/branch}","tags_url":"https://api.github.com/repos/MitocGroup/deep-framework/tags","blobs_url":"https://api.github.com/repos/MitocGroup/deep-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MitocGroup/deep-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MitocGroup/deep-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/MitocGroup/deep-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MitocGroup/deep-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/MitocGroup/deep-framework/languages","stargazers_url":"https://api.github.com/repos/MitocGroup/deep-framework/stargazers","contributors_url":"https://api.github.com/repos/MitocGroup/deep-framework/contributors","subscribers_url":"https://api.github.com/repos/MitocGroup/deep-framework/subscribers","subscription_url":"https://api.github.com/repos/MitocGroup/deep-framework/subscription","commits_url":"https://api.github.com/repos/MitocGroup/deep-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/MitocGroup/deep-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/MitocGroup/deep-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/MitocGroup/deep-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/MitocGroup/deep-framework/contents/{+path}","compare_url":"https://api.github.com/repos/MitocGroup/deep-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MitocGroup/deep-framework/merges","archive_url":"https://api.github.com/repos/MitocGroup/deep-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MitocGroup/deep-framework/downloads","issues_url":"https://api.github.com/repos/MitocGroup/deep-framework/issues{/number}","pulls_url":"https://api.github.com/repos/MitocGroup/deep-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/MitocGroup/deep-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/MitocGroup/deep-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MitocGroup/deep-framework/labels{/name}","releases_url":"https://api.github.com/repos/MitocGroup/deep-framework/releases{/id}","created_at":"2015-10-05T22:48:47Z","updated_at":"2015-12-16T12:25:58Z","pushed_at":"2015-12-16T13:02:53Z","git_url":"git://github.com/MitocGroup/deep-framework.git","ssh_url":"git@github.com:MitocGroup/deep-framework.git","clone_url":"https://github.com/MitocGroup/deep-framework.git","svn_url":"https://github.com/MitocGroup/deep-framework","homepage":"http://docs.deep.mg","size":6201,"stargazers_count":151,"watchers_count":151,"language":"HTML","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":19,"mirror_url":null,"open_issues_count":8,"forks":19,"open_issues":8,"watchers":151,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MitocGroup/deep-framework/pulls/152"},"html":{"href":"https://github.com/MitocGroup/deep-framework/pull/152"},"issue":{"href":"https://api.github.com/repos/MitocGroup/deep-framework/issues/152"},"comments":{"href":"https://api.github.com/repos/MitocGroup/deep-framework/issues/152/comments"},"review_comments":{"href":"https://api.github.com/repos/MitocGroup/deep-framework/pulls/152/comments"},"review_comment":{"href":"https://api.github.com/repos/MitocGroup/deep-framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MitocGroup/deep-framework/pulls/152/commits"},"statuses":{"href":"https://api.github.com/repos/MitocGroup/deep-framework/statuses/12aefc3017d93875fbc85aee1bfa1a16fc6fa583"}}}}