com.neeve.pkt
Class PktSubheaderODS

java.lang.Object
  extended by com.neeve.util.UtlListElement
      extended by com.neeve.pkt.PktSerializable
          extended by com.neeve.pkt.PktBody
              extended by com.neeve.pkt.PktSubheader
                  extended by com.neeve.pkt.PktSubheaderVariable
                      extended by com.neeve.pkt.PktSubheaderODS
All Implemented Interfaces:
com.neeve.io.IOElasticBuffer.Initializer, com.neeve.io.IOElasticBuffer.Sizer

public final class PktSubheaderODS
extends PktSubheaderVariable

The ODS packet subheader.

This class is the subheader used by ODS store binding to hold serialized control information for store objects.

Threading:
Packet subheaders are not safe for concurrent access by multiple threads.

Nested Class Summary
 
Nested classes/interfaces inherited from class com.neeve.pkt.PktSerializable
PktSerializable.DeserializeContext, PktSerializable.SerializeContext
 
Field Summary
static short ENTRY_TYPE_MESSAGE
          Specifies that the entry is for a message
static short ENTRY_TYPE_PUT
          Specifies that the entry is for a put
static short ENTRY_TYPE_REMOVE
          Specifies that the entry is for a remove
static short ENTRY_TYPE_SEND
          Specifies that the entry is for a send
static short ENTRY_TYPE_UPDATE
          Specifies that the entry is for an update
static int FLAG_COMMIT_ACK_REQUIRED
          Specifies that a commit ack needs to be sent back
static int FLAG_COMMIT_END
          Specifies the end of a commit batch
static int FLAG_COMMIT_ENTRY_IN_INIT
          Specifies that the commit entry is part of an init
static int FLAG_COMMIT_ENTRY_IS_PUT
          Specifies that the commit entry is for a put
static int FLAG_COMMIT_ENTRY_IS_REMOVE
          Specifies that the commit entry is for a remove
static int FLAG_COMMIT_ENTRY_IS_SEND
          Specifies that the commit entry is for a send
static int FLAG_COMMIT_ENTRY_IS_UPDATE
          Specifies that the commit entry is for an update
static int FLAG_COMMIT_START
          Specifies the beginning of a commit batch
static byte V1
           
static byte V2
           
static byte VERSION
           
 
Fields inherited from class com.neeve.pkt.PktSubheader
PREAMBLE_LENGTH, PREAMBLE_LENGTH_V1
 
Fields inherited from class com.neeve.util.UtlListElement
count, head, next, prev
 
Method Summary
 void copyObjectMetadataFrom(com.neeve.io.IOElasticBuffer metadata)
          Copy the object metadata (V1 Subheader Field) from a packet buffer.
 void copyObjectMetadataTo(PktBuffer buffer, int offset)
          Copy the object metadata (V1 Subheader Field) to a packet buffer.
 void copyPersisterMetadataFrom(com.neeve.io.IOElasticBuffer metadata)
          Copy the persister metadata (V2 Subheader Field) from a packet buffer.
 void copyPersisterMetadataTo(PktBuffer buffer, int offset)
          Copy the persister metadata (V2 Subheader Field) to a packet buffer.
static PktBody create()
          Create a default ODS subheader with the latest version
static PktBody create(Properties props)
          Create a latest version ODS subheader qualified by a property set
static PktBody create(short version)
          Creates a ODS subheader of a specific version
 int doGetInitialBufferLength()
          Invoked to fetch the initial buffer length of the body for non forked packet bodies The default implementation of this method invokes PktBody.doGetSerializedLength().
 int doGetSerializedLength()
          Invoked to fetch the serialized length of the body
 long getCheckpointVersion()
          Get the checkpoint version (V1 Subheader Field).
 short getCommitEntryType()
          Get the commit entry type (V1 Subheader Field).
 short getContentEncodingType()
          Get the contentEncodingType type(V1 Subheader Field).
 boolean getFlagCommitAckRequired()
          Get the 'commit ack required' flag (V1 Subheader Field).
 boolean getFlagCommitEnd()
          Get the 'commit end' flag (V1 Subheader Field).
 boolean getFlagCommitEntryInInit()
          Get the 'commit entry in INIT' flag (V1 Subheader Field).
 boolean getFlagCommitEntryIsPut()
          Get the 'commit entry is PUT' flag (V1 Subheader Field).
 boolean getFlagCommitEntryIsRemove()
          Get the 'commit entry is REMOVE' flag (V1 Subheader Field).
 boolean getFlagCommitEntryIsSend()
          Get the 'commit entry is SEND' flag (V1 Subheader Field).
 boolean getFlagCommitEntryIsUpdate()
          Get the 'commit entry is UPDATE' flag (V1 Subheader Field).
 boolean getFlagCommitStart()
          Get the 'commit start' flag (V1 Subheader Field).
 int getFlags()
          Get the flags (V1 Subheader Field).
static short getLatestSubheaderVersion()
          Get the latest subheader version.
 short getObjectFactoryId()
          Get the object factory id (V1 Subheader Field).
 com.eaio.uuid.UUID getObjectId()
          Get the object id (V1 Subheader Field).
 PktBuffer getObjectMetadata()
          Get the object metadata (V1 Subheader Field).
 short getObjectType()
          Get the object type (V1 Subheader Field).
 PktBuffer getPersisterMetadata()
          Get the persister metadata (V2 Subheader Field).
 int getSerializedLength(ByteBuffer buffer, int offset)
          Get the serialized length from the serialized form
 long getStableTransactionId()
          Get the stable transactionId (V1 Subheader Field).
 short getSubheaderVersion()
          Get the header format version (V1 Subheader Field).
 long getTimestamp()
          Get the persist timestamp (V1 Subheader Field).
 long getTransactionId()
          Get the transactionId (V1 Subheader Field).
 void initializeBuffer()
          Implementation of IOElasticBuffer.Initializer.initializeBuffer() The default implementation of this method is no-op.
static void prepare(PktPacket packet, com.eaio.uuid.UUID objectId, short ofid, short otype, short contentEncodingType, long transactionId, long stableTransactionId, long checkpointVersion, long timestamp, byte flags)
          Prepare a packet with an ODS subheader with latest version.
 int prepareForObjectMetadataCopy(int length)
          Prepare the object metadata for a copy
 void setCheckpointVersion(long checkpointVersion)
          Set the checkpoint version (V1 Subheader Field).
 void setCommitEntryType(short entryType)
          Set the commit entry type (V1 Subheader Field).
 void setContentEncodingType(short contentEncodingType)
          Set the contentEncodingType type (V1 Subheader Field).
 void setFlagCommitAckRequired(boolean val)
          Set the 'commit ack required' flag
 void setFlagCommitEnd(boolean val)
          Set the 'commit end' flag (V1 Subheader Field).
 void setFlagCommitEntryInInit(boolean val)
          Set the 'commit entry in INIT' flag
 void setFlagCommitEntryIsPut(boolean val)
          Set the 'commit entry is PUT' flag
 void setFlagCommitEntryIsRemove(boolean val)
          Set the 'commit entry is REMOVE' flag
 void setFlagCommitEntryIsSend(boolean val)
          Set the 'commit entry is SEND' flag
 void setFlagCommitEntryIsUpdate(boolean val)
          Set the 'commit entry is UPDATE' flag
 void setFlagCommitStart(boolean val)
          Set the 'commit start' flag
 void setFlags(byte flags)
          Set the flags (V1 Subheader Field).
 void setObjectFactoryId(short ofid)
          Set the object factory id (V1 Subheader Field).
 void setObjectId(com.eaio.uuid.UUID objectId)
          Set the object id (V1 Subheader Field).
 void setObjectType(short otype)
          Set the object type (V1 Subheader Field).
 void setStableTransactionId(long stableTransactionId)
          Set the stable transaction id (V1 Subheader Field).
 void setTimestamp(long timestamp)
          Set the persist timestamp (V1 Subheader Field).
 void setTransactionId(long transactionId)
          Set the transaction id (V1 Subheader Field).
 String toString()
          Returns a string representation of the object
 
Methods inherited from class com.neeve.pkt.PktSubheader
getType
 
Methods inherited from class com.neeve.pkt.PktBody
deserialize, deserialize, deserialize, deserialize, deserialize, deserialize, deserialize, dump, getBuffer, getInitialBufferLength, getSerializedLength, getType, isNative, reset, serialize, serialize, serialize, serialize, serialize, serialize, serialize
 
Methods inherited from class com.neeve.pkt.PktSerializable
deserialize, getDeserializationPolicy, getSerializationPolicy, isValidDeserializationPolicy, isValidSerializationPolicy, serialize, setDeserializationPolicy, setSerializationPolicy
 
Methods inherited from class com.neeve.util.UtlListElement
count, insertAfter, insertBefore, isLinked, next, previous, unlink, wipe
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

V1

public static final byte V1
See Also:
Constant Field Values

V2

public static final byte V2
See Also:
Constant Field Values

VERSION

public static final byte VERSION
See Also:
Constant Field Values

FLAG_COMMIT_START

public static final int FLAG_COMMIT_START
Specifies the beginning of a commit batch

See Also:
Constant Field Values

FLAG_COMMIT_END

public static final int FLAG_COMMIT_END
Specifies the end of a commit batch

See Also:
Constant Field Values

FLAG_COMMIT_ACK_REQUIRED

public static final int FLAG_COMMIT_ACK_REQUIRED
Specifies that a commit ack needs to be sent back

See Also:
Constant Field Values

FLAG_COMMIT_ENTRY_IS_PUT

public static final int FLAG_COMMIT_ENTRY_IS_PUT
Specifies that the commit entry is for a put

See Also:
Constant Field Values

FLAG_COMMIT_ENTRY_IS_UPDATE

public static final int FLAG_COMMIT_ENTRY_IS_UPDATE
Specifies that the commit entry is for an update

See Also:
Constant Field Values

FLAG_COMMIT_ENTRY_IS_REMOVE

public static final int FLAG_COMMIT_ENTRY_IS_REMOVE
Specifies that the commit entry is for a remove

See Also:
Constant Field Values

FLAG_COMMIT_ENTRY_IS_SEND

public static final int FLAG_COMMIT_ENTRY_IS_SEND
Specifies that the commit entry is for a send

See Also:
Constant Field Values

FLAG_COMMIT_ENTRY_IN_INIT

public static final int FLAG_COMMIT_ENTRY_IN_INIT
Specifies that the commit entry is part of an init

See Also:
Constant Field Values

ENTRY_TYPE_PUT

public static final short ENTRY_TYPE_PUT
Specifies that the entry is for a put

See Also:
Constant Field Values

ENTRY_TYPE_UPDATE

public static final short ENTRY_TYPE_UPDATE
Specifies that the entry is for an update

See Also:
Constant Field Values

ENTRY_TYPE_REMOVE

public static final short ENTRY_TYPE_REMOVE
Specifies that the entry is for a remove

See Also:
Constant Field Values

ENTRY_TYPE_SEND

public static final short ENTRY_TYPE_SEND
Specifies that the entry is for a send

See Also:
Constant Field Values

ENTRY_TYPE_MESSAGE

public static final short ENTRY_TYPE_MESSAGE
Specifies that the entry is for a message

See Also:
Constant Field Values
Method Detail

create

public static PktBody create(Properties props)
Create a latest version ODS subheader qualified by a property set

Parameters:
props - The property set to use to qualify creation of the body.

create

public static PktBody create()
Create a default ODS subheader with the latest version


create

public static PktBody create(short version)
Creates a ODS subheader of a specific version


prepare

public static void prepare(PktPacket packet,
                           com.eaio.uuid.UUID objectId,
                           short ofid,
                           short otype,
                           short contentEncodingType,
                           long transactionId,
                           long stableTransactionId,
                           long checkpointVersion,
                           long timestamp,
                           byte flags)
Prepare a packet with an ODS subheader with latest version.

Parameters:
packet - The packet to prepare.
objectId - The object id to set.
ofid - The object's factory id.
otype - The object's type.
contentEncodingType - The encoding type to set.
transactionId - The current transaction id.
stableTransactionId - The stable transaction id.
checkpointVersion - The checkpoint version.
flags - The flags to set.
Threading:
This method is not safe for concurrent access by multiple threads on the same request and reply.

getLatestSubheaderVersion

public static final short getLatestSubheaderVersion()
Get the latest subheader version.

This method returns the latest subheader version i.e. the version used when subheaders are created explicitly i.e. not through deserialization

Threading:
This method is safe for concurrent access by multiple threads

doGetSerializedLength

public final int doGetSerializedLength()
Description copied from class: PktBody
Invoked to fetch the serialized length of the body


getSerializedLength

public final int getSerializedLength(ByteBuffer buffer,
                                     int offset)
Description copied from class: PktSubheader
Get the serialized length from the serialized form

Specified by:
getSerializedLength in class PktSubheader

doGetInitialBufferLength

public final int doGetInitialBufferLength()
Description copied from class: PktBody
Invoked to fetch the initial buffer length of the body for non forked packet bodies

The default implementation of this method invokes PktBody.doGetSerializedLength(). The concrete body implementation should override this method in case it has a better estimate for the initial length of the backing buffer or if the doGetSerializedLength implementation uses the backing buffer to calculate serialized length (which is illegal per the PktBuffer contract).


getSubheaderVersion

public final short getSubheaderVersion()
Get the header format version (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads

setObjectId

public final void setObjectId(com.eaio.uuid.UUID objectId)
Set the object id (V1 Subheader Field).

Parameters:
objectId - The object id to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getObjectId

public final com.eaio.uuid.UUID getObjectId()
Get the object id (V1 Subheader Field).

NOTE:
If the packet that this header belongs to is pooled, the validity of the returned UUID is only valid while the packet remains, undisposed. Once the object is returned to its pool the UUID may be wiped and reused. Consequently, callers that plan to use the returned id beyond this objects lifespan should either make a copy of it, or aquire this object to prevent it from be returned to its pool.

Threading:
This method is not safe for concurrent access by multiple threads.

setObjectFactoryId

public final void setObjectFactoryId(short ofid)
Set the object factory id (V1 Subheader Field).

Parameters:
ofid - The object factory id to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getObjectFactoryId

public final short getObjectFactoryId()
Get the object factory id (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setObjectType

public final void setObjectType(short otype)
Set the object type (V1 Subheader Field).

Parameters:
otype - The object type to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getObjectType

public final short getObjectType()
Get the object type (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setContentEncodingType

public final void setContentEncodingType(short contentEncodingType)
Set the contentEncodingType type (V1 Subheader Field).

Parameters:
contentEncodingType - The encoding type to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getContentEncodingType

public final short getContentEncodingType()
Get the contentEncodingType type(V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setTimestamp

public final void setTimestamp(long timestamp)
Set the persist timestamp (V1 Subheader Field).

Parameters:
timestamp - The timestamp to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getTimestamp

public final long getTimestamp()
Get the persist timestamp (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setCommitEntryType

public final void setCommitEntryType(short entryType)
Set the commit entry type (V1 Subheader Field).

Parameters:
entryType - The commit entry type to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getCommitEntryType

public final short getCommitEntryType()
Get the commit entry type (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setTransactionId

public final void setTransactionId(long transactionId)
Set the transaction id (V1 Subheader Field).

Parameters:
transactionId - The transaction id to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getTransactionId

public final long getTransactionId()
Get the transactionId (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setStableTransactionId

public final void setStableTransactionId(long stableTransactionId)
Set the stable transaction id (V1 Subheader Field).

Parameters:
stableTransactionId - The stable transaction id to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getStableTransactionId

public final long getStableTransactionId()
Get the stable transactionId (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setCheckpointVersion

public final void setCheckpointVersion(long checkpointVersion)
Set the checkpoint version (V1 Subheader Field).

Parameters:
checkpointVersion - The checkpointVersion to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getCheckpointVersion

public final long getCheckpointVersion()
Get the checkpoint version (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setFlags

public final void setFlags(byte flags)
Set the flags (V1 Subheader Field).

Parameters:
flags - The flags to set.
Threading:
This method is not safe for concurrent access by multiple threads.

getFlags

public final int getFlags()
Get the flags (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads.

setFlagCommitStart

public final void setFlagCommitStart(boolean val)
Set the 'commit start' flag

Threading:
This method is not safe for concurrent access by multiple threads

getFlagCommitStart

public final boolean getFlagCommitStart()
Get the 'commit start' flag (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads

setFlagCommitEnd

public final void setFlagCommitEnd(boolean val)
Set the 'commit end' flag (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads

getFlagCommitEnd

public final boolean getFlagCommitEnd()
Get the 'commit end' flag (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads

setFlagCommitAckRequired

public final void setFlagCommitAckRequired(boolean val)
Set the 'commit ack required' flag

Threading:
This method is not safe for concurrent access by multiple threads

getFlagCommitAckRequired

public final boolean getFlagCommitAckRequired()
Get the 'commit ack required' flag (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads

setFlagCommitEntryIsPut

public final void setFlagCommitEntryIsPut(boolean val)
Set the 'commit entry is PUT' flag

Threading:
This method is not safe for concurrent access by multiple threads

getFlagCommitEntryIsPut

public final boolean getFlagCommitEntryIsPut()
Get the 'commit entry is PUT' flag (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads

setFlagCommitEntryIsUpdate

public final void setFlagCommitEntryIsUpdate(boolean val)
Set the 'commit entry is UPDATE' flag

Threading:
This method is not safe for concurrent access by multiple threads

getFlagCommitEntryIsUpdate

public final boolean getFlagCommitEntryIsUpdate()
Get the 'commit entry is UPDATE' flag (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads

setFlagCommitEntryIsRemove

public final void setFlagCommitEntryIsRemove(boolean val)
Set the 'commit entry is REMOVE' flag

Threading:
This method is not safe for concurrent access by multiple threads

getFlagCommitEntryIsRemove

public final boolean getFlagCommitEntryIsRemove()
Get the 'commit entry is REMOVE' flag (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads

setFlagCommitEntryIsSend

public final void setFlagCommitEntryIsSend(boolean val)
Set the 'commit entry is SEND' flag

Threading:
This method is not safe for concurrent access by multiple threads

getFlagCommitEntryIsSend

public final boolean getFlagCommitEntryIsSend()
Get the 'commit entry is SEND' flag (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads

setFlagCommitEntryInInit

public final void setFlagCommitEntryInInit(boolean val)
Set the 'commit entry in INIT' flag

Threading:
This method is not safe for concurrent access by multiple threads

getFlagCommitEntryInInit

public final boolean getFlagCommitEntryInInit()
Get the 'commit entry in INIT' flag (V1 Subheader Field).

Threading:
This method is not safe for concurrent access by multiple threads

copyObjectMetadataFrom

public final void copyObjectMetadataFrom(com.neeve.io.IOElasticBuffer metadata)
Copy the object metadata (V1 Subheader Field) from a packet buffer.

Threading:
This method is safe for concurrent access by multiple threads

prepareForObjectMetadataCopy

public final int prepareForObjectMetadataCopy(int length)
Prepare the object metadata for a copy

Parameters:
length - The expected length of the serialized metadata. This method will size the subheader accordingly to acccomodate metadata of the specified length. After return from this method, make sure the metadata copied is exactly the specified length. If more, it will corrupt fields succeeding the metadata in the subheader. If less, then the metadata will contain a portion of undefined data.
Returns:
Returns the offset into the buffer returned by getObjectMetadata() that marks the beginning of the metadata. The caller should serialize the metadata to the buffer returned by getObjectMetadata() starting at the offset returned by this method.

This method is intended for the use case where a user would like to directly serialize the metadata into the subheader. This method prepares the subheader for the copy operation. After making this call, the user should call getObjectMetadata() and serialize the metadata into the buffer returned by that method.

Threading:
This method is safe for concurrent access by multiple threads

getObjectMetadata

public final PktBuffer getObjectMetadata()
Get the object metadata (V1 Subheader Field).

The metadata returned by this method can be null.

Threading:
This method is safe for concurrent access by multiple threads

copyObjectMetadataTo

public final void copyObjectMetadataTo(PktBuffer buffer,
                                       int offset)
Copy the object metadata (V1 Subheader Field) to a packet buffer.

Threading:
This method is safe for concurrent access by multiple threads

copyPersisterMetadataFrom

public final void copyPersisterMetadataFrom(com.neeve.io.IOElasticBuffer metadata)
Copy the persister metadata (V2 Subheader Field) from a packet buffer.

Threading:
This method is safe for concurrent access by multiple threads

getPersisterMetadata

public final PktBuffer getPersisterMetadata()
Get the persister metadata (V2 Subheader Field).

The metadata returned by this method can be null.

Threading:
This method is safe for concurrent access by multiple threads

copyPersisterMetadataTo

public final void copyPersisterMetadataTo(PktBuffer buffer,
                                          int offset)
Copy the persister metadata (V2 Subheader Field) to a packet buffer.

Threading:
This method is safe for concurrent access by multiple threads

initializeBuffer

public final void initializeBuffer()
Description copied from class: PktBody
Implementation of IOElasticBuffer.Initializer.initializeBuffer()

The default implementation of this method is no-op. The concrete body implementation should override and implement this method if it needs to do buffer initialization.

Specified by:
initializeBuffer in interface com.neeve.io.IOElasticBuffer.Initializer
Overrides:
initializeBuffer in class PktBody

toString

public final String toString()
Returns a string representation of the object

Overrides:
toString in class Object
Threading:
This method is safe for concurrent access by multiple threads


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