public class IndexWriter extends Object implements Closeable
Constructor and Description |
---|
IndexWriter(WritableResourceHandler local,
String indexId,
boolean incrementalSupported) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the underlying
ResourceHandler and synchronizes published index properties, so remote clients
becomes able to consume newly published index. |
String |
getChainId()
Returns the chain id of published index.
|
String |
getIndexId()
Returns the index context ID that published index has set.
|
String |
getNextChunkName()
Returns the next chunk name about to be published.
|
Date |
getPublishedTimestamp()
Returns the
Date when index was last published or null if this is first publishing. |
boolean |
isIncremental()
Returns
true if incremental publish is about to happen. |
int |
writeChunk(Iterator<Map<String,String>> iterator)
Writes out the record iterator and returns the written record count.
|
public IndexWriter(WritableResourceHandler local, String indexId, boolean incrementalSupported) throws IOException
IOException
public String getIndexId()
public Date getPublishedTimestamp()
Date
when index was last published or null
if this is first publishing. In other
words,returns null
when isIncremental()
returns false
. After this writer is closed, the
return value is updated to "now" (in method
.public boolean isIncremental()
true
if incremental publish is about to happen.public String getChainId()
isIncremental()
is false
, this is the newly
generated chain ID.public String getNextChunkName()
public int writeChunk(Iterator<Map<String,String>> iterator) throws IOException
IOException
public void close() throws IOException
ResourceHandler
and synchronizes published index properties, so remote clients
becomes able to consume newly published index. If sync is not desired (ie. due to aborted publish), then this
method should NOT be invoked, but rather the ResourceHandler
that caller provided in constructor of
this class should be closed manually.close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2002–2022 The Apache Software Foundation. All rights reserved.