Package org.apache.solr.common
Class SimpleZkMap
- java.lang.Object
-
- org.apache.solr.common.SimpleZkMap
-
- All Implemented Interfaces:
SimpleMap<Resource>,MapSerializable,MapWriter,NavigableObject
public class SimpleZkMap extends Object implements SimpleMap<Resource>
A view of ZK as aSimpleMapimpl. This gives a flat view of all paths instead of a tree view eg: a, b, c , a/a1, a/a2, a/a1/aa1 etc If possible, use theabortableForEach(BiFunction)to traverse DO not use thesize()method. It always return 0 because it is very expensive to compute that
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.common.MapWriter
MapWriter.EntryWriter
-
-
Constructor Summary
Constructors Constructor Description SimpleZkMap(ZkStateReader zkStateReader, String path)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidabortableForEach(BiFunction<String,? super Resource,Boolean> fun)Navigate through all key-values but abort in between if required.voidforEachEntry(BiConsumer<String,? super Resource> fun)Navigate through all keys and valuesResourceget(String key)get a value by key.intsize()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.common.NavigableObject
_forEachEntry, _forEachEntry, _forEachEntry, _get, _get, _getStr, _getStr, _size
-
Methods inherited from interface org.apache.solr.cluster.api.SimpleMap
abortableForEachKey, asMap, asMap, forEachKey, get, writeMap
-
-
-
-
Constructor Detail
-
SimpleZkMap
public SimpleZkMap(ZkStateReader zkStateReader, String path)
-
-
Method Detail
-
get
public Resource get(String key)
Description copied from interface:SimpleMapget a value by key. If not present , null is returned
-
abortableForEach
public void abortableForEach(BiFunction<String,? super Resource,Boolean> fun)
Description copied from interface:SimpleMapNavigate through all key-values but abort in between if required. The default impl is suboptimal. Proper implementations must do it more efficiently- Specified by:
abortableForEachin interfaceSimpleMap<Resource>- Parameters:
fun- Consume each entry and return a boolean to signal whether to proceed or not. If true, continue, if false stop
-
forEachEntry
public void forEachEntry(BiConsumer<String,? super Resource> fun)
Description copied from interface:SimpleMapNavigate through all keys and values- Specified by:
forEachEntryin interfaceSimpleMap<Resource>
-
-