Class NoOpProcessingBuffer<T extends com.google.protobuf.Message>

java.lang.Object
ai.pipestream.common.util.NoOpProcessingBuffer<T>
Type Parameters:
T - the type of protobuf message
All Implemented Interfaces:
ProcessingBuffer<T>

public class NoOpProcessingBuffer<T extends com.google.protobuf.Message> extends Object implements ProcessingBuffer<T>
A no-op implementation of the ProcessingBuffer interface. This implementation doesn't actually store or save any messages. It's used in production environments where we don't want to incur the overhead of storing and saving protobuf messages.
  • Constructor Details

    • NoOpProcessingBuffer

      public NoOpProcessingBuffer()
      Default constructor for NoOpProcessingBuffer. Creates an empty buffer that doesn't store any messages.
  • Method Details

    • add

      public void add(T message)
      Does nothing.
      Specified by:
      add in interface ProcessingBuffer<T extends com.google.protobuf.Message>
      Parameters:
      message - the message to add (ignored)
    • saveToDisk

      public void saveToDisk()
      Does nothing.
      Specified by:
      saveToDisk in interface ProcessingBuffer<T extends com.google.protobuf.Message>
    • saveToDisk

      public void saveToDisk(String fileNamePrefix, int numberPrecision)
      Description copied from interface: ProcessingBuffer
      Saves all messages in the buffer to disk to "
      ./
      " directory.
      Specified by:
      saveToDisk in interface ProcessingBuffer<T extends com.google.protobuf.Message>
      Parameters:
      fileNamePrefix - the prefix to use for the file names
      numberPrecision - the number of digits to use for the file name suffix
    • saveToDisk

      public void saveToDisk(Path location, String fileNamePrefix, int numberPrecision)
      Does nothing.
      Specified by:
      saveToDisk in interface ProcessingBuffer<T extends com.google.protobuf.Message>
      Parameters:
      location - the directory to save the files to (ignored)
      fileNamePrefix - the prefix to use for the file names (ignored)
      numberPrecision - the number of digits to use for the file name suffix (ignored)
    • size

      public int size()
      Always returns 0.
      Specified by:
      size in interface ProcessingBuffer<T extends com.google.protobuf.Message>
      Returns:
      0
    • clear

      public void clear()
      Does nothing.
      Specified by:
      clear in interface ProcessingBuffer<T extends com.google.protobuf.Message>
    • saveOnShutdown

      @PreDestroy public void saveOnShutdown()
      Does nothing on shutdown.
    • snapshot

      public List<T> snapshot()
      Always returns an empty list since this is a no-op buffer.
      Specified by:
      snapshot in interface ProcessingBuffer<T extends com.google.protobuf.Message>
      Returns:
      an empty list