[Date Prev][Date Next]
simple paged results control
I was trying to look into 'simple paged results control' support
in OpenLDAP. I give some of my observation regarding its implementation
and would like some comments/suggestions/answers to some doubts.
The OpenLDAP client may be presented with many
such paged search requests from various applications simultaneously. So
what I felt logical was that the application first places the search
request to the client (specifying that it needs, say 10, results at a
time). So everytime the client gets the results back from the server, it
also returns the cookie to the application; thus the application when
wants to get the next set, presents the requests along with the cookie.
However, if we can somehow set some expiry time on subsequent requests,
the application can only present the cookie; the client remembers the
search parameters for all the cookies, so it gets the search parameters
for the presented cookie and thus fetch the next set.
OpenLDAP supports various backend storage mechanisms. Going through the
present source code, I find that the slapd during initialization, also
initializes the Backend (which can be of type, as presently, ldbm, shell,
sql, dnsserver, passwd etc...: I however donot understand what is the
ldap backend-type given in back-ldap directory). Then during searching it
just calls (*be->be_search) which is a call to the approppriate search
call for the Backend.
Now there are primarily two naive ways of implementing the paged search in
1) the server searches the full set everytime and then extracts the
results for the given rangs and returns them.
2) the server searches the full set once and keeps the entire result in
its memory; on requests from the client it just extacts the results of the
required range and sends them back.
Now, both of them have high overhead. So, the better way is to
implement some kind of range searches on the Backend's themselves. So each
Backend has to support some kind of range search as well.
e.g. for the back-pass, to get the search results, getpwent() is
called for a specific node (the number of successful results are compared
each time with the specified number of results wanted). So to implement
paged search, say for result #6-10, we may have to skip the first 5
successful results and then get the next five result.
Expecting some comments on these observations.