anchor.diff:      -define(PERSISTENCE, disc_copies).
   -endif.
   
  +-define(TO_SUB_ID(Filter,ClientId),(<<Filter/binary,ClientId/binary>>)).
   -define(SUB_RECORD, mqtt_sub).
   -define(SUB_REG_RECORD, mqtt_sub_reg).
   -define(ALL_TABLES,[?SUB_RECORD,?SUB_REG_RECORD]).
  
positive.code: %% @end
  
  -spec save_sub(ClientId::client_id(),
      {
          Filter::binary(),
          QoS::qos(),
          Seq::integer(),
          ClientPid::pid()}
  ) ->
      {ok,Result::any()}.
  
  save_sub(Filter,{ClientId,QoS,CSeq,ClientPid}) ->
      Fun =
          fun() ->
               R = #mqtt_sub{id = {Filter,ClientId},
                             filter = Filter,
                             client_id = ClientId,
                             cseq = CSeq,
  
negative.code: remove_sub(Filter,ClientId) ->
      Fun =
          fun() ->
              mnesia:delete({?SUB_RECORD,?TO_SUB_ID(Filter,ClientId)})
          end,
      mnesia_do(Fun).
  
  