com.neeve.rog.log
Class RogLog.Entry

java.lang.Object
  extended by com.neeve.rog.log.RogLog.Entry
All Implemented Interfaces:
UtlPool.Item<RogLog.Entry>
Enclosing class:
RogLog

public static final class RogLog.Entry
extends Object
implements UtlPool.Item<RogLog.Entry>

Represents a transaction log entry

Threading:RogLog.Entrys are not safe for concurrent access by multiple threads.


Nested Class Summary
static class RogLog.Entry.Type
          Enumerates the various entry types
 
Method Summary
static RogLog.Entry create(PktPacket packet)
          Wraps an entry around a packet read from a RogLog.
 void dispose()
          May be called when the RogLog.Entry will no longer be used to indicate that it's backing objects can be returned to their pools
 long getCheckpointVersion()
          Get the entry's checkpoint version.
 String getClassName()
          Get the simple class name of the logged object
 IStoreObject.EncodingType getContentEncodingType()
          Get's the object's content encoding type.
 int getEntrySize()
          Get the serialized size of an entry.
 RogLog.Entry.Type getEntryType()
          Get the entry type
 long getFilePosition()
          Gets the current position of the entry in the file.
static String getHeaderRow(boolean csv)
          Returns a row suitable to act as a header for information dumped by toString().
 com.eaio.uuid.UUID getId()
          Get the object id
 RogLog getLog()
          Returns the RogLog from which this entry was read.
 String getLogName()
          Gets the name of this RogLog.Entry's log.
 IRogMetadata getMetadata()
          Gets the metadata associated with this entry.
 IStoreObject getObject()
          Get the object associated with this entry or null, if the entry did not contain a serialized object.
 short getOfid()
          When the entry has a serialized payload, returns the serialized object's object factory id
 short getOtype()
          When the entry has a serialized payload, returns the serialized object's object type
 PktPacket getPacket()
          Get the raw packet backing this entry.
 int getPayloadSize()
          Get the serialized size of an entry's payload.
 UtlPool<RogLog.Entry> getPool()
          Implementation of UtlPool.Item#getPool.
 ByteBuffer getRawBody()
          Returns the object in its serialized form, or null if either the entry doesn't have a corresponding object or if the object's serialized form has been discarded as a result of deserializing it into it's object form.
 PktBuffer getSerializedMetadata()
          Gets the serialized metadata for this entry.
 String getSimpleClassName()
          Get the simple class name of the logged object
 long getStableTransactionId()
          Get the entry's stabilized transaction id.
 long getTimestamp()
          Gets the time at which this entry was persisted or 0 if no persist timestamp was recorded.
 long getTransactionId()
          Get the entry's transaction id.
 RogLog.Entry init()
          Implementation of UtlPool.Item#init.
 boolean isCommitEnd()
          Get if an entry marks the end of a commit
 boolean isCommitStart()
          Get if an entry marks the start of a commit
 boolean isPayloadDeserialized()
          Indicates whether the payload was deserialized via getObject().
 RogLog.Entry setPool(UtlPool<RogLog.Entry> pool)
          Implementation of UtlPool.Item#setPool.
 String toString()
          Returns a tabular String format for this RogLog.Entry.
 String toString(boolean csv)
          Returns a csv or tabular formatted string for this RogLog.Entry
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

create

public static final RogLog.Entry create(PktPacket packet)
                                 throws OdsException
Wraps an entry around a packet read from a RogLog.

This method acquires the passed in packet. The returned Entry is itself pooled. The caller should dispose of it when done.

Parameters:
packet - The packet from the log.
Returns:
The entry.
Throws:
OdsException - If the packet cannot be wrapped in an entry.

getFilePosition

public final long getFilePosition()
Gets the current position of the entry in the file. Note that this is subject to change if the log is compacted or otherwise altered in which case the value reported by this entry will no longer be valid.

Returns:
The position of this entry in the log file.

getLogName

public final String getLogName()
Gets the name of this RogLog.Entry's log.

Returns:
The name of the log this RogLog.Entry cam from.

getTimestamp

public final long getTimestamp()
Gets the time at which this entry was persisted or 0 if no persist timestamp was recorded.

Returns:
The timestamp at which the entry was persisted.

getEntryType

public final RogLog.Entry.Type getEntryType()
Get the entry type


getEntrySize

public final int getEntrySize()
Get the serialized size of an entry.


getPayloadSize

public final int getPayloadSize()
Get the serialized size of an entry's payload.


getClassName

public final String getClassName()
Get the simple class name of the logged object


getSimpleClassName

public final String getSimpleClassName()
Get the simple class name of the logged object


getId

public final com.eaio.uuid.UUID getId()
Get the object id


getTransactionId

public final long getTransactionId()
Get the entry's transaction id.

Returns:
the entry's transaction id.
See Also:
IStoreObject.getTransactionId()

getStableTransactionId

public final long getStableTransactionId()
Get the entry's stabilized transaction id.

Returns:
The entry's stabilized transaction id.
See Also:
IStoreObject.getStableTransactionId()

getCheckpointVersion

public final long getCheckpointVersion()
Get the entry's checkpoint version.

Returns:
The entry's checkpoint version.
See Also:
IStoreObject.getCheckpointVersion()

getPacket

public final PktPacket getPacket()
Get the raw packet backing this entry.

This method is reserved for internal use. Users of this api should use getObject().

Returns:
The entry's raw packet.

getObject

public final IStoreObject getObject()
Get the object associated with this entry or null, if the entry did not contain a serialized object. It is always preferable to use getMetadata() instead of getObject() since the latter requires full object deserialization whereas the former does not.

Returns:
The object that was removed (or null if a legacy Remove entry that didn't include the object).
Throws:
RuntimeException - if there is an error deserializing the object

isPayloadDeserialized

public final boolean isPayloadDeserialized()
Indicates whether the payload was deserialized via getObject(). Many operations that use an RogLog.Entry don't need the payload to be deserialized / unmarshalled. Which can result in

Returns:
Whether or not the entries payload has been deserialized yet.

isCommitStart

public final boolean isCommitStart()
Get if an entry marks the start of a commit


isCommitEnd

public final boolean isCommitEnd()
Get if an entry marks the end of a commit


getHeaderRow

public static final String getHeaderRow(boolean csv)
Returns a row suitable to act as a header for information dumped by toString().

Parameters:
csv - Indicates that the header row should be in csv format, otherwise a tabular format will be used.
Returns:
a row suitable to act as a header for information dumped by toString()

toString

public final String toString()
Returns a tabular String format for this RogLog.Entry.

Overrides:
toString in class Object

toString

public final String toString(boolean csv)
Returns a csv or tabular formatted string for this RogLog.Entry


getOfid

public short getOfid()
When the entry has a serialized payload, returns the serialized object's object factory id

Returns:
The serialized object's factory id.

getOtype

public short getOtype()
When the entry has a serialized payload, returns the serialized object's object type

Returns:
The serialized object's type.

getRawBody

public final ByteBuffer getRawBody()
Returns the object in its serialized form, or null if either the entry doesn't have a corresponding object or if the object's serialized form has been discarded as a result of deserializing it into it's object form.

Returns:
Returns the object in its serialized form

getContentEncodingType

public IStoreObject.EncodingType getContentEncodingType()
Get's the object's content encoding type. An entry's content encoding type indicates how the object should be materialized from it's serialized encoding type.

Returns:
The object's content encoding type.

getSerializedMetadata

public PktBuffer getSerializedMetadata()
Gets the serialized metadata for this entry.

Returns:
The serialized metadata for this entry.

getMetadata

public IRogMetadata getMetadata()
Gets the metadata associated with this entry.

Returns:
The metadata associated with the entry.

getLog

public RogLog getLog()
Returns the RogLog from which this entry was read.

Returns:
The RogLog that read this entry

dispose

public final void dispose()
May be called when the RogLog.Entry will no longer be used to indicate that it's backing objects can be returned to their pools


init

public final RogLog.Entry init()
Implementation of UtlPool.Item#init.

Specified by:
init in interface UtlPool.Item<RogLog.Entry>
Returns:
Return 'this' object for method invocation chaining.

setPool

public final RogLog.Entry setPool(UtlPool<RogLog.Entry> pool)
Implementation of UtlPool.Item#setPool.

Specified by:
setPool in interface UtlPool.Item<RogLog.Entry>
Returns:
Return 'this' object for method invocation chaining.

getPool

public final UtlPool<RogLog.Entry> getPool()
Implementation of UtlPool.Item#getPool.

Specified by:
getPool in interface UtlPool.Item<RogLog.Entry>
Returns:
the pool set using UtlPool.Item.setPool(com.neeve.util.UtlPool)


Copyright © 2016 Neeve Research, LLC. All Rights Reserved.