Class AuditEventLogger
- All Implemented Interfaces:
io.deephaven.enterprise.binlog.support.LoggerInfo
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected 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 ClientHost, String ClientUuid, String AuthenticatedUser, String EffectiveUser, String Namespace, String Table, String Event, String Details) Compute the initial size of the buffer for logging the row.initLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter multiPartitionBufferWriter, DateTimeFormatter partitionFormatter, String ServerHost, int ServerPort, String Process, String ProcessInfoId, String ProcessUser) Initialize a logger for the DbInternal.AuditEventLog table, with log format 3.voidlog(long Timestamp, String ClientHost, int ClientPort, String ClientUuid, String AuthenticatedUser, String EffectiveUser, String Namespace, String Table, int Id, String Event, String Details) Logs a row, using the writer passed in to theinitLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter, java.time.format.DateTimeFormatter, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String)method.intmakeHeaderBuffer(String ServerHost, int ServerPort, String Process, String ProcessInfoId, String ProcessUser) Create a long-lived header buffer.makeRowBuffer(long Timestamp, String ClientHost, int ClientPort, String ClientUuid, String AuthenticatedUser, String EffectiveUser, String Namespace, String Table, int Id, String Event, String Details) Allocates and populates a row buffer for the given inputs.populateHeaderBuffer(String ServerHost, int ServerPort, String Process, String ProcessInfoId, String ProcessUser) Populate a header buffer.populateRowBuffer(ByteBuffer outputBuffer, long Timestamp, String ClientHost, int ClientPort, String ClientUuid, String AuthenticatedUser, String EffectiveUser, String Namespace, String Table, int Id, String Event, String Details) 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
-
writer
protected io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter writerThe writer used by thelog(long, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)method. This must be set byinitLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter, java.time.format.DateTimeFormatter, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String)before calling the log method.
-
-
Constructor Details
-
AuditEventLogger
public AuditEventLogger()
-
-
Method Details
-
initialBufferSize
protected int initialBufferSize(String ClientHost, String ClientUuid, String AuthenticatedUser, String EffectiveUser, String Namespace, String Table, String Event, String Details) 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 AuditEventLogger initLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter multiPartitionBufferWriter, DateTimeFormatter partitionFormatter, String ServerHost, int ServerPort, String Process, String ProcessInfoId, String ProcessUser) throws IOException Initialize a logger for the DbInternal.AuditEventLog table, with log format 3.- Parameters:
multiPartitionBufferWriter- the writer for this logger, required for callinglog(long, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, int, java.lang.String, java.lang.String)@param partitionFormatter A datetime formatter for time based partition using the Timestamp column. You must pass in a formatter that is thread safe, or otherwise externally synchronize this logger.- Throws:
IOException
-
log
public void log(long Timestamp, String ClientHost, int ClientPort, String ClientUuid, String AuthenticatedUser, String EffectiveUser, String Namespace, String Table, int Id, String Event, String Details) throws IOException Logs a row, using the writer passed in to theinitLog(io.deephaven.enterprise.binlog.support.MultiPartitionBufferWriter, java.time.format.DateTimeFormatter, java.lang.String, int, java.lang.String, java.lang.String, java.lang.String)method.- Throws:
IOException
-
close
Closes the underlying writer for this logger.- Throws:
IOException
-
makeRowBuffer
public ByteBuffer makeRowBuffer(long Timestamp, String ClientHost, int ClientPort, String ClientUuid, String AuthenticatedUser, String EffectiveUser, String Namespace, String Table, int Id, String Event, String Details) 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.
- Throws:
IOException
-
populateRowBuffer
public ByteBuffer populateRowBuffer(ByteBuffer outputBuffer, long Timestamp, String ClientHost, int ClientPort, String ClientUuid, String AuthenticatedUser, String EffectiveUser, String Namespace, String Table, int Id, String Event, String Details) Populates the outputBuffer with the parameter values. The outputBuffer must be sufficiently sized to contain the output. -
makeHeaderBuffer
public ByteBuffer makeHeaderBuffer(String ServerHost, int ServerPort, String Process, String ProcessInfoId, String ProcessUser) 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(java.lang.String, int, java.lang.String, java.lang.String, java.lang.String), and is owned by the caller. It should not be passed to makeHeaderBuffer. -
populateHeaderBuffer
public ByteBuffer populateHeaderBuffer(String ServerHost, int ServerPort, String Process, String ProcessInfoId, String ProcessUser) 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
-