8 Commits

Author SHA1 Message Date
Eric Mastro
c80e3e5e2c
[statemachine] fix allowance of multiple source states 2023-02-21 17:21:23 +11:00
Eric Mastro
b220f4198a
[statemachine] allow multiple source states in Transition
- multiple source states allowed in transition removed need for boilerplate subscription handling

TODO:
1. fix compilation for multiple transition source states
2. add tests for:
  - no transitioning to self
  - multiple source states in transition
3. Check how CancelledError gets caught in future callback
4. Remove Future[?State] from run return type?
2023-02-21 17:21:23 +11:00
Eric Mastro
8defc00bb0
[statemachine] WIP switch to declarative machine
- restoring and not restoring state both use the same setup for SalesAgent, by setting the SalesAgent’s state during instantiation, allowing it to react according to its state
- remove returning of next State from run (actual types yet to be changed)
- subscribe to onchain events, and use TransitionProperties to react (TODO: do not react from AnyState, but set to only states that make sense)
- create setError method in asyncstatemachine that handles setting of error properties
2023-02-21 17:21:23 +11:00
Mark Spanbroek
2035568b88
WIP switch to new statemachine model
Heavy work in progress, doesn't even compile yet,
this commit will be replaced by new cleaned up small commits

- callbacks are sync again
- agent.start(slots) is replaced by new state SaleStart
- disables explicit state transition tests for now; need to be replaced
2023-02-21 17:21:21 +11:00
Eric Mastro
03a87636e7
[marketplace] support slotIndex no longer optional
Previously, SalesAgent.slotIndex had been moved to not optional. However, there were still many places where optionality was assumed. This commit removes those assumuptions.
2023-02-14 13:47:53 +01:00
Eric Mastro
3db7b49537
[marketplace] handle slot filled by other host
Handle the case when in the downloading, proving, or filling states, that another host fills the slot.
2023-02-14 13:47:51 +01:00
Eric Mastro
0957c9adfa
PR comments
- add slotIndex to `SalesAgent` constructor
- remove `SalesAgent.init`
- rename `SalesAgent.init` to `start` and `SalesAgent.deinit` to `stop`.
- rename `SalesAgent. populateRequest` to `SalesAgent.retreiveRequest`.
- move availability removal to the downloading state. once availability is persisted to disk, it should survive node restarts.
-
2023-02-14 13:47:51 +01:00
Eric Mastro
67914249b6
[marketplace] move sale process to async state machine 2023-02-14 13:47:50 +01:00