Class Node

    • Field Detail

      • VERBOSE_FILES

        public static boolean VERBOSE_FILES
      • VERBOSE_CONNECTIONS

        public static boolean VERBOSE_CONNECTIONS
      • PRIMARY_GEN_KEY

        public static 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
      • VERSION_KEY

        public static String VERSION_KEY
        Key to store the version in the commit data, which increments every time we open a new NRT reader
      • id

        protected final int id
        Compact ordinal for this node
      • globalStartNS

        public static long globalStartNS
        Startup time of original test, carefully propogated to all nodes to produce consistent "seconds since start time" in messages
      • localStartNS

        public static final long localStartNS
        When this node was started
      • printStream

        protected final PrintStream printStream
        For debug logging
      • lastFileMetaData

        protected volatile Map<String,​FileMetaData> lastFileMetaData
        File metadata for last sync that succeeded; we use this as a cache
    • Method Detail

      • getDirectory

        public Directory getDirectory()
        Returns the Directory this node is writing to
      • nodeMessage

        public static void nodeMessage​(PrintStream printStream,
                                       String message)
      • nodeMessage

        public static void nodeMessage​(PrintStream printStream,
                                       int id,
                                       String message)
      • message

        public void message​(String message)
      • isClosed

        public abstract boolean isClosed()
      • getCurrentSearchingVersion

        public long getCurrentSearchingVersion()
                                        throws IOException
        Throws:
        IOException
      • bytesToString

        public static String bytesToString​(long bytes)
      • readLocalFileMetaData

        public FileMetaData readLocalFileMetaData​(String fileName)
                                           throws IOException
        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.

        This returns null, logging a message, if there are any problems (the file does not exist, is corrupt, truncated, etc.).

        Throws:
        IOException