Namespace the records

This makes it useful for users of the bindings. The naming is the same
as the module to allow elixir to treat the records in much the same
way as its native module/record hybrid.
This commit is contained in:
Carlos Martín Nieto
2013-05-13 10:55:18 +02:00
parent cc8124a6b9
commit 4a2f2e8ab2
12 changed files with 83 additions and 92 deletions

View File

@@ -8,18 +8,18 @@
-export([lookup/2, id/1, size/1, content/1]).
-spec lookup(repo(), oid() | iolist()) -> object().
-spec lookup(pid(), geef_oid() | iolist()) -> geef_object().
lookup(Repo, Id) ->
geef_object:lookup(Repo, Id, blob).
-spec id(object()) -> oid().
id(Obj = #object{type=blob}) ->
-spec id(geef_object()) -> geef_oid().
id(Obj = #geef_object{type=blob}) ->
geef_object:id(Obj).
size(#object{type=blob, handle=Handle}) ->
size(#geef_object{type=blob, handle=Handle}) ->
geef_nif:blob_size(Handle).
content(#object{type=blob, handle=Handle}) ->
content(#geef_object{type=blob, handle=Handle}) ->
{ok, Content} = geef_nif:blob_content(Handle),
Content.