public abstract class Node
extends java.lang.Object
implements java.io.Closeable
PrimaryNode
and ReplicaNode
.Modifier and Type | Field and Description |
---|---|
protected Directory |
dir |
static long |
globalStartNS
Startup time of original test, carefully propogated to all nodes to produce consistent "seconds since start time" in messages
|
protected int |
id
Compact ordinal for this node
|
protected java.util.Map<java.lang.String,FileMetaData> |
lastFileMetaData
File metadata for last sync that succeeded; we use this as a cache
|
static long |
localStartNS
When this node was started
|
protected ReferenceManager<IndexSearcher> |
mgr |
static java.lang.String |
PRIMARY_GEN_KEY
Key to store the primary gen in the commit data, which increments every time we promote a new primary, so replicas can detect when the
primary they were talking to is changed
|
protected java.io.PrintStream |
printStream
For debug logging
|
protected SearcherFactory |
searcherFactory |
static boolean |
VERBOSE_CONNECTIONS |
static boolean |
VERBOSE_FILES |
static java.lang.String |
VERSION_KEY
Key to store the version in the commit data, which increments every time we open a new NRT reader
|
Constructor and Description |
---|
Node(int id,
Directory dir,
SearcherFactory searcherFactory,
java.io.PrintStream printStream) |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
bytesToString(long bytes) |
abstract void |
commit() |
long |
getCurrentSearchingVersion() |
Directory |
getDirectory()
Returns the
Directory this node is writing to |
ReferenceManager<IndexSearcher> |
getSearcherManager()
Returns the
ReferenceManager to use for acquiring and releasing searchers |
abstract boolean |
isClosed() |
void |
message(java.lang.String message) |
java.lang.String |
name() |
static void |
nodeMessage(java.io.PrintStream printStream,
int id,
java.lang.String message) |
static void |
nodeMessage(java.io.PrintStream printStream,
java.lang.String message) |
FileMetaData |
readLocalFileMetaData(java.lang.String fileName)
Opens the specified file, reads its identifying information, including file length, full index header (includes the unique segment
ID) and the full footer (includes checksum), and returns the resulting
FileMetaData . |
java.lang.String |
toString() |
public static boolean VERBOSE_FILES
public static boolean VERBOSE_CONNECTIONS
public static java.lang.String PRIMARY_GEN_KEY
public static java.lang.String VERSION_KEY
protected final int id
protected final Directory dir
protected final SearcherFactory searcherFactory
protected ReferenceManager<IndexSearcher> mgr
public static long globalStartNS
public static final long localStartNS
protected final java.io.PrintStream printStream
protected volatile java.util.Map<java.lang.String,FileMetaData> lastFileMetaData
public Node(int id, Directory dir, SearcherFactory searcherFactory, java.io.PrintStream printStream)
public ReferenceManager<IndexSearcher> getSearcherManager()
ReferenceManager
to use for acquiring and releasing searcherspublic java.lang.String toString()
toString
in class java.lang.Object
public abstract void commit() throws java.io.IOException
java.io.IOException
public static void nodeMessage(java.io.PrintStream printStream, java.lang.String message)
public static void nodeMessage(java.io.PrintStream printStream, int id, java.lang.String message)
public void message(java.lang.String message)
public java.lang.String name()
public abstract boolean isClosed()
public long getCurrentSearchingVersion() throws java.io.IOException
java.io.IOException
public static java.lang.String bytesToString(long bytes)
public FileMetaData readLocalFileMetaData(java.lang.String fileName) throws java.io.IOException
FileMetaData
.
This returns null, logging a message, if there are any problems (the file does not exist, is corrupt, truncated, etc.).
java.io.IOException
Copyright © 2000–2019 The Apache Software Foundation. All rights reserved.