anchor.diff:      elements(?STREAMNAMES).
   
   % Return any of the existing StreamID
  -% plus an unassgined one for testing
   streamid(#state{counter = Counter}) ->
       elements(lists:seq(1, Counter+1)).
   
  
positive.code:         {call,?MODULE,request_stream_with_size,[pos_integer(),streamname()]},
  %        {call,?MODULE,append,[streamid(S),list(integer(32,255))]},
          {call,?MODULE,append,[streamid(S),"AAAAAA"]},
          {call,?MODULE,simple_query,[streamid(S),S#state.starttime,timestamp_wrapper()]},
          {call,?MODULE,all_since,[streamid(S),S#state.starttime]},
          {call,?MODULE,last_entry_at,[streamid(S),timestamp_wrapper()]}
      ]).
  
  % define when a command is valid
  precondition(_S, _Command) ->
      true.
  
  % define the state transitions triggered
  % by each command
  next_state(S,{ok,<<_,ID>>},{call,?MODULE,request_stream_with_size,[_Size,StreamName]}) ->
      case lists:keymember(StreamName,2,S#state.streams) of
          false ->
  
negative.code:     tcp_query(?HOST,?PORT,packet(?APPEND,Message)).
  
  simple_query(StreamID,Start,End) ->
      timer:sleep(?TIMEOUT),
      Message = list_to_binary([ <<StreamID:16>>, Start, End]),
      tcp_query(?HOST,?PORT,packet(?QUERY,Message)).
  
  