You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@directory.apache.org by "Emmanuel Lecharny (JIRA)" <ji...@apache.org> on 2008/12/14 14:46:44 UTC

[jira] Created: (DIRSERVER-1294) Add size() and hasNext() methods to cursors

Add size() and hasNext() methods to cursors
-------------------------------------------

                 Key: DIRSERVER-1294
                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1294
             Project: Directory ApacheDS
          Issue Type: Improvement
    Affects Versions: 1.5.4
            Reporter: Emmanuel Lecharny
            Priority: Minor
             Fix For: 1.5.6


The cursor implementation currently does not have the size() and hasNext() methods. They would be very helpful in ma,ny places.

For instance, the paged search control requires that the response control contains the expected size. The hasNext() method could help to avoid a next() and previous() calls to check if we have one more entry available in the cursor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1294) Add size() and hasNext() methods to cursors

Posted by "Felix Knecht (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12926587#action_12926587 ] 

Felix Knecht commented on DIRSERVER-1294:
-----------------------------------------

How to handle lazy pre-fetching cursors? size() will not work using lazy pre-fetching -> UnsupportedOperationsException?


> Add size() and hasNext() methods to cursors
> -------------------------------------------
>
>                 Key: DIRSERVER-1294
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1294
>             Project: Directory ApacheDS
>          Issue Type: Improvement
>    Affects Versions: 1.5.4
>            Reporter: Emmanuel Lecharny
>            Assignee: Felix Knecht
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> The cursor implementation currently does not have the size() and hasNext() methods. They would be very helpful in ma,ny places.
> For instance, the paged search control requires that the response control contains the expected size. The hasNext() method could help to avoid a next() and previous() calls to check if we have one more entry available in the cursor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1294) Add size() and hasNext() methods to cursors

Posted by "Kiran Ayyagari (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12926687#action_12926687 ] 

Kiran Ayyagari commented on DIRSERVER-1294:
-------------------------------------------

Getting or keeping track of count at a higher layer (other than the actual backend layer e.x jdbm, bdb je) severely slows down the performance (esp. the
 search operation's). So it is highly unlikely to have this correctly implemented as long as the underlying backend doesn't support.
(In the case of bdb je as a backend this is possible cause bdb je keeps track of the exact count of records)

And coming to hashNext(), we can emulate this to an extent (in SearchHandler, currently we call next() and if it returns true and we exceed the count limit 
then we call previous() to move back) but this won't be feasible in all Cursor implementations.

> Add size() and hasNext() methods to cursors
> -------------------------------------------
>
>                 Key: DIRSERVER-1294
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1294
>             Project: Directory ApacheDS
>          Issue Type: Improvement
>    Affects Versions: 1.5.4
>            Reporter: Emmanuel Lecharny
>            Assignee: Felix Knecht
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>         Attachments: size_has.patch
>
>
> The cursor implementation currently does not have the size() and hasNext() methods. They would be very helpful in ma,ny places.
> For instance, the paged search control requires that the response control contains the expected size. The hasNext() method could help to avoid a next() and previous() calls to check if we have one more entry available in the cursor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1294) Add size() and hasNext() methods to cursors

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12926621#action_12926621 ] 

Emmanuel Lecharny commented on DIRSERVER-1294:
----------------------------------------------

Actually, I have no idea if it's easily feasible. 

I must admit I created this issue as I know for sure that we will like to have those methods, but it obviously has some deep impact on the way we have implemented the cursors...

> Add size() and hasNext() methods to cursors
> -------------------------------------------
>
>                 Key: DIRSERVER-1294
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1294
>             Project: Directory ApacheDS
>          Issue Type: Improvement
>    Affects Versions: 1.5.4
>            Reporter: Emmanuel Lecharny
>            Assignee: Felix Knecht
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> The cursor implementation currently does not have the size() and hasNext() methods. They would be very helpful in ma,ny places.
> For instance, the paged search control requires that the response control contains the expected size. The hasNext() method could help to avoid a next() and previous() calls to check if we have one more entry available in the cursor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRSERVER-1294) Add size() and hasNext() methods to cursors

Posted by "Felix Knecht (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Knecht updated DIRSERVER-1294:
------------------------------------

    Attachment: size_has.patch

Just what I already have so far. I don't want to keep it trailing around somewhere I may not rememeber the place ...
(Code doesn't covers all Cursor implementations, there'll exist compile errors after applying the patch which needs your attention and implementation)

> Add size() and hasNext() methods to cursors
> -------------------------------------------
>
>                 Key: DIRSERVER-1294
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1294
>             Project: Directory ApacheDS
>          Issue Type: Improvement
>    Affects Versions: 1.5.4
>            Reporter: Emmanuel Lecharny
>            Assignee: Felix Knecht
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>         Attachments: size_has.patch
>
>
> The cursor implementation currently does not have the size() and hasNext() methods. They would be very helpful in ma,ny places.
> For instance, the paged search control requires that the response control contains the expected size. The hasNext() method could help to avoid a next() and previous() calls to check if we have one more entry available in the cursor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Issue Comment Edited: (DIRSERVER-1294) Add size() and hasNext() methods to cursors

Posted by "Felix Knecht (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12926587#action_12926587 ] 

Felix Knecht edited comment on DIRSERVER-1294 at 10/30/10 11:31 AM:
--------------------------------------------------------------------

How to handle lazy pre-fetching cursors (BaseEntryFilteringCursor)?
size() will not work using lazy pre-fetching -> UnsupportedOperationsException?
same for hasNext(), hasPrevious()


      was (Author: felixk):
    How to handle lazy pre-fetching cursors? size() will not work using lazy pre-fetching -> UnsupportedOperationsException?

  
> Add size() and hasNext() methods to cursors
> -------------------------------------------
>
>                 Key: DIRSERVER-1294
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1294
>             Project: Directory ApacheDS
>          Issue Type: Improvement
>    Affects Versions: 1.5.4
>            Reporter: Emmanuel Lecharny
>            Assignee: Felix Knecht
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> The cursor implementation currently does not have the size() and hasNext() methods. They would be very helpful in ma,ny places.
> For instance, the paged search control requires that the response control contains the expected size. The hasNext() method could help to avoid a next() and previous() calls to check if we have one more entry available in the cursor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DIRSERVER-1294) Add size() and hasNext() methods to cursors

Posted by "Emmanuel Lecharny (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Lecharny updated DIRSERVER-1294:
-----------------------------------------

    Fix Version/s:     (was: 1.5.6)
                   2.0.0-RC1

Moved to 2.0.0-RC1, we won't release a 1.5.6

> Add size() and hasNext() methods to cursors
> -------------------------------------------
>
>                 Key: DIRSERVER-1294
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1294
>             Project: Directory ApacheDS
>          Issue Type: Improvement
>    Affects Versions: 1.5.4
>            Reporter: Emmanuel Lecharny
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> The cursor implementation currently does not have the size() and hasNext() methods. They would be very helpful in ma,ny places.
> For instance, the paged search control requires that the response control contains the expected size. The hasNext() method could help to avoid a next() and previous() calls to check if we have one more entry available in the cursor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DIRSERVER-1294) Add size() and hasNext() methods to cursors

Posted by "Felix Knecht (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DIRSERVER-1294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12926625#action_12926625 ] 

Felix Knecht commented on DIRSERVER-1294:
-----------------------------------------

It depends on which Cursor you mainly have thought of. Following Cursors can be implemented IMO:

- EntryToResponseCursor (ApacheDS)
- CursorList (Shared)
- EmptyCursor (Shared)
- ListCursor (Shared)
- SingletonCursor (Shared)

Partially:
- SearchCursorImpl (Shared)

Not:
- BaseEntryFilteringCursor (ApacheDS)

So the question is 'What to do?'

1. Just close the issue as 'Won't fix'
2. Implement where possible and otherwise throw an UnsupportedOperationException
3. Create a 'Interface CursorPlus extends Cursor<E>' and implement this interface where the functions 'size(), hasNext(), hasPrevious()' are implementable.

I feel bad for solution 2 because it throws an Exception -> a developer has to trap in the first time before realising that it's not possible to use it...

> Add size() and hasNext() methods to cursors
> -------------------------------------------
>
>                 Key: DIRSERVER-1294
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1294
>             Project: Directory ApacheDS
>          Issue Type: Improvement
>    Affects Versions: 1.5.4
>            Reporter: Emmanuel Lecharny
>            Assignee: Felix Knecht
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> The cursor implementation currently does not have the size() and hasNext() methods. They would be very helpful in ma,ny places.
> For instance, the paged search control requires that the response control contains the expected size. The hasNext() method could help to avoid a next() and previous() calls to check if we have one more entry available in the cursor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DIRSERVER-1294) Add size() and hasNext() methods to cursors

Posted by "Felix Knecht (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DIRSERVER-1294?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Felix Knecht reassigned DIRSERVER-1294:
---------------------------------------

    Assignee: Felix Knecht

> Add size() and hasNext() methods to cursors
> -------------------------------------------
>
>                 Key: DIRSERVER-1294
>                 URL: https://issues.apache.org/jira/browse/DIRSERVER-1294
>             Project: Directory ApacheDS
>          Issue Type: Improvement
>    Affects Versions: 1.5.4
>            Reporter: Emmanuel Lecharny
>            Assignee: Felix Knecht
>            Priority: Minor
>             Fix For: 2.0.0-RC1
>
>
> The cursor implementation currently does not have the size() and hasNext() methods. They would be very helpful in ma,ny places.
> For instance, the paged search control requires that the response control contains the expected size. The hasNext() method could help to avoid a next() and previous() calls to check if we have one more entry available in the cursor.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.