anchor.diff:  
   %% States
   -export	([prepareOp/2, executeOp/2, finishOp/3, prepare_2PC/2, 
  -          receive_prepared/2, committing/2, receive_committed/2, abort/2, receive_aborted/2,
  -          reply_to_client/2]).
  -
  -
  -                                                %-record(operationCSI, {opType, key, params}).
  +		receive_prepared/2, committing/2, receive_committed/2, abort/2, receive_aborted/2,
  +		reply_to_client/2]).
  +
  +
  +%-record(operationCSI, {opType, key, params}).
   
   %%---------------------------------------------------------------------
   %% Data Type: state
  
positive.code: %% 	What delivery guarantees does sending messages provide?
  receive_committed(committed, S0=#state{num_to_ack= NumToAck}) ->
      case NumToAck of
          1 -> 
              lager:info("ClockSI: Finished collecting commit acks. Tx committed succesfully.~n"),
              {next_state, reply_to_client, S0#state{state=committed}, 0};
          _ ->
              lager:info("ClockSI: Keep collecting commit replies~n"),
              {next_state, receive_committed, S0#state{num_to_ack= NumToAck-1}}
      end.
  
  %% when an updated partition does not pass the certification check, the transaction
  %% aborts.
  abort(timeout, SD0=#state{txid=TxId, updated_partitions=UpdatedPartitions}) -> 
      clockSI_vnode:abort(UpdatedPartitions, TxId),
      NumToAck=lists:lenght(UpdatedPartitions),
      {next_state, receive_aborted, SD0#state{state=abort, num_to_ack=NumToAck}, 0};
  
  abort(abort, SD0=#state{txid=TxId, updated_partitions=UpdatedPartitions}) -> 
                                                  %TODO: Do not send to who issue the abort
      clockSI_vnode:abort(UpdatedPartitions, TxId),
      NumToAck=length(UpdatedPartitions),
      {next_state, receive_aborted, SD0#state{state=abort, num_to_ack=NumToAck}}.
  
  %%	the fsm waits for acks indicating that each partition has aborted the tx
  %%	and finishes operation.	
  receive_aborted(ack_abort, S0=#state{num_to_ack= NumToAck}) ->
      case NumToAck of 1 -> 
              lager:info("ClockSI-coord-fsm: Finished collecting abort acks. Tx aborted."),
              {next_state, reply_to_client, S0, 0};
          _ ->
              lager:info("ClockSI-coord-fsm: Keep collecting abort replies~n"),
              {next_state, receive_aborted, S0#state{num_to_ack= NumToAck-1}}
      end.
  
  %% when the transaction has committed or aborted, a reply is sent to the client
  %% that started the transaction.
  reply_to_client(timeout, SD=#state{from=From, txid=TxId, read_set=ReadSet, state=TxState, commit_time=CommitTime}) ->
      case TxState of
          committed->
              From ! {ok, {TxId, ReadSet, CommitTime}};
          aborted->
              From ! {abort, TxId};
          Reason->
              From ! {ok, TxId, Reason}
      end,
      {stop, normal, SD}.
  
  
  
  
  %% ====================================================================================
  
  handle_info(_Info, _StateName, StateData) ->
  
negative.code: %%		starting this transaction has seen, and
  %%	2. 	machine's local time, as returned by erlang:now(). 	
  get_snapshot_time(ClientClock) ->
  	{Megasecs, Secs, Microsecs}=erlang:now(), 
  	case (ClientClock > {Megasecs, Secs, Microsecs - ?DELTA}) of 
  		true->
  			%% should we wait until the clock of this machine catches up with this value?
  			{ClientMegasecs, ClientSecs, ClientMicrosecs}=ClientClock,
  			SnapshotTime = {ClientMegasecs, ClientSecs, ClientMicrosecs + ?MIN};
  
  		false ->
  			SnapshotTime = {Megasecs, Secs, Microsecs - ?DELTA}
  	end,
  	{ok, SnapshotTime}.
  