Class TaskId
java.lang.Object
dev.getelements.elements.sdk.cluster.id.TaskId
- All Implemented Interfaces:
HasNodeId
,Serializable
,Comparable<dev.getelements.elements.sdk.cluster.id.HasCompoundId<dev.getelements.elements.sdk.cluster.id.V1CompoundId>>
Represents a globally-unique id of a task, associated with a resource. This is currently backed by an
instance of
UUID
, but the string representation should be considered opaque by users of this type.
Though the ResourceId is may be globally represented by a single UUID, for addressment we represent a TaskId with a
4-tuple of UUIDs: (InstanceUuid, ApplicationUuid, ResourceUuid, TaskUuid). I.e. there may multiple Tasks for a
Resource, multiple Resources for an Application, multiple Applications for an Instance, and multiple Instances in a
deployment.
By convention, we may represent the TaskId as a compound Id string, combining the string representation of the
ResourceId
with the string representation of the TaskId's UUID, separated by the ID_SEPARATOR. Such a
string will take the form "{instance_uuid}.{app_uuid}+{resource_uuid}:{task_uuid}".- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionTaskId
(byte[] byteRepresentation) TaskId
(ResourceId resourceId) Creates a new uniqueTaskId
.Creates theTaskId
from the provided string representation, as obtained fromasString()
. -
Method Summary
Modifier and TypeMethodDescriptionbyte[]
asBytes()
Returns theinvalid reference
byte[]
TaskId
asString()
Returns the string representation of thisTaskId
default int
compareTo
(dev.getelements.elements.sdk.cluster.id.HasCompoundId<dev.getelements.elements.sdk.cluster.id.V1CompoundId> o) Compares this instance with the other instance.boolean
dev.getelements.elements.sdk.cluster.id.V1CompoundId
getId()
Returns theResourceId
attached to thisTaskId
static int
Gets the size of theTaskId
in bytes.int
hashCode()
static TaskId
taskIdFromByteBuffer
(ByteBuffer byteBufferRepresentation, int byteBufferPosition) Reads aTaskId
from the suppliedByteBuffer
and position, ensuring that the buffer's mark, limit, and position are unaffected.void
toByteBuffer
(ByteBuffer byteBuffer) Writes thisTaskId
to the suppliedByteBuffer
.void
toByteBuffer
(ByteBuffer byteBuffer, int position) Writes thisTaskId
to aByteBuffer
at the supplied position.toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface dev.getelements.elements.sdk.cluster.id.HasNodeId
getOptionalNodeId
-
Constructor Details
-
TaskId
Creates a new uniqueTaskId
. -
TaskId
Creates theTaskId
from the provided string representation, as obtained fromasString()
.- Parameters:
stringRepresentation
- the string representation
-
TaskId
public TaskId(byte[] byteRepresentation) - Parameters:
byteRepresentation
- the string representation
-
-
Method Details
-
getId
public dev.getelements.elements.sdk.cluster.id.V1CompoundId getId() -
getNodeId
-
getResourceId
Returns theResourceId
attached to thisTaskId
- Returns:
- the
ResourceId
attached to thisTaskId
-
asBytes
public byte[] asBytes()Returns theinvalid reference
byte[]
TaskId
- Returns:
-
asString
Returns the string representation of thisTaskId
- Returns:
- the string representation
-
toByteBuffer
Writes thisTaskId
to the suppliedByteBuffer
.- Parameters:
byteBuffer
- theByteBuffer
to receive theTaskId
-
toByteBuffer
Writes thisTaskId
to aByteBuffer
at the supplied position. As the position is specified, this does not affect the buffer's mark, limit, position.- Parameters:
byteBuffer
- the byteBuffer to receive theTaskId
position
- the position at which to write the byte buffer
-
taskIdFromByteBuffer
public static TaskId taskIdFromByteBuffer(ByteBuffer byteBufferRepresentation, int byteBufferPosition) Reads aTaskId
from the suppliedByteBuffer
and position, ensuring that the buffer's mark, limit, and position are unaffected.- Parameters:
byteBufferRepresentation
- the byte buffer to readbyteBufferPosition
- the position of the node id within the byte buffer- Returns:
- the
TaskId
instance
-
equals
-
hashCode
public int hashCode() -
toString
-
getSizeInBytes
public static int getSizeInBytes()Gets the size of theTaskId
in bytes.- Returns:
- the size, in bytes
-
compareTo
default int compareTo(dev.getelements.elements.sdk.cluster.id.HasCompoundId<dev.getelements.elements.sdk.cluster.id.V1CompoundId> o) Compares this instance with the other instance.- Specified by:
compareTo
in interfaceComparable<CompoundIdT extends Comparable<CompoundIdT>>
- Parameters:
o
- the instance- Returns:
-