igalshilman commented on a change in pull request #179:
URL: https://github.com/apache/flink-statefun/pull/179#discussion_r531157610



##########
File path: statefun-examples/statefun-python-walkthrough-example/walkthrough.py
##########
@@ -111,12 +115,29 @@ def state2(context, message):
     context.state('counter').pack(counter)
 
 
[email protected]("walkthrough/state_access_del")
[email protected](
+    typename="walkthrough/state_access_del",
+    states=[StateSpec("counter")])
 def state3(context, message):
     # state can be deleted easily by using the del keyword.
     del context['counter']
 
 
[email protected](
+    typename="walkthrough/missing_state",
+    states=[
+        StateSpec("counter"),
+        StateSpec("missing-state-1"),
+        StateSpec("missing-state-2", expiration=Expiration(10000)),
+        StateSpec("missing-state-3", expiration=Expiration(2000, 
expire_mode=Expiration.Mode.AFTER_WRITE))

Review comment:
       What do you think about simplifying a bit the expiration object?
   having to type the `expire_mode` is a bit too much, what do you think of:
   1) having separate Expiration classes for each mode.
   ```StateSpec("seen", expiration=AfterWrite(..))``
   ```StateSpec("age", expiration=AfterReadOrWrite(..)))```
   
   2) We use Python`s `timedelta` in `send_after` what do you think of using 
the same thing here?
   ```StateSpec("age", expiration=AfterWrite(timedelta(days=3)))```




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to