Record Class NetworkMeshResult
java.lang.Object
java.lang.Record
com.tnsai.coordination.groups.network.NetworkMeshResult
- Record Components:
taskId- task identifiersuccess- whether the operation succeededoutput- aggregated outputresponses- individual agent responsesroutePath- route taken for routed messagesstartedAt- start timecompletedAt- completion timeerror- error message if failed
public record NetworkMeshResult(String taskId, boolean success, String output, Map<String,String> responses, List<String> routePath, Instant startedAt, Instant completedAt, String error)
extends Record
Result of a network mesh operation (broadcast, route, etc.).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thecompletedAtrecord component.final booleanIndicates whether some other object is "equal to" this one.error()Returns the value of theerrorrecord component.static NetworkMeshResultCreates a failed result.Gets execution duration.final inthashCode()Returns a hash code value for this object.output()Returns the value of theoutputrecord component.Returns the value of theresponsesrecord component.Returns the value of theroutePathrecord component.Returns the value of thestartedAtrecord component.booleansuccess()Returns the value of thesuccessrecord component.static NetworkMeshResultsuccess(String taskId, String output, Map<String, String> responses, List<String> routePath, Instant startedAt) Creates a successful result.taskId()Returns the value of thetaskIdrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
NetworkMeshResult
public NetworkMeshResult(String taskId, boolean success, String output, Map<String, String> responses, List<String> routePath, Instant startedAt, Instant completedAt, String error) Creates an instance of aNetworkMeshResultrecord class.- Parameters:
taskId- the value for thetaskIdrecord componentsuccess- the value for thesuccessrecord componentoutput- the value for theoutputrecord componentresponses- the value for theresponsesrecord componentroutePath- the value for theroutePathrecord componentstartedAt- the value for thestartedAtrecord componentcompletedAt- the value for thecompletedAtrecord componenterror- the value for theerrorrecord component
-
-
Method Details
-
success
public static NetworkMeshResult success(String taskId, String output, Map<String, String> responses, List<String> routePath, Instant startedAt) Creates a successful result.- Parameters:
taskId- task IDoutput- outputresponses- agent responsesroutePath- route takenstartedAt- start time- Returns:
- successful result
-
failure
Creates a failed result.- Parameters:
taskId- task IDerror- error messagestartedAt- start time- Returns:
- failed result
-
getDuration
Gets execution duration.- Returns:
- duration
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
taskId
Returns the value of thetaskIdrecord component.- Returns:
- the value of the
taskIdrecord component
-
success
public boolean success()Returns the value of thesuccessrecord component.- Returns:
- the value of the
successrecord component
-
output
Returns the value of theoutputrecord component.- Returns:
- the value of the
outputrecord component
-
responses
Returns the value of theresponsesrecord component.- Returns:
- the value of the
responsesrecord component
-
routePath
Returns the value of theroutePathrecord component.- Returns:
- the value of the
routePathrecord component
-
startedAt
Returns the value of thestartedAtrecord component.- Returns:
- the value of the
startedAtrecord component
-
completedAt
Returns the value of thecompletedAtrecord component.- Returns:
- the value of the
completedAtrecord component
-
error
Returns the value of theerrorrecord component.- Returns:
- the value of the
errorrecord component
-