jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Marcel Reutegger <mreut...@adobe.com>
Subject RE: [jr3] Tree model
Date Mon, 05 Mar 2012 13:06:22 GMT
> >> int getChildNodeCount();
> >
> >this doesn't work well when you have concurrent child node
> >operations.
> 
> I would expect the data doesn't change on the fly; I think it would work
> well for an immutable node. For a mutable node, I wouldn't worry about
> concurrency too much (concurrent changes within the same session).

I'm not thinking of concurrent changes using the same session. the
use case I have in mind is a node with lots of child nodes where
changes from multiple sessions are frequent. it is rather simple to
distribute the changes over multiple machines, unless you have
to maintain a shared datastructure like the number of child nodes.

> >why do we have the method anyway?
> 
> I guess so you don't have to iterate over the whole list if you are only
> interested in the count.

to be interested in something is not a valid use case ;)

the only use case that comes to my mind is RangeIterator.getSize()
in the JCR API. but even then you cannot just return the raw
number of child nodes because you'd have to perform access
control checks first, right?

> >> Iterable<ChildNodeEntry> getChildNodeEntries(int offset, int length);
> >
> >doesn't this imply that the implementation will keep the child
> >nodes in a list?
> 
> Not necessarily. I think "offset" is OK (except it should be a long).
> 
> >how about:
> >Iterable<ChildNodeEntry> getChildNodeEntries(ChildNodeEntry start, int
> >length);
> 
> That would imply you have called getChildNodeEntries first, and have
> iterated over the entries. In which case you already have an iterator.

right, but the iterator will end after length iterations. so, you have to 
call getChildNodeEntries() again.

> >or
> >Iterable<ChildNodeEntry> getChildNodeEntries(String
> childNodeNameStart,
> >int length);
> 
> The offset better matches the MicroKernel API (that also uses the offset).
> If the MicroKernel API uses an offset, how would you know the name.

well, I guess then my statement about assumptions on implementation details
also applies to the MK API ;)

regards
 marcel

Mime
View raw message