Class WorkspaceDataLogger
- All Implemented Interfaces:
io.deephaven.enterprise.binlog.support.LoggerInfo
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final byteFlag indicating that this row is the end of a transaction.static final byteFlag indicating that this row is neither the beginning nor end of a transaction.static final byteFlag indicating that this row is the beginning and end of a transaction.static final byteFlag indicating that this row is the beginning of a transaction.protected io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ByteBufferallocateBuffer(int size) Allocate a buffer for logging.voidclose()Closes the underlying writer for this logger.booleanprotected intinitialBufferSize(String Owner, String Name, String Id, String DataType, String Data, String Status, String[] AdminGroups, String[] ViewerGroups, String LastModifiedByAuthenticated, String LastModifiedByEffective) Compute the initial size of the buffer for logging the row.initLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter multiPartitionBufferWriter, DateTimeFormatter partitionFormatter) Initialize a logger for the DbInternal.WorkspaceData table, with log format 2.voidlog(byte flags, String Owner, String Name, String Id, int Version, String DataType, String Data, String Status, String[] AdminGroups, String[] ViewerGroups, String LastModifiedByAuthenticated, String LastModifiedByEffective, long LastModifiedTime) Logs a row, using the writer passed in to theinitLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter, java.time.format.DateTimeFormatter)method.intCreate a long-lived header buffer.makeRowBuffer(byte flags, String Owner, String Name, String Id, int Version, String DataType, String Data, String Status, String[] AdminGroups, String[] ViewerGroups, String LastModifiedByAuthenticated, String LastModifiedByEffective, long LastModifiedTime) Allocates and populates a row buffer for the given inputs.Populate a header buffer.populateRowBuffer(ByteBuffer outputBuffer, byte flags, String Owner, String Name, String Id, int Version, String DataType, String Data, String Status, String[] AdminGroups, String[] ViewerGroups, String LastModifiedByAuthenticated, String LastModifiedByEffective, long LastModifiedTime) Populates the outputBuffer with the parameter values.voidreleaseBuffer(ByteBuffer buffer) Release a buffer previously allocated for logging the row.voidsetMaxEntrySize(int maxEntrySize) Sets The maximum size of a binary log entry.voidsetStringEstimateMultiplier(double stringEstimateMultiplier) Sets For strings that do not use a simple encoding, how many bytes (multiplied by length) should be initially allocated for each string?booleantoString()
-
Field Details
-
FLAG_NONE
public static final byte FLAG_NONEFlag indicating that this row is neither the beginning nor end of a transaction.- See Also:
-
FLAG_START
public static final byte FLAG_STARTFlag indicating that this row is the beginning of a transaction.- See Also:
-
FLAG_END
public static final byte FLAG_ENDFlag indicating that this row is the end of a transaction.- See Also:
-
FLAG_SINGLE_ROW
public static final byte FLAG_SINGLE_ROWFlag indicating that this row is the beginning and end of a transaction.- See Also:
-
writer
protected io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter writerThe writer used by thelog(byte, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[], java.lang.String[], java.lang.String, java.lang.String, long)method. This must be set byinitLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter, java.time.format.DateTimeFormatter)before calling the log method.
-
-
Constructor Details
-
WorkspaceDataLogger
public WorkspaceDataLogger()
-
-
Method Details
-
initialBufferSize
protected int initialBufferSize(String Owner, String Name, String Id, String DataType, String Data, String Status, String[] AdminGroups, String[] ViewerGroups, String LastModifiedByAuthenticated, String LastModifiedByEffective) Compute the initial size of the buffer for logging the row. If the buffer is not large enough, then it can be exponentially increased up until the maximum size. The initial size takes into account all fixed fields for the row, and then quickly estimates without actually encoding variable length fields. -
allocateBuffer
Allocate a buffer for logging.This method is protected so that it can be overridden by sub-classes, which may elect to use pooling or another allocation strategy. The buffers returned from this method must be released using
releaseBuffer(java.nio.ByteBuffer)after they are done being used. The logger implementations may retain a buffer for the life of the logger if it will be reused (e.g., header buffers are used across files and connections). -
releaseBuffer
Release a buffer previously allocated for logging the row.This method is protected so that it can be overridden by sub-classes, which may elect to use pooling or another allocation strategy. The logger implementations may retain a buffer for the life of the logger if it will be reused (e.g., header buffers are used across files and connections).
-
setStringEstimateMultiplier
public void setStringEstimateMultiplier(double stringEstimateMultiplier) Sets For strings that do not use a simple encoding, how many bytes (multiplied by length) should be initially allocated for each string? -
setMaxEntrySize
public void setMaxEntrySize(int maxEntrySize) Sets The maximum size of a binary log entry. This defaults to the value of BinaryStoreV2Constants.MAX_ENTRY_SIZE (1048576) at logger generation time. You must ensure that the loggers value is less than or equal to the value of the running system, or it the Data Import Server may not make progress consuming the generated binary log. -
initLog
public WorkspaceDataLogger initLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter multiPartitionBufferWriter, DateTimeFormatter partitionFormatter) throws IOException Initialize a logger for the DbInternal.WorkspaceData table, with log format 2.- Parameters:
multiPartitionBufferWriter- the writer for this logger, required for callinglog(byte, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[], java.lang.String[], java.lang.String, java.lang.String, long)@param partitionFormatter A datetime formatter for time based partition using the LastModifiedTime column. You must pass in a formatter that is thread safe, or otherwise externally synchronize this logger.- Throws:
IOException
-
log
public void log(byte flags, String Owner, String Name, String Id, int Version, String DataType, String Data, String Status, String[] AdminGroups, String[] ViewerGroups, String LastModifiedByAuthenticated, String LastModifiedByEffective, long LastModifiedTime) throws IOException Logs a row, using the writer passed in to theinitLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter, java.time.format.DateTimeFormatter)method.- Parameters:
flags- the flags for this row, which start and end transactions- Throws:
IOException
-
close
Closes the underlying writer for this logger.- Throws:
IOException
-
makeRowBuffer
public ByteBuffer makeRowBuffer(byte flags, String Owner, String Name, String Id, int Version, String DataType, String Data, String Status, String[] AdminGroups, String[] ViewerGroups, String LastModifiedByAuthenticated, String LastModifiedByEffective, long LastModifiedTime) throws IOException Allocates and populates a row buffer for the given inputs.The buffer is allocated with allocateBuffer based on a size estimate, and exponentially doubled up until the value of maxEntrySize. The caller is responsible for calling releaseBuffer after the buffer is no longer necessary.
- Parameters:
flags- the flags for this row, which start and end transactions- Throws:
IOException
-
populateRowBuffer
public ByteBuffer populateRowBuffer(ByteBuffer outputBuffer, byte flags, String Owner, String Name, String Id, int Version, String DataType, String Data, String Status, String[] AdminGroups, String[] ViewerGroups, String LastModifiedByAuthenticated, String LastModifiedByEffective, long LastModifiedTime) Populates the outputBuffer with the parameter values. The outputBuffer must be sufficiently sized to contain the output.- Parameters:
flags- the flags for this row, which start and end transactions
-
makeHeaderBuffer
Create a long-lived header buffer.The header buffer includes all column definitions, constant columns and the application version.
The returned buffer is duplicated after calling
populateHeaderBuffer(), and is owned by the caller. It should not be passed to makeHeaderBuffer. -
populateHeaderBuffer
Populate a header buffer.The header buffer includes all column definitions, constant columns and the application version.
The returned buffer is allocated with allocateBuffer, the caller is responsible for calling releaseBuffer after the buffer is done being used.
-
systemNamespace
public boolean systemNamespace()- Specified by:
systemNamespacein interfaceio.deephaven.enterprise.binlog.support.LoggerInfo
-
namespaceSet
- Specified by:
namespaceSetin interfaceio.deephaven.enterprise.binlog.support.LoggerInfo
-
dynamicPartitions
public boolean dynamicPartitions()- Specified by:
dynamicPartitionsin interfaceio.deephaven.enterprise.binlog.support.LoggerInfo
-
tableName
- Specified by:
tableNamein interfaceio.deephaven.enterprise.binlog.support.LoggerInfo
-
namespace
- Specified by:
namespacein interfaceio.deephaven.enterprise.binlog.support.LoggerInfo
-
logFormat
public int logFormat()- Specified by:
logFormatin interfaceio.deephaven.enterprise.binlog.support.LoggerInfo
-
toString
-