Yaning, How about going on with this simple API change, as previously proposed by Stefan? I thought it can server well the same purpose for cursor.
List<String> getIdentities(int start, int limit) => Iterator<String> getIdentities() Regards, Kai -----Original Message----- From: Zheng, Kai [mailto:[email protected]] Sent: Monday, July 06, 2015 7:27 AM To: [email protected] Subject: RE: How to implement getIdentities(int start, int limit) more effectively >> The client should *always* get the result sorted. That means teh default >> cursor implem should sort the result. OK, I see what you meant. One original problem we were hard at is still there, for some backend lacking support of paged retrieving, we still have to get all the results and then perform the desired/spec-ed sorting. >> No, not at all. The basic operation is just to fetch all the elements, sort >> them, and wrap a cursor around it. Hmm, yes it's easy for you, I meant it's not easy for me. We're not implementing a storage like Mavibot, so I'm thinking something different, maybe more lightweight. Maybe Iteration could be more suitable? Anyway, let we drill down to the real work, look at the existing sample codes, and see how soon we could be out. >> Ok, at this point, I would say it's your call. I just expressed my opinion, >> but I don't want to twist your arm, ... I don't have any call yet, and just want to speed up the first release, as you see, quite some time passed from our initial collaboration discussed plan more than half a year ago... I also see your opinion, thanks! So to summarize, let's attempt to get the API defined right in the initial release. Cursor or Iterator ... Regards, Kai -----Original Message----- From: Emmanuel Lécharny [mailto:[email protected]] Sent: Sunday, July 05, 2015 4:23 PM To: [email protected] Subject: Re: How to implement getIdentities(int start, int limit) more effectively Le 05/07/15 01:47, Zheng, Kai a écrit : >>> I do think that the cursor implementation should be responsible for the >>> sorting of data, same thing for the paged search (or to implement it if the >>> backend does not). > Again, the problem is, if no consistent behavior among the backends, how > client would benefit? For example, some backend sort the results, but others > don't, then how client know that, regarding the results sorted or not? The client should *always* get the result sorted. That means teh default cursor implem should sort the result. > >>> Here is what I suggest : get the cursor used, no matter what ... > I'm afraid it's not easy to have a good, well discussed cursor or iterator > interface design as you might think. Going this way would need much longer > time. No, not at all. The basic operation is just to fetch all the elements, sort them, and wrap a cursor around it. There is plenty of existing samples in ApacheDS you can copy. I evaluate the work to around half a day, one day with tests. > The most simple ==List<String> getIdentities()== would be good enough for the > initial version, since it's only for internal use and we won't be so lucky to > hit huge amounts of principals to store in the backend so soon ..., we can > release often after the initial one, right? Right, but don't miss an oportunity to at least define teh API rigth from day one, even if the underlaying implementation sucks. Ok, at this point, I would say it's your call. I just expressed my opinion, but I don't want to twist your arm, as the getIdentities() method is implemented in many classes. There is not only one way to catch a bird :-) Thanks Kai !
