All Implemented Interfaces:
com.fishlib.base.log.LogOutputAppendable, DataImportChannelItem
Direct Known Subclasses:
AckRescanMessage, AckTruncateMessage

public class AckMessage extends PayloadDataImportChannelItem implements com.fishlib.base.log.LogOutputAppendable
Message sent to acknowledge a DataImportChannelItem. The request item should have had an id, which will be matched.
  • Field Details

    • log

      protected static com.fishlib.io.logger.Logger log
    • NO_VERSION

      protected static final int NO_VERSION
      The version of data items that predate systematic versioning.
      See Also:
    • BASELINE_VERSION

      protected static final int BASELINE_VERSION
      The version of any data item that isn't given an explicit version. This should never change.
      See Also:
    • VERSION_INDICATOR

      protected static final int VERSION_INDICATOR
      This sequence indicates that a version int follows. Where this might be expected, its absence indicates the default or baseline version will be assumed. The value should be negative to avoid any chance of confusion with a size.
      See Also:
    • version

      protected int version
  • Method Details

    • getId

      public long getId()
    • getResult

      public AckMessage.Result getResult()
    • getException

      @Nullable public Exception getException()
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • append

      public com.fishlib.base.log.LogOutput append(com.fishlib.base.log.LogOutput logOutput)
      Specified by:
      append in interface com.fishlib.base.log.LogOutputAppendable
    • getPrimaryType

      public DataImportChannelType getPrimaryType()
      Description copied from interface: DataImportChannelItem
      Get the item type.
      Specified by:
      getPrimaryType in interface DataImportChannelItem
      Returns:
      The item type
    • getAlternateTypes

      public DataImportChannelType[] getAlternateTypes()
      Description copied from interface: DataImportChannelItem
      Get all alternate types that this item can process as input.
      Specified by:
      getAlternateTypes in interface DataImportChannelItem
      Returns:
      The alternate Types
    • prepareVersion

      protected void prepareVersion(@NotNull ByteBuffer bodyBuffer)
      Put the version bytes into the body buffer. Does not clear or flip the buffer. This is called only by PayloadDataImportChannelItem on behalf of derived classes.
      Parameters:
      bodyBuffer - the buffer to populate
    • checkVersion

      protected void checkVersion()
      Allow subclasses to allow for future versions. This is relevant for the data items that could be sent out to an older client. A subclass overriding this likely also needs to override finishRead to ensure that extra bytes are consumed (safely).
    • read

      public void read(@NotNull ByteBuffer buffer, byte wireDataType)
      Description copied from interface: DataImportChannelItem

      Fill this item's contents from the supplied buffer.

      Header data as described in DataImportChannelItem.send(IOJob) will already have been consumed.

      Specified by:
      read in interface DataImportChannelItem
      Parameters:
      buffer - The buffer to read data from
      wireDataType - the data type from the stream.
    • getVersion

      public int getVersion()
      Description copied from interface: DataImportChannelItem
      Get the version of this DataImportChannelItem.
      Specified by:
      getVersion in interface DataImportChannelItem
      Returns:
      the version of the DataImportChannelItem.
    • getCurrentVersion

      public int getCurrentVersion()
      Description copied from interface: DataImportChannelItem
      Get the latest version supported by this DataImportChannelItem. This is used by abstract implementations to verify the version read off the wire.
      Specified by:
      getCurrentVersion in interface DataImportChannelItem
      Returns:
      the latest version supported by this DataImportChannelItem