Class ProcessingBufferFactory

java.lang.Object
ai.pipestream.common.util.ProcessingBufferFactory

public class ProcessingBufferFactory extends Object
Factory for creating ProcessingBuffer instances. This factory creates either a ProcessingBufferImpl or a NoOpProcessingBuffer based on the provided configuration.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Default constructor for ProcessingBufferFactory.
  • Method Summary

    Modifier and Type
    Method
    Description
    static <T extends com.google.protobuf.Message>
    ProcessingBuffer<T>
    createBuffer(boolean enabled, int capacity, Class<T> messageClass)
    Creates a ProcessingBuffer instance with the default file system.
    static <T extends com.google.protobuf.Message>
    ProcessingBuffer<T>
    createBuffer(boolean enabled, int capacity, Class<T> messageClass, FileSystem fileSystem)
    Creates a ProcessingBuffer instance with a specific file system.
    static <T extends com.google.protobuf.Message>
    ProcessingBuffer<T>
    createBuffer(boolean enabled, int capacity, Class<T> messageClass, FileSystem fileSystem, Path saveLocation, String savePrefix, int savePrecision)
    Creates a ProcessingBuffer instance with a specific file system and save parameters.
    static <T extends com.google.protobuf.Message>
    ProcessingBuffer<T>
    createBuffer(boolean enabled, int capacity, Class<T> messageClass, Path saveLocation, String savePrefix, int savePrecision)
    Creates a ProcessingBuffer instance with the default file system and save parameters.
    static <T extends com.google.protobuf.Message>
    ProcessingBuffer<T>
    createBuffer(boolean enabled, Class<T> messageClass)
    Creates a ProcessingBuffer instance with default capacity (100) and the default file system.
    static <T extends com.google.protobuf.Message>
    ProcessingBuffer<T>
    createBuffer(boolean enabled, Class<T> messageClass, FileSystem fileSystem)
    Creates a ProcessingBuffer instance with default capacity (100) and a specific file system.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ProcessingBufferFactory

      public ProcessingBufferFactory()
      Default constructor for ProcessingBufferFactory. This class only provides static methods, so the constructor is not used.
  • Method Details

    • createBuffer

      public static <T extends com.google.protobuf.Message> ProcessingBuffer<T> createBuffer(boolean enabled, int capacity, Class<T> messageClass, FileSystem fileSystem, Path saveLocation, String savePrefix, int savePrecision)
      Creates a ProcessingBuffer instance with a specific file system and save parameters.
      Type Parameters:
      T - the type of protobuf message
      Parameters:
      enabled - whether to enable the buffer (if false, returns a NoOpProcessingBuffer)
      capacity - the capacity of the buffer
      messageClass - the class of the protobuf message
      fileSystem - the file system to use for saving files
      saveLocation - the directory to save the files to
      savePrefix - the prefix to use for the file names
      savePrecision - the number of digits to use for the file name suffix
      Returns:
      a ProcessingBuffer instance
    • createBuffer

      public static <T extends com.google.protobuf.Message> ProcessingBuffer<T> createBuffer(boolean enabled, int capacity, Class<T> messageClass, Path saveLocation, String savePrefix, int savePrecision)
      Creates a ProcessingBuffer instance with the default file system and save parameters.
      Type Parameters:
      T - the type of protobuf message
      Parameters:
      enabled - whether to enable the buffer (if false, returns a NoOpProcessingBuffer)
      capacity - the capacity of the buffer
      messageClass - the class of the protobuf message
      saveLocation - the directory to save the files to
      savePrefix - the prefix to use for the file names
      savePrecision - the number of digits to use for the file name suffix
      Returns:
      a ProcessingBuffer instance
    • createBuffer

      public static <T extends com.google.protobuf.Message> ProcessingBuffer<T> createBuffer(boolean enabled, int capacity, Class<T> messageClass, FileSystem fileSystem)
      Creates a ProcessingBuffer instance with a specific file system.
      Type Parameters:
      T - the type of protobuf message
      Parameters:
      enabled - whether to enable the buffer (if false, returns a NoOpProcessingBuffer)
      capacity - the capacity of the buffer
      messageClass - the class of the protobuf message
      fileSystem - the file system to use for saving files
      Returns:
      a ProcessingBuffer instance
    • createBuffer

      public static <T extends com.google.protobuf.Message> ProcessingBuffer<T> createBuffer(boolean enabled, int capacity, Class<T> messageClass)
      Creates a ProcessingBuffer instance with the default file system.
      Type Parameters:
      T - the type of protobuf message
      Parameters:
      enabled - whether to enable the buffer (if false, returns a NoOpProcessingBuffer)
      capacity - the capacity of the buffer
      messageClass - the class of the protobuf message
      Returns:
      a ProcessingBuffer instance
    • createBuffer

      public static <T extends com.google.protobuf.Message> ProcessingBuffer<T> createBuffer(boolean enabled, Class<T> messageClass)
      Creates a ProcessingBuffer instance with default capacity (100) and the default file system.
      Type Parameters:
      T - the type of protobuf message
      Parameters:
      enabled - whether to enable the buffer (if false, returns a NoOpProcessingBuffer)
      messageClass - the class of the protobuf message
      Returns:
      a ProcessingBuffer instance
    • createBuffer

      public static <T extends com.google.protobuf.Message> ProcessingBuffer<T> createBuffer(boolean enabled, Class<T> messageClass, FileSystem fileSystem)
      Creates a ProcessingBuffer instance with default capacity (100) and a specific file system.
      Type Parameters:
      T - the type of protobuf message
      Parameters:
      enabled - whether to enable the buffer (if false, returns a NoOpProcessingBuffer)
      messageClass - the class of the protobuf message
      fileSystem - the file system to use for saving files
      Returns:
      a ProcessingBuffer instance