anchor.diff:          postcondition/3, next_state/3, diff/2, sum/2, timestamp/0]).
   
   -define(DRIVER, cakedb_driver).
  -
  +-define(TIMEOUT, 1000). % milliseconds
   -define(STREAMNAMES, ["tempfile", "file001", "anotherfile",
           "somefile", "binfile", "cakestream"]).
   
  
positive.code:             NewTuple = {StreamName,[{timestamp(),Data}]},
              S#state{streams = [NewTuple|S#state.streams]}
      end;
  next_state(S,_V,{call,?DRIVER,range_query,[StreamName,_Start,_End]}) ->
      case lists:keysearch(StreamName,1,S#state.streams) of
          {value, {StreamName,_Data}} ->
              S;
          false ->
              S#state{streams = [{StreamName,[]}|S#state.streams]}
      end;
  next_state(S,_V,{call,?DRIVER,all_since,[StreamName,_TS]}) ->
      case lists:keysearch(StreamName,1,S#state.streams) of
          {value, {StreamName,_Data}} ->
              S;
          false ->
              S#state{streams = [{StreamName,[]}|S#state.streams]}
      end;
  next_state(S,_V,{call,?DRIVER,last_entry_at,[StreamName,_TS]}) ->
      case lists:keysearch(StreamName,1,S#state.streams) of
          {value, {StreamName,_Data}} ->
              S;
  
negative.code: 
  % Returns a symbolic call to one of the driver's functions
  symb_call(Function, StreamName, MinTime) ->
      Now = {call, ?MODULE, timestamp, []},
      Diff = {call, ?MODULE, diff, [Now, MinTime]},
      Rand = {call, random, uniform, [Diff]},
      TS = {call, ?MODULE, sum, [MinTime, Rand]},
      case Function of
          range_query ->
              Diff2 = {call, ?MODULE, diff, [Now, TS]},
              Rand2 = {call, random, uniform, [Diff2]},
              TS2 = {call, ?MODULE, sum, [TS, Rand2]},
              {call, ?DRIVER, range_query, [StreamName, TS, TS2]};
          _ -> % all_since and last_entry_at
              {call, ?DRIVER, Function, [StreamName, TS]}
      end.
  
  