wenjin272 commented on code in PR #311:
URL: https://github.com/apache/flink-agents/pull/311#discussion_r2533652026
##########
api/src/main/java/org/apache/flink/agents/api/context/MemoryRef.java:
##########
@@ -47,12 +47,12 @@ public static MemoryRef create(String path) {
/**
* Resolves the reference using the provided RunnerContext to get the
actual data.
*
- * @param ctx The current execution context, used to access Short-Term
Memory.
+ * @param memory The memory this ref based on.
* @return The deserialized, original data object.
* @throws Exception if the memory cannot be accessed or the data cannot
be resolved.
*/
- public MemoryObject resolve(RunnerContext ctx) throws Exception {
- return ctx.getShortTermMemory().get(this);
+ public MemoryObject resolve(MemoryObject memory) throws Exception {
Review Comment:
This is a syntactic sugar that user can use it to get the `MemoryObject`
the `MemoryRef` referred to. User could use it in action.
Currently, in example, we use
```
MemoryObject stm = ctx.getShortTermMemory();
ItemData originalData = (ItemData) stm.get(itemRef).getValue();
```
which is equal to
```
MemoryObject stm = ctx.getShortTermMemory();
ItemData originalData = (ItemData)
itemRef.resolve(ctx.getShortTermMemory()).getValue();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]