Package io.aeron.command
Class StaticCounterMessageFlyweight
java.lang.Object
io.aeron.command.CorrelatedMessageFlyweight
io.aeron.command.StaticCounterMessageFlyweight
Message to get or create a new static counter.
Note: Layout should be SBE 2.0 compliant so that the label length is aligned.
-
Field Summary
Fields inherited from class io.aeron.command.CorrelatedMessageFlyweight
LENGTH -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcomputeLength(int keyLength, int labelLength) Compute the length of the command message given key and label length.keyBuffer(DirectBuffer keyBuffer, int keyOffset, int keyLength) Fill the key buffer.intLength of the key buffer in bytes.intRelative offset of the key buffer.Fill the label.labelBuffer(DirectBuffer labelBuffer, int labelOffset, int labelLength) Fill the label buffer.intLength of label buffer in bytes.intRelative offset of label buffer.intlength()Get the length of the current message.longGet registration id field.registrationId(long registrationId) Set counter registration id field.toString()inttypeId()Get type id field.typeId(int typeId) Set counter type id field.voidvalidateLength(int msgTypeId, int length) Validate buffer length is long enough for message.wrap(MutableDirectBuffer buffer, int offset) Wrap the buffer at a given offset for updates.Methods inherited from class io.aeron.command.CorrelatedMessageFlyweight
clientId, clientId, correlationId, correlationId
-
Constructor Details
-
StaticCounterMessageFlyweight
public StaticCounterMessageFlyweight()
-
-
Method Details
-
wrap
Wrap the buffer at a given offset for updates.- Overrides:
wrapin classCorrelatedMessageFlyweight- Parameters:
buffer- to wrap.offset- at which the message begins.- Returns:
- this for a fluent API.
-
registrationId
public long registrationId()Get registration id field.- Returns:
- registration id field.
-
registrationId
Set counter registration id field.- Parameters:
registrationId- field value.- Returns:
- this for a fluent API.
-
typeId
public int typeId()Get type id field.- Returns:
- type id field.
-
typeId
Set counter type id field.- Parameters:
typeId- field value.- Returns:
- this for a fluent API.
-
keyBufferOffset
public int keyBufferOffset()Relative offset of the key buffer.- Returns:
- relative offset of the key buffer.
-
keyBufferLength
public int keyBufferLength()Length of the key buffer in bytes.- Returns:
- length of key buffer in bytes.
-
keyBuffer
public StaticCounterMessageFlyweight keyBuffer(DirectBuffer keyBuffer, int keyOffset, int keyLength) Fill the key buffer.- Parameters:
keyBuffer- containing the optional key for the counter.keyOffset- within the keyBuffer at which the key begins.keyLength- of the key in the keyBuffer.- Returns:
- this for a fluent API.
-
labelBufferOffset
public int labelBufferOffset()Relative offset of label buffer.- Returns:
- relative offset of label buffer.
-
labelBufferLength
public int labelBufferLength()Length of label buffer in bytes.- Returns:
- length of label buffer in bytes.
-
labelBuffer
public StaticCounterMessageFlyweight labelBuffer(DirectBuffer labelBuffer, int labelOffset, int labelLength) Fill the label buffer.- Parameters:
labelBuffer- containing the mandatory label for the counter.labelOffset- within the labelBuffer at which the label begins.labelLength- of the label in the labelBuffer.- Returns:
- this for a fluent API.
-
label
Fill the label.- Parameters:
label- for the counter.- Returns:
- this for a fluent API.
-
length
public int length()Get the length of the current message.NB: must be called after the data is written in order to be accurate.
- Returns:
- the length of the current message
-
validateLength
public void validateLength(int msgTypeId, int length) Validate buffer length is long enough for message.- Overrides:
validateLengthin classCorrelatedMessageFlyweight- Parameters:
msgTypeId- type of message.length- of message in bytes to validate.
-
computeLength
public static int computeLength(int keyLength, int labelLength) Compute the length of the command message given key and label length.- Parameters:
keyLength- to be appended.labelLength- to be appended.- Returns:
- the length of the command message given key and label length.
-
toString
-