You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by rnewson <gi...@git.apache.org> on 2015/09/11 18:25:36 UTC

[GitHub] couchdb-couch pull request: Allow filtering of active tasks by pro...

GitHub user rnewson opened a pull request:

    https://github.com/apache/couchdb-couch/pull/99

    Allow filtering of active tasks by property

    COUCHDB-2807

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/cloudant/couchdb-couch 2807-filtered-tasks

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/couchdb-couch/pull/99.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #99
    
----
commit e50f1cf9848bc5545852fbc1552b29a83041496a
Author: Robert Newson <rn...@apache.org>
Date:   2015-09-11T16:22:01Z

    Allow filtering of active tasks by property
    
    COUCHDB-2807

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Allow filtering of active tasks by pro...

Posted by kxepal <gi...@git.apache.org>.
Github user kxepal commented on the pull request:

    https://github.com/apache/couchdb-couch/pull/99#issuecomment-139792259
  
    I do like idea, just didn't test yet. Btw, how it will correlate with [COUCHDB-2405](https://issues.apache.org/jira/browse/COUCHDB-2405)?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Allow filtering of active tasks by pro...

Posted by rnewson <gi...@git.apache.org>.
Github user rnewson commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/99#discussion_r39290001
  
    --- Diff: src/couch_task_status.erl ---
    @@ -130,6 +143,12 @@ handle_call(all, _, Server) ->
         ],
         {reply, All, Server}.
     
    +filter_task(Key, Value, TaskProps) ->
    --- End diff --
    
    not a huge fan of this function but I don't see much option


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Allow filtering of active tasks by pro...

Posted by rnewson <gi...@git.apache.org>.
Github user rnewson commented on the pull request:

    https://github.com/apache/couchdb-couch/pull/99#issuecomment-139792092
  
    hm, do we like this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Allow filtering of active tasks by pro...

Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/99#discussion_r39289982
  
    --- Diff: src/couch_task_status.erl ---
    @@ -122,6 +127,14 @@ handle_call({add_task, TaskProps}, {From, _}, Server) ->
         [_] ->
             {reply, {add_task_error, already_registered}, Server}
         end;
    +handle_call({filter, Key, Value}, _, Server) ->
    +    All = [
    --- End diff --
    
    Use following to avoid doing the same thing in a tight loop
    ```
    handle_call({filter, Key0, Value0}, _, Server) ->
    Key = couch_util:to_list(Key0),
    Value = couch_util:to_list(Value0),
    ```


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] couchdb-couch pull request: Allow filtering of active tasks by pro...

Posted by iilyak <gi...@git.apache.org>.
Github user iilyak commented on a diff in the pull request:

    https://github.com/apache/couchdb-couch/pull/99#discussion_r39290733
  
    --- Diff: src/couch_task_status.erl ---
    @@ -122,6 +127,14 @@ handle_call({add_task, TaskProps}, {From, _}, Server) ->
         [_] ->
             {reply, {add_task_error, already_registered}, Server}
         end;
    +handle_call({filter, Key, Value}, _, Server) ->
    +    All = [
    +        [{pid, ?l2b(pid_to_list(Pid))} | TaskProps]
    +        ||
    +        {Pid, TaskProps} <- ets:tab2list(?MODULE),
    --- End diff --
    
    Would it be possible to use `ets:foldl(Function, [], ?MODULE)` here?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---