public class ReloadableSparkeyReader extends Object implements SparkeyReader
Modifier and Type | Class and Description |
---|---|
static class |
ReloadableSparkeyReader.ReloadableSparkeyReaderException |
SparkeyReader.Entry, SparkeyReader.Type
Modifier and Type | Method and Description |
---|---|
void |
close() |
SparkeyReader |
duplicate()
Create a duplicate of the reader.
|
static com.google.common.util.concurrent.ListenableFuture<ReloadableSparkeyReader> |
fromLogFile(File logFile,
com.google.common.util.concurrent.ListeningExecutorService executorService)
Creates a new reloadable sparkey reader from a log file.
|
byte[] |
getAsByteArray(byte[] key) |
SparkeyReader.Entry |
getAsEntry(byte[] key)
This is mostly useful for retrieving large values that don't fit in a byte array.
|
String |
getAsString(String key) |
IndexHeader |
getIndexHeader() |
LogHeader |
getLogHeader() |
Iterator<SparkeyReader.Entry> |
iterator()
Get an iterator over all the live entries.
|
com.google.common.util.concurrent.ListenableFuture<ReloadableSparkeyReader> |
load(File logFile) |
public static com.google.common.util.concurrent.ListenableFuture<ReloadableSparkeyReader> fromLogFile(File logFile, com.google.common.util.concurrent.ListeningExecutorService executorService)
logFile
- The log file to start with.executorService
- An executor service that is used to run reload tasks on.public com.google.common.util.concurrent.ListenableFuture<ReloadableSparkeyReader> load(File logFile)
public String getAsString(String key) throws IOException
getAsString
in interface SparkeyReader
key
- the key to search for, interpreted as an UTF-8 string.IOException
public byte[] getAsByteArray(byte[] key) throws IOException
getAsByteArray
in interface SparkeyReader
key
- the key to search forIOException
public SparkeyReader.Entry getAsEntry(byte[] key) throws IOException
SparkeyReader
getAsEntry
in interface SparkeyReader
key
- the key to search forIOException
public void close() throws IOException
close
in interface SparkeyReader
IOException
public IndexHeader getIndexHeader()
getIndexHeader
in interface SparkeyReader
public LogHeader getLogHeader()
getLogHeader
in interface SparkeyReader
public SparkeyReader duplicate()
SparkeyReader
duplicate
in interface SparkeyReader
public Iterator<SparkeyReader.Entry> iterator()
SparkeyReader
iterator
in interface SparkeyReader
iterator
in interface Iterable<SparkeyReader.Entry>
Copyright © 2013. All rights reserved.