use of org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry in project jackrabbit-oak by apache.
the class ChildNodeStateProvider method children.
Iterator<NodeStateEntry> children(boolean preferred) {
PeekingIterator<NodeStateEntry> pitr = Iterators.peekingIterator(entries.iterator());
if (!pitr.hasNext()) {
return emptyIterator();
}
// Skip till current entry
while (pitr.hasNext() && !pitr.peek().getPath().equals(path)) {
pitr.next();
}
// Skip past the current find
checkState(pitr.hasNext() && path.equals(pitr.next().getPath()), "Did not found path [%s] in leftover iterator. Possibly node state accessed " + "after main iterator has moved past it", path);
// Prepare an iterator to fetch all child node paths i.e. immediate and there children
return new AbstractIterator<NodeStateEntry>() {
@Override
protected NodeStateEntry computeNext() {
while (pitr.hasNext() && isAncestor(path, pitr.peek().getPath())) {
NodeStateEntry nextEntry = pitr.next();
String nextEntryPath = nextEntry.getPath();
if (isImmediateChild(nextEntryPath)) {
String nextEntryName = PathUtils.getName(nextEntryPath);
if (preferred && !preferredPathElements.contains(nextEntryName)) {
return endOfData();
}
return nextEntry;
}
}
return endOfData();
}
};
}
use of org.apache.jackrabbit.oak.index.indexer.document.NodeStateEntry in project jackrabbit-oak by apache.
the class FlatFileBufferLinkedList method remove.
/**
* Remove the first item from the list
* @return {@code NodeStateEntry} data in the removed item
*/
public NodeStateEntry remove() {
Preconditions.checkState(!isEmpty(), "Cannot remove item from empty list");
NodeStateEntry ret = head.next.data;
head.next.isValid = false;
head.next = head.next.next;
size--;
memUsage -= ret.estimatedMemUsage();
if (size == 0) {
tail = head;
}
return ret;
}
Aggregations