Class DirectProtocol


  • public class DirectProtocol
    extends java.lang.Object
    Communication types:
    • A) From Loader to Consumer - Metadata and Message Data - high traffic. Low latency required. Aeron.
    • B) From Loader to Server - Metadata (temporary entity ids), latency can be high. VSChannel.
    • C) From Server to Loader - Metadata (permanent entity ids), latency can be high. Aeron (we could use sockets but we need fast non-blocking implementation).
    • D) From Loader to Server and from Server to Loader - new loader registration process. Executed once per loader.
    • E) From Consumer to Server and from Server to Consumer - new consumer registration process. Executed once per consumer.
    Conventions:
    • Consumer reads data only from E-type channel.
    • Loader must send permanent entity index to client as soon as it known to loader. That's not server's responsibility.
    • Server always responds to loader with all requested symbols
    • Types are defined upon topic creation and can't be changed
    • Entities can be initialized upon topic creation. So all loaders will know such entities upon start.
    • Entities can be added/updated upon loader creation. Each loader get full list of known entities upon start.
    • Entities can be added by any loader on the fly. Such entities get temporary ID. Loader is responsible to send that temporary mapping to topic server. Topic server will assign permanent id
    • Field Detail

      • CODE_TEMP_INDEX_REMOVED

        public static final byte CODE_TEMP_INDEX_REMOVED
        See Also:
        Constant Field Values
      • CODE_OFFSET

        public static final int CODE_OFFSET
      • AFTER_CODE_OFFSET

        public static final int AFTER_CODE_OFFSET
      • TYPE_OFFSET

        public static final int TYPE_OFFSET
      • ENTITY_OFFSET

        public static final int ENTITY_OFFSET
      • TIME_OFFSET

        public static final int TIME_OFFSET
      • DATA_OFFSET

        public static final int DATA_OFFSET
      • REQUIRED_HEADER_SIZE

        public static final int REQUIRED_HEADER_SIZE
      • METADATA_OFFSET

        public static final int METADATA_OFFSET
      • TEMP_INDEX_REMOVED_DATA_OFFSET

        public static final int TEMP_INDEX_REMOVED_DATA_OFFSET
      • END_OF_STREAM_DATA_OFFSET

        public static final int END_OF_STREAM_DATA_OFFSET
    • Constructor Detail

      • DirectProtocol

        public DirectProtocol()
    • Method Detail

      • getFirstTempEntryIndex

        public static int getFirstTempEntryIndex​(int publisherNumber)
      • getMinTempEntryIndex

        public static int getMinTempEntryIndex​(int publisherNumber)
      • getMaxTempEntryIndex

        public static int getMaxTempEntryIndex​(int publisherNumber)
      • getPublisherNumberFromTempIndex

        public static int getPublisherNumberFromTempIndex​(int entityIndex)
      • isValidTempIndex

        public static boolean isValidTempIndex​(int entityIndex)
        More strict check than in isTempIndex(int). The difference is that we treat value -1 as invalid temp index because it's not permitted as value. This is done because we want to use value "-1" as "NOT_FOUND" value in lookups.
      • isTempIndex

        public static boolean isTempIndex​(int entityIndex)
      • isValidPermanentIndex

        public static boolean isValidPermanentIndex​(int entityIndex)