Get rid of the tagged OID

This means we no longer accept any iolist in some of the functions,
but we might bring it back later.

There is also a new function, geef_ref:create_symbolic() to create
symbolic references, since we can no longer differentiate between a
name and an OID.
This commit is contained in:
Carlos Martín Nieto
2013-09-03 20:26:57 +02:00
parent a400d3ca85
commit 0d24afb089
18 changed files with 58 additions and 138 deletions

View File

@@ -7,21 +7,20 @@
-include("geef_records.hrl").
-type oid() :: #geef_oid{oid :: binary()}.
-type oid() :: <<_:160>>.
-export_type([oid/0]).
-export([parse/1, hex/1]).
%% @doc Get a hex-encoded string of the hash
-spec hex(geef_oid:oid()) -> binary().
hex(#geef_oid{oid=Oid}) ->
hex(Oid) ->
geef_nif:oid_fmt(Oid).
%% @doc Parse an iolist as a hash
-spec parse(iolist() | binary()) -> geef_oid:oid().
-spec parse(iolist()) -> geef_oid:oid().
parse(Sha) ->
Oid = geef_nif:oid_parse(Sha),
#geef_oid{oid=Oid}.
geef_nif:oid_parse(Sha).
-ifdef(TEST).