anchor.diff: +%% -------------------------------------------------------------------
  +%%
  +%% Copyright (c) 2016 Christopher Meiklejohn.  All Rights Reserved.
  +%% Copyright (c) 2022 Alejandro M. Ramallo. All Rights Reserved.
  +%%
  +%% This file is provided to you under the Apache License,
  +%% Version 2.0 (the "License"); you may not use this file
  +%% except in compliance with the License.  You may obtain
  +%% a copy of the License at
  +%%
  +%%   http://www.apache.org/licenses/LICENSE-2.0
  +%%
  +%% Unless required by applicable law or agreed to in writing,
  +%% software distributed under the License is distributed on an
  +%% "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  +%% KIND, either express or implied.  See the License for the
  +%% specific language governing permissions and limitations
  +%% under the License.
  +%%
  +%% -------------------------------------------------------------------
  +
  +%% -----------------------------------------------------------------------------
  +%% @doc Remote references are Partisan's representation for remote process
  +%% identifiers (`pid()'), registered names and references (`reference()').
  +%%
  +%% Distributed Erlang (disterl) will transform the representation of process
  +%% identifiers, registered names and references when they are sent to a remote
  +%% node. This is done to disambiguate between remote and local instances.
  +%% Because Partisan doesn't use disterl it needs to implement this same
  +%% disambiguation mechanism somehow. As disterl's implementation is done by the
  +%% BEAM internally and not API is exposed, this module is required to
  +%% achieve the same result.
  +%%
  +%% == Representation ==
  +%% This module provide two representation formats for remote identifiers (in
  +%% general, "references"): (i) a binary URI and; (ii) a tuple.
  +%%
  +%% The functions in this module will check which format to use by reading the
  +%% configuration parameter `remote_ref_as_uri'. If `true' they will return an
  +%% URI representation. Otherwise they will return a tuple representation.
  +%%
  +%% === URI Representation ===
  +%%
  +%% ==== URI Padding ====
  +%%
  +%% === Tuple Representation ===
  +%%
  +%% @end
  +%% -----------------------------------------------------------------------------
   -module(partisan_remote_ref).
   
   -include("partisan.hrl").
   
  --type t()               :: p() | r() | n().
  --type p()               :: remote_ref(process_ref()) | binary().
  --type r()               :: remote_ref(encoded_ref()) | binary().
  --type n()               :: remote_ref(registered_name_ref()) | binary().
  +-type t()               ::  p() | r() | n().
  +-type p()               ::  remote_ref(process_ref()) | uri().
  +-type r()               ::  remote_ref(encoded_ref()) | uri().
  +-type n()               ::  remote_ref(registered_name_ref()) | uri().
  +-type uri()             ::  <<_:64, _:_*8>>.
  +-type tuple_ref()       ::  remote_ref()
  +                            | process_ref()
  +                            | encoded_ref()
  +                            | registered_name_ref().
   
   -export_type([t/0]).
   -export_type([p/0]).
   -export_type([r/0]).
   -export_type([n/0]).
  +-export_type([uri/0]).
   
   
   -export([from_term/1]).
   -export([from_term/2]).
   -export([is_local/1]).
  +-export([is_local/2]).
   -export([is_name/1]).
   -export([is_pid/1]).
   -export([is_reference/1]).
   -export([is_type/1]).
   -export([node/1]).
   -export([nodestring/1]).
  +-export([target/1]).
   -export([to_term/1]).
   
   
  
positive.code: is_reference(<<"partisan:ref:", _/binary>>) ->
      true;
  
  is_reference({partisan_remote_reference, _, {Type, _}}) ->
      Type =:= partisan_encoded_reference;
  
  is_reference(_) ->
      false.
  
negative.code: is_name(<<"partisan:name:", _/binary>>) ->
      true;
  
  is_name({partisan_remote_reference, _, Term}) ->
      is_name(Term);
  
  is_name({partisan_registered_name_reference, _}) ->
      true;
  
  is_name(_) ->
      false.
  