directory-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel L├ęcharny <>
Subject [Mavibot] cursor API
Date Fri, 15 Nov 2013 11:21:25 GMT
Hi guys,

currently, we have a cursor API which is used to brows a BTree. It's
pretty much mapped on what we have in ApacheDS. Now, there are a few
thing that can be improved :

1) first, the cursor is a *value* cursor. As we support multiple values
for a given key, that means we will return Tuple<K, V> where the key
will be the same. That's ok, but we also need a way to browse keys.

What we have is a way to create a new cursor starting at a specific key
: Btree.browseFrom(K). It returns a new cursor, in which you can fetch
the next key by doing a mobeToNextNoDuplicateKey() (or moveToPrev...)

We would like to do that on an existing cursor, instead of creating a
new cursor. We also would like to have a consistent way to access data.
In the current API, if you want to get the key which is after a given
key, here is what you need to do :

Cursor cursor = btree.browseFrom( K1 );
Tuple tuple =;

This is quite overkilling. A probably better idea would be to add two
methods in the BTree and Cursor interfaces :

BTree.browseAfter( K ) : position the cursor after a given key
cusor.nextKey()/prevKey() : move to the next/prev key. We will always
point to teh first value of the found key.

That would make it easier for implementers to use te cursor lib...

Thoughs ?

Emmanuel L├ęcharny 

View raw message