Interface Reader<T>

All Superinterfaces:
DataReader<T>, DataRecordsReader<T>

public non-sealed interface Reader<T> extends DataRecordsReader<T>
Reader abstraction used by SBK drivers to provide synchronous read semantics.

This interface extends DataRecordsReader and exposes a simple synchronous read() method that returns a single record. Default helper methods are provided to convert the returned payload into PerL metric events; implementors may override these helpers when batching or more efficient read paths are available.

Guidelines for implementors:

  • Return null from read() to indicate no data was read (timeout or empty stream); the default helpers interpret this as a zero-record event.
  • Use DataType.getTime(Object) when the payload encodes a start timestamp and prefer the recordReadTime helpers to measure end-to-end latency.
  • Close resources in close() to avoid leaks when drivers are dynamically loaded or run in long-lived processes.

Original brief description preserved for compatibility:

Interface for Readers.
  • Method Details

    • read

      T read() throws EOFException, IOException
      Read the data.
      Returns:
      T return the data.
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • close

      void close() throws IOException
      Close the Reader.
      Specified by:
      close in interface DataReader<T>
      Throws:
      IOException - If an exception occurred.
    • recordRead

      default void recordRead(DataType<T> dType, int size, io.time.Time time, Status status, io.perl.api.PerlChannel perlChannel) throws EOFException, IOException
      Default implementation for Reading data using read() and recording the benchmark statistics. The end time of the status parameter Status.endTime of this method determines the terminating condition for time based reader performance benchmarking. If you are intend to not use read() then you can override this method. If you are intend to read multiple records then you can override this method. otherwise, use the default implementation and don't override this method.
      Specified by:
      recordRead in interface DataRecordsReader<T>
      Parameters:
      dType - dataType
      size - size of the data in bytes
      time - time interface
      status - Timestamp
      perlChannel - to call for benchmarking
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • recordRead

      default void recordRead(DataType<T> dType, int size, io.time.Time time, Status status, io.perl.api.PerlChannel perlChannel, int id, ReadRequestsLogger logger) throws EOFException, IOException
      Default implementation for Reading data using read() and recording the benchmark statistics. The end time of the status parameter Status.endTime of this method determines the terminating condition for time based reader performance benchmarking. If you are intend to not use read() then you can override this method. If you are intend to read multiple records then you can override this method. otherwise, use the default implementation and don't override this method.
      Specified by:
      recordRead in interface DataRecordsReader<T>
      Parameters:
      dType - dataType
      size - size of the data in bytes
      time - time interface
      status - Timestamp
      perlChannel - to call for benchmarking
      id - reader id
      logger - Read Request logger
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • recordReadTime

      default void recordReadTime(DataType<T> dType, int size, io.time.Time time, Status status, io.perl.api.PerlChannel perlChannel) throws EOFException, IOException
      Default implementation for Reading data using read(), extracting start time from data and recording the benchmark statistics. The end time of the status parameter Status.endTime of this method determines the terminating condition for time based reader performance benchmarking. If you are intend to not use read() then you can override this method. If you are intend to read multiple records then you can override this method. otherwise, use the default implementation and don't override this method.
      Specified by:
      recordReadTime in interface DataRecordsReader<T>
      Parameters:
      dType - dataType
      size - size of the data in bytes
      time - time interface
      status - Timestamp
      perlChannel - to call for benchmarking
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.
    • recordReadTime

      default void recordReadTime(DataType<T> dType, int size, io.time.Time time, Status status, io.perl.api.PerlChannel perlChannel, int id, ReadRequestsLogger logger) throws EOFException, IOException
      Default implementation for Reading data using read(), extracting start time from data and recording the benchmark statistics. The end time of the status parameter Status.endTime of this method determines the terminating condition for time based reader performance benchmarking. If you are intend to not use read() then you can override this method. If you are intend to read multiple records then you can override this method. otherwise, use the default implementation and don't override this method.
      Specified by:
      recordReadTime in interface DataRecordsReader<T>
      Parameters:
      dType - dataType
      size - size of the data in bytes
      time - time interface
      status - Timestamp
      perlChannel - to call for benchmarking
      id - Reader id
      logger - log read requests
      Throws:
      EOFException - If the End of the file occurred.
      IOException - If an exception occurred.