[erlang-questions] PropEr and the symbolic variables

Aaron France <>
Tue Sep 17 18:10:10 CEST 2013


Hi all,

I'm creating a statem for a stateful system and am trying to model the 
various API calls.

Essentially the system is a PUT/DELETE rest service, you can PUT data 
which is forevermore available via a further GET call and you can also 
DELETE said data and subsequent GETs will fail.

This works well, mostly. However, I am not able to satisfactorily 
maintain what the state of the system is due to receiving symbolic 
variables in my next state function.

Basically I am recording the state as:

state{ dict() }

and the dict contains:

{ username => boolean() }. Where the boolean represents whether that 
user has data which is in the system.

The problem comes from the fact that my API calls return a status code 
for how the API call succeeded. Imagine deleting an already deleted 
piece of data, it would return e.g. a 404 instead of a 204. I model the 
state accordingly.

When I receive the `Res` argument to my next_state/3 function, it is 
only sometimes a concrete value which I need. However, I need to change 
the state conditionally according to what that `Res` value is.

Any ideas?

Aaron


More information about the erlang-questions mailing list