Package ai.pipestream.common.util
Class ProcessingBufferFactory
java.lang.Object
ai.pipestream.common.util.ProcessingBufferFactory
Factory for creating ProcessingBuffer instances.
This factory creates either a ProcessingBufferImpl or a NoOpProcessingBuffer
based on the provided configuration.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <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.
-
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 buffermessageClass- the class of the protobuf messagefileSystem- the file system to use for saving filessaveLocation- the directory to save the files tosavePrefix- the prefix to use for the file namessavePrecision- 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 buffermessageClass- the class of the protobuf messagesaveLocation- the directory to save the files tosavePrefix- the prefix to use for the file namessavePrecision- 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 buffermessageClass- the class of the protobuf messagefileSystem- 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 buffermessageClass- 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 messagefileSystem- the file system to use for saving files- Returns:
- a ProcessingBuffer instance
-