public class IndexReader extends Object implements Iterable<ChunkReader>, Closeable
ChunkReader
s, to
read all the required records.Constructor and Description |
---|
IndexReader(WritableResourceHandler local,
ResourceHandler remote) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying
ResourceHandler s. |
List<String> |
getChunkNames()
Returns unmodifiable list of actual chunks that needs to be pulled from remote
ResourceHandler . |
String |
getIndexId()
Returns the index context ID that published index has set.
|
Date |
getPublishedTimestamp()
Returns the
Date when remote index was last published. |
boolean |
isIncremental()
Returns
true if incremental update is about to happen. |
Iterator<ChunkReader> |
iterator()
Returns an
Iterator of ChunkReader s, that if read in sequence, provide all the (incremental)
updates from the index. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public IndexReader(WritableResourceHandler local, ResourceHandler remote) throws IOException
IOException
public String getIndexId()
Record.Type.DESCRIPTOR
but does not have to be.public Date getPublishedTimestamp()
Date
when remote index was last published.public boolean isIncremental()
true
if incremental update is about to happen. If incremental update, the iterator()
will return only the diff from the last update.public List<String> getChunkNames()
ResourceHandler
. Those are
incremental chunks or the big main file, depending on result of isIncremental()
. Empty list means local
index is up to date, and iterator()
will return empty iterator.public void close() throws IOException
ResourceHandler
s. In case of incremental update use, it also assumes that user
consumed all the iterator and integrated it, hence, it will update the WritableResourceHandler
contents
to prepare it for future incremental update. If this is not desired (ie. due to aborted update), then this
method should NOT be invoked, but rather the ResourceHandler
s that caller provided in constructor of
this class should be closed manually.close
in interface Closeable
close
in interface AutoCloseable
IOException
public Iterator<ChunkReader> iterator()
Iterator
of ChunkReader
s, that if read in sequence, provide all the (incremental)
updates from the index. It is caller responsibility to either consume fully this iterator, or to close current
ChunkReader
if aborting.iterator
in interface Iterable<ChunkReader>
Copyright © 2002–2017 The Apache Software Foundation. All rights reserved.