Package io.sbk.api

Interface Writer<T>

All Superinterfaces:
DataRecordsWriter<T>, DataWriter<T>

public non-sealed interface Writer<T> extends DataRecordsWriter<T>
Interface for Writers.
  • Method Details

    • writeAsync

      CompletableFuture<?> writeAsync(T data) throws IOException
      Asynchronously Writes the data .
      Parameters:
      data - data to write
      Returns:
      CompletableFuture completable future. null if write completed synchronously .
      Throws:
      IOException - If an exception occurred.
    • close

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

      default void sync() throws IOException
      Flush / Sync the data.
      Specified by:
      sync in interface DataRecordsWriter<T>
      Throws:
      IOException - If an exception occurred.
    • write

      default CompletableFuture<?> write(DataType<T> dType, T data, int size, io.time.Time time, Status status) throws IOException
      Default implementation for writing data using writeAsync(Object))} with start time. If you are intend to NOT use the CompletableFuture returned by writeAsync(Object) )} then you can override this method. otherwise, use the default implementation and don't override this method. If you are intend to use your own payload, then also you can use override this method. you can write multiple records with this method.
      Specified by:
      write in interface DataRecordsWriter<T>
      Parameters:
      dType - Data Type interface
      data - data to writer
      size - size of the data
      time - time interface
      status - write status to return
      Returns:
      CompletableFuture completable future. null if write completed synchronously .
      Throws:
      IOException - If an exception occurred.
    • write

      default CompletableFuture<?> write(DataType<T> dType, T data, int size, io.time.Time time, Status status, int id, WriteRequestsLogger logger) throws IOException
      Default implementation for writing data using writeAsync(Object))} with start time. If you are intend to NOT use the CompletableFuture returned by writeAsync(Object) )} then you can override this method. otherwise, use the default implementation and don't override this method. If you are intend to use your own payload, then also you can use override this method. you can write multiple records with this method.
      Specified by:
      write in interface DataRecordsWriter<T>
      Parameters:
      dType - Data Type interface
      data - data to writer
      size - size of the data
      time - time interface
      status - write status to return
      id - Writer id
      logger - log writer requests
      Returns:
      CompletableFuture completable future. null if write completed synchronously .
      Throws:
      IOException - If an exception occurred.
    • writeSetTime

      default void writeSetTime(DataType<T> dType, T data, int size, io.time.Time time, Status status) throws IOException
      Default implementation for writing data using writeAsync(Object) with start time If you are intend to NOT use the CompletableFuture returned by writeAsync(Object) )} then you can override this method. otherwise, use the default implementation and don't override this method. If you are intend to use your own payload, then also you can use override this method. you can write multiple records with this method.
      Specified by:
      writeSetTime in interface DataRecordsWriter<T>
      Parameters:
      dType - Data Type interface
      data - data to writer
      size - size of the data
      time - time interface
      status - write status to return
      Throws:
      IOException - If an exception occurred.
    • writeSetTime

      default void writeSetTime(DataType<T> dType, T data, int size, io.time.Time time, Status status, int id, WriteRequestsLogger logger) throws IOException
      Default implementation for writing data using writeAsync(Object) with start time If you are intend to NOT use the CompletableFuture returned by writeAsync(Object) )} then you can override this method. otherwise, use the default implementation and don't override this method. If you are intend to use your own payload, then also you can use override this method. you can write multiple records with this method.
      Specified by:
      writeSetTime in interface DataRecordsWriter<T>
      Parameters:
      dType - Data Type interface
      data - data to writer
      size - size of the data
      time - time interface
      status - write status to return
      id - Writer id
      logger - log writer requests
      Throws:
      IOException - If an exception occurred.
    • recordWrite

      default void recordWrite(DataType<T> dType, T data, int size, io.time.Time time, Status status, io.perl.api.PerlChannel perlChannel) throws IOException
      Default implementation for writing data using write(DataType, Object, int, Time, Status) and recording the benchmark statistics. If you are intend to NOT use the CompletableFuture returned by write(DataType, Object, int, Time, Status) then you can override this method. otherwise, use the default implementation and don't override this method. If you are intend to use your own payload, then also you can use override this method. you can write multiple records with this method.
      Specified by:
      recordWrite in interface DataRecordsWriter<T>
      Parameters:
      dType - Data Type interface
      data - data to write
      size - size of the data
      time - time interface
      status - Write status to return
      perlChannel - to call for benchmarking
      Throws:
      IOException - If an exception occurred.
    • recordWrite

      default void recordWrite(DataType<T> dType, T data, int size, io.time.Time time, Status status, io.perl.api.PerlChannel perlChannel, int id, WriteRequestsLogger logger) throws IOException
      Default implementation for writing data using write(DataType, Object, int, Time, Status) and recording the benchmark statistics. If you are intend to NOT use the CompletableFuture returned by write(DataType, Object, int, Time, Status) then you can override this method. otherwise, use the default implementation and don't override this method. If you are intend to use your own payload, then also you can use override this method. you can write multiple records with this method.
      Specified by:
      recordWrite in interface DataRecordsWriter<T>
      Parameters:
      dType - Data Type interface
      data - data to write
      size - size of the data
      time - time interface
      status - Write status to return
      perlChannel - to call for benchmarking
      id - Writer id
      logger - log writer requests
      Throws:
      IOException - If an exception occurred.