@Beta public class IntentData extends Object
Modifier | Constructor and Description |
---|---|
protected |
IntentData() |
|
IntentData(Intent intent,
IntentState state,
Timestamp version)
Deprecated.
in 1.11.0
|
Modifier and Type | Method and Description |
---|---|
static IntentData |
assign(IntentData data,
Timestamp timestamp,
NodeId node)
Creates updated IntentData after assigning task to a node.
|
static IntentData |
compiled(IntentData data,
List<Intent> installables)
Creates updated IntentData with compilation result.
|
static IntentData |
copy(IntentData data)
Creates a copy of given IntentData.
|
static IntentData |
copy(IntentData data,
Timestamp reqVersion)
Creates a copy of given IntentData, and update request version.
|
static IntentData |
corrupt(IntentData data)
Creates a copy of IntentData in corrupt state,
incrementing error count.
|
boolean |
equals(Object obj) |
int |
errorCount()
Returns the number of times that this intent has encountered an error
during installation or withdrawal.
|
int |
hashCode() |
void |
incrementErrorCount()
Increments the error count for this intent.
|
List<Intent> |
installables()
Returns the installables associated with this intent.
|
Intent |
intent()
Returns the intent this metadata references.
|
int |
internalStateVersion() |
static boolean |
isUpdateAcceptable(IntentData currentData,
IntentData newData)
Determines whether an intent data update is allowed.
|
Key |
key()
Returns the intent key.
|
static IntentData |
nextState(IntentData data,
IntentState nextState)
Create a copy of IntentData in next state.
|
NodeId |
origin()
Returns the origin node that created this intent.
|
static IntentData |
purge(Intent intent)
Creates IntentData for Intent purge request.
|
IntentState |
request() |
void |
setErrorCount(int newCount)
Sets the error count for this intent.
|
void |
setState(IntentState newState)
Updates the state of the intent to the given new state.
|
IntentState |
state()
Returns the state of the intent.
|
static IntentData |
submit(Intent intent)
Creates IntentData for Intent submit request.
|
String |
toString() |
Timestamp |
version()
Returns the request version of the intent for this key.
|
static IntentData |
withdraw(Intent intent)
Creates IntentData for Intent withdraw request.
|
@Deprecated public IntentData(Intent intent, IntentState state, Timestamp version)
intent
- intent this metadata referencesstate
- intent stateversion
- version of the intent for this keyprotected IntentData()
public static IntentData submit(Intent intent)
intent
- to requestpublic static IntentData withdraw(Intent intent)
intent
- to requestpublic static IntentData purge(Intent intent)
intent
- to requestpublic static IntentData assign(IntentData data, Timestamp timestamp, NodeId node)
data
- IntentData to update work assignmenttimestamp
- to assign to current requestnode
- node which was assigned to handle this request (local node id)public static IntentData copy(IntentData data)
data
- intent data to copypublic static IntentData copy(IntentData data, Timestamp reqVersion)
data
- intent data to copyreqVersion
- request version to be updatedpublic static IntentData nextState(IntentData data, IntentState nextState)
data
- intent data to copynextState
- to transition topublic static IntentData corrupt(IntentData data)
data
- intent data to copypublic static IntentData compiled(IntentData data, List<Intent> installables)
data
- IntentData to updateinstallables
- compilation resultpublic Intent intent()
public IntentState state()
public IntentState request()
public Key key()
public Timestamp version()
public int internalStateVersion()
public NodeId origin()
public void setState(IntentState newState)
newState
- new state of the intentpublic void incrementErrorCount()
public void setErrorCount(int newCount)
newCount
- new countpublic int errorCount()
public List<Intent> installables()
public static boolean isUpdateAcceptable(IntentData currentData, IntentData newData)
currentData
- existing intent data in the storenewData
- new intent data update proposal