{"action":"created","comment":{"url":"https://api.github.com/repos/openvstorage/framework/pulls/comments/56632267","id":56632267,"diff_hunk":"@@ -62,193 +56,193 @@ class Operator(object):\n         GT = 'GT'\n         IN = 'IN'\n \n-    select = Select()\n     where_operator = WhereOperator()\n     operator = Operator()\n-    namespace = 'ovs_list'\n-    cachelink = 'ovs_listcache'\n-    partsize_pks = 5000\n+    NAMESPACE = 'ovs_list'\n+    CACHELINK = 'ovs_listcache'\n \n-    def __init__(self, query, key=None, load=True):\n+    def __init__(self, object_type, query, key=None):\n         \"\"\"\n         Initializes a DataList class with a given key (used for optional caching) and a given query\n+        :param object_type: The type of the objects that have to be queried\n+        :param query: The query to execute\n+        :param key: A key under which the result must be cached\n         \"\"\"\n-        # Initialize super class\n         super(DataList, self).__init__()\n \n         if key is not None:\n-            self._key = key\n+            self._key = '{0}_{1}'.format(DataList.NAMESPACE, key)\n         else:\n             identifier = copy.deepcopy(query)\n-            identifier['object'] = identifier['object'].__name__\n-            self._key = hashlib.sha256(json.dumps(identifier)).hexdigest()\n-        self._key = '{0}_{1}'.format(DataList.namespace, self._key)\n+            identifier['object'] = object_type.__name__\n+            self._key = '{0}_{1}'.format(DataList.NAMESPACE, hashlib.sha256(json.dumps(identifier)).hexdigest())\n+\n         self._volatile = VolatileFactory.get_client()\n         self._persistent = PersistentFactory.get_client()\n         self._query = query\n-        self.data = None\n-        self.from_cache = False\n         self._can_cache = True\n-        if load is True:\n-            self._load()\n+        self._object_type = object_type\n+        self._data = {}\n+        self._objects = {}\n+        self._guids = None\n+        self._executed = False\n+        self._shallow_sort = True\n+\n+        self.from_cache = None\n \n-    def _exec_and(self, instance, items):\n+    #######################\n+    # Query functionality #\n+    #######################\n+\n+    def _filter(self, instance, items, where_operator):\n         \"\"\"\n         Executes a given set of query items against the instance in an \"AND\" scope\n         This means the first False will cause the scope to return False\n+        :param instance: An instance of this lists object_type, or a dict with 'guid' and 'data'\n+        :param items: The query items\n+        :param where_operator: The WHERE operator\n         \"\"\"\n+        return_value = where_operator == DataList.where_operator.OR\n         for item in items:\n             if isinstance(item, dict):\n-                # Recursive\n-                if item['type'] == DataList.where_operator.AND:\n-                    result = self._exec_and(instance, item['items'])\n-                else:\n-                    result = self._exec_or(instance, item['items'])\n-                if result is False:\n-                    return False\n-            else:\n-                if self._evaluate(instance, item) is False:\n-                    return False\n-        return True\n-\n-    def _exec_or(self, instance, items):\n-        \"\"\"\n-        Executes a given set of query items against the instance in an \"OR\" scope\n-        This means the first True will cause the scope to return True\n-        \"\"\"\n-        for item in items:\n-            if isinstance(item, dict):\n-                # Recursive\n-                if item['type'] == DataList.where_operator.AND:\n-                    result = self._exec_and(instance, item['items'])\n-                else:\n-                    result = self._exec_or(instance, item['items'])\n-                if result is True:\n-                    return True\n+                if item['type'] not in [DataList.where_operator.AND, DataList.where_operator.OR]:\n+                    raise NotImplementedError('Invalid where operator specified')","path":"ovs/dal/datalist.py","position":130,"original_position":130,"commit_id":"20d5baec95daad27893b1e5251679c839f0a569f","original_commit_id":"20d5baec95daad27893b1e5251679c839f0a569f","user":{"login":"khenderick","id":1453214,"avatar_url":"https://avatars.githubusercontent.com/u/1453214?v=3","gravatar_id":"","url":"https://api.github.com/users/khenderick","html_url":"https://github.com/khenderick","followers_url":"https://api.github.com/users/khenderick/followers","following_url":"https://api.github.com/users/khenderick/following{/other_user}","gists_url":"https://api.github.com/users/khenderick/gists{/gist_id}","starred_url":"https://api.github.com/users/khenderick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khenderick/subscriptions","organizations_url":"https://api.github.com/users/khenderick/orgs","repos_url":"https://api.github.com/users/khenderick/repos","events_url":"https://api.github.com/users/khenderick/events{/privacy}","received_events_url":"https://api.github.com/users/khenderick/received_events","type":"User","site_admin":false},"body":"Check could be at the start of the ```_filter```","created_at":"2016-03-18T09:44:06Z","updated_at":"2016-03-18T09:44:06Z","html_url":"https://github.com/openvstorage/framework/pull/468#discussion_r56632267","pull_request_url":"https://api.github.com/repos/openvstorage/framework/pulls/468","_links":{"self":{"href":"https://api.github.com/repos/openvstorage/framework/pulls/comments/56632267"},"html":{"href":"https://github.com/openvstorage/framework/pull/468#discussion_r56632267"},"pull_request":{"href":"https://api.github.com/repos/openvstorage/framework/pulls/468"}}},"pull_request":{"url":"https://api.github.com/repos/openvstorage/framework/pulls/468","id":62540347,"html_url":"https://github.com/openvstorage/framework/pull/468","diff_url":"https://github.com/openvstorage/framework/pull/468.diff","patch_url":"https://github.com/openvstorage/framework/pull/468.patch","issue_url":"https://api.github.com/repos/openvstorage/framework/issues/468","number":468,"state":"open","locked":false,"title":"OVS-4331 - Speedup DAL","user":{"login":"khenderick","id":1453214,"avatar_url":"https://avatars.githubusercontent.com/u/1453214?v=3","gravatar_id":"","url":"https://api.github.com/users/khenderick","html_url":"https://github.com/khenderick","followers_url":"https://api.github.com/users/khenderick/followers","following_url":"https://api.github.com/users/khenderick/following{/other_user}","gists_url":"https://api.github.com/users/khenderick/gists{/gist_id}","starred_url":"https://api.github.com/users/khenderick/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/khenderick/subscriptions","organizations_url":"https://api.github.com/users/khenderick/orgs","repos_url":"https://api.github.com/users/khenderick/repos","events_url":"https://api.github.com/users/khenderick/events{/privacy}","received_events_url":"https://api.github.com/users/khenderick/received_events","type":"User","site_admin":false},"body":"Work in progress","created_at":"2016-03-11T13:05:31Z","updated_at":"2016-03-18T09:44:06Z","closed_at":null,"merged_at":null,"merge_commit_sha":"7d8a58a473c8f10fc7f981402eccb7bd7e770cb8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/openvstorage/framework/pulls/468/commits","review_comments_url":"https://api.github.com/repos/openvstorage/framework/pulls/468/comments","review_comment_url":"https://api.github.com/repos/openvstorage/framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/openvstorage/framework/issues/468/comments","statuses_url":"https://api.github.com/repos/openvstorage/framework/statuses/20d5baec95daad27893b1e5251679c839f0a569f","head":{"label":"openvstorage:ovs-4331-speedup-dal","ref":"ovs-4331-speedup-dal","sha":"20d5baec95daad27893b1e5251679c839f0a569f","user":{"login":"openvstorage","id":12763393,"avatar_url":"https://avatars.githubusercontent.com/u/12763393?v=3","gravatar_id":"","url":"https://api.github.com/users/openvstorage","html_url":"https://github.com/openvstorage","followers_url":"https://api.github.com/users/openvstorage/followers","following_url":"https://api.github.com/users/openvstorage/following{/other_user}","gists_url":"https://api.github.com/users/openvstorage/gists{/gist_id}","starred_url":"https://api.github.com/users/openvstorage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openvstorage/subscriptions","organizations_url":"https://api.github.com/users/openvstorage/orgs","repos_url":"https://api.github.com/users/openvstorage/repos","events_url":"https://api.github.com/users/openvstorage/events{/privacy}","received_events_url":"https://api.github.com/users/openvstorage/received_events","type":"Organization","site_admin":false},"repo":{"id":39504796,"name":"framework","full_name":"openvstorage/framework","owner":{"login":"openvstorage","id":12763393,"avatar_url":"https://avatars.githubusercontent.com/u/12763393?v=3","gravatar_id":"","url":"https://api.github.com/users/openvstorage","html_url":"https://github.com/openvstorage","followers_url":"https://api.github.com/users/openvstorage/followers","following_url":"https://api.github.com/users/openvstorage/following{/other_user}","gists_url":"https://api.github.com/users/openvstorage/gists{/gist_id}","starred_url":"https://api.github.com/users/openvstorage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openvstorage/subscriptions","organizations_url":"https://api.github.com/users/openvstorage/orgs","repos_url":"https://api.github.com/users/openvstorage/repos","events_url":"https://api.github.com/users/openvstorage/events{/privacy}","received_events_url":"https://api.github.com/users/openvstorage/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openvstorage/framework","description":"Open vStorage. An open-source, scale-out, reliable, high performance, software based storage platform","fork":false,"url":"https://api.github.com/repos/openvstorage/framework","forks_url":"https://api.github.com/repos/openvstorage/framework/forks","keys_url":"https://api.github.com/repos/openvstorage/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openvstorage/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openvstorage/framework/teams","hooks_url":"https://api.github.com/repos/openvstorage/framework/hooks","issue_events_url":"https://api.github.com/repos/openvstorage/framework/issues/events{/number}","events_url":"https://api.github.com/repos/openvstorage/framework/events","assignees_url":"https://api.github.com/repos/openvstorage/framework/assignees{/user}","branches_url":"https://api.github.com/repos/openvstorage/framework/branches{/branch}","tags_url":"https://api.github.com/repos/openvstorage/framework/tags","blobs_url":"https://api.github.com/repos/openvstorage/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openvstorage/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openvstorage/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/openvstorage/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openvstorage/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/openvstorage/framework/languages","stargazers_url":"https://api.github.com/repos/openvstorage/framework/stargazers","contributors_url":"https://api.github.com/repos/openvstorage/framework/contributors","subscribers_url":"https://api.github.com/repos/openvstorage/framework/subscribers","subscription_url":"https://api.github.com/repos/openvstorage/framework/subscription","commits_url":"https://api.github.com/repos/openvstorage/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/openvstorage/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/openvstorage/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/openvstorage/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/openvstorage/framework/contents/{+path}","compare_url":"https://api.github.com/repos/openvstorage/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openvstorage/framework/merges","archive_url":"https://api.github.com/repos/openvstorage/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openvstorage/framework/downloads","issues_url":"https://api.github.com/repos/openvstorage/framework/issues{/number}","pulls_url":"https://api.github.com/repos/openvstorage/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/openvstorage/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/openvstorage/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openvstorage/framework/labels{/name}","releases_url":"https://api.github.com/repos/openvstorage/framework/releases{/id}","deployments_url":"https://api.github.com/repos/openvstorage/framework/deployments","created_at":"2015-07-22T12:29:15Z","updated_at":"2016-03-09T08:41:51Z","pushed_at":"2016-03-18T09:04:22Z","git_url":"git://github.com/openvstorage/framework.git","ssh_url":"git@github.com:openvstorage/framework.git","clone_url":"https://github.com/openvstorage/framework.git","svn_url":"https://github.com/openvstorage/framework","homepage":"http://www.openvstorage.com","size":9424,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":22,"forks":17,"open_issues":22,"watchers":12,"default_branch":"master"}},"base":{"label":"openvstorage:master","ref":"master","sha":"94296ec4e258e42575f18242aed7bd0143416f8b","user":{"login":"openvstorage","id":12763393,"avatar_url":"https://avatars.githubusercontent.com/u/12763393?v=3","gravatar_id":"","url":"https://api.github.com/users/openvstorage","html_url":"https://github.com/openvstorage","followers_url":"https://api.github.com/users/openvstorage/followers","following_url":"https://api.github.com/users/openvstorage/following{/other_user}","gists_url":"https://api.github.com/users/openvstorage/gists{/gist_id}","starred_url":"https://api.github.com/users/openvstorage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openvstorage/subscriptions","organizations_url":"https://api.github.com/users/openvstorage/orgs","repos_url":"https://api.github.com/users/openvstorage/repos","events_url":"https://api.github.com/users/openvstorage/events{/privacy}","received_events_url":"https://api.github.com/users/openvstorage/received_events","type":"Organization","site_admin":false},"repo":{"id":39504796,"name":"framework","full_name":"openvstorage/framework","owner":{"login":"openvstorage","id":12763393,"avatar_url":"https://avatars.githubusercontent.com/u/12763393?v=3","gravatar_id":"","url":"https://api.github.com/users/openvstorage","html_url":"https://github.com/openvstorage","followers_url":"https://api.github.com/users/openvstorage/followers","following_url":"https://api.github.com/users/openvstorage/following{/other_user}","gists_url":"https://api.github.com/users/openvstorage/gists{/gist_id}","starred_url":"https://api.github.com/users/openvstorage/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openvstorage/subscriptions","organizations_url":"https://api.github.com/users/openvstorage/orgs","repos_url":"https://api.github.com/users/openvstorage/repos","events_url":"https://api.github.com/users/openvstorage/events{/privacy}","received_events_url":"https://api.github.com/users/openvstorage/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openvstorage/framework","description":"Open vStorage. An open-source, scale-out, reliable, high performance, software based storage platform","fork":false,"url":"https://api.github.com/repos/openvstorage/framework","forks_url":"https://api.github.com/repos/openvstorage/framework/forks","keys_url":"https://api.github.com/repos/openvstorage/framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openvstorage/framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openvstorage/framework/teams","hooks_url":"https://api.github.com/repos/openvstorage/framework/hooks","issue_events_url":"https://api.github.com/repos/openvstorage/framework/issues/events{/number}","events_url":"https://api.github.com/repos/openvstorage/framework/events","assignees_url":"https://api.github.com/repos/openvstorage/framework/assignees{/user}","branches_url":"https://api.github.com/repos/openvstorage/framework/branches{/branch}","tags_url":"https://api.github.com/repos/openvstorage/framework/tags","blobs_url":"https://api.github.com/repos/openvstorage/framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openvstorage/framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openvstorage/framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/openvstorage/framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openvstorage/framework/statuses/{sha}","languages_url":"https://api.github.com/repos/openvstorage/framework/languages","stargazers_url":"https://api.github.com/repos/openvstorage/framework/stargazers","contributors_url":"https://api.github.com/repos/openvstorage/framework/contributors","subscribers_url":"https://api.github.com/repos/openvstorage/framework/subscribers","subscription_url":"https://api.github.com/repos/openvstorage/framework/subscription","commits_url":"https://api.github.com/repos/openvstorage/framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/openvstorage/framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/openvstorage/framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/openvstorage/framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/openvstorage/framework/contents/{+path}","compare_url":"https://api.github.com/repos/openvstorage/framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openvstorage/framework/merges","archive_url":"https://api.github.com/repos/openvstorage/framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openvstorage/framework/downloads","issues_url":"https://api.github.com/repos/openvstorage/framework/issues{/number}","pulls_url":"https://api.github.com/repos/openvstorage/framework/pulls{/number}","milestones_url":"https://api.github.com/repos/openvstorage/framework/milestones{/number}","notifications_url":"https://api.github.com/repos/openvstorage/framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openvstorage/framework/labels{/name}","releases_url":"https://api.github.com/repos/openvstorage/framework/releases{/id}","deployments_url":"https://api.github.com/repos/openvstorage/framework/deployments","created_at":"2015-07-22T12:29:15Z","updated_at":"2016-03-09T08:41:51Z","pushed_at":"2016-03-18T09:04:22Z","git_url":"git://github.com/openvstorage/framework.git","ssh_url":"git@github.com:openvstorage/framework.git","clone_url":"https://github.com/openvstorage/framework.git","svn_url":"https://github.com/openvstorage/framework","homepage":"http://www.openvstorage.com","size":9424,"stargazers_count":12,"watchers_count":12,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":22,"forks":17,"open_issues":22,"watchers":12,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openvstorage/framework/pulls/468"},"html":{"href":"https://github.com/openvstorage/framework/pull/468"},"issue":{"href":"https://api.github.com/repos/openvstorage/framework/issues/468"},"comments":{"href":"https://api.github.com/repos/openvstorage/framework/issues/468/comments"},"review_comments":{"href":"https://api.github.com/repos/openvstorage/framework/pulls/468/comments"},"review_comment":{"href":"https://api.github.com/repos/openvstorage/framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/openvstorage/framework/pulls/468/commits"},"statuses":{"href":"https://api.github.com/repos/openvstorage/framework/statuses/20d5baec95daad27893b1e5251679c839f0a569f"}}}}