Add geef_odb:write

This commit is contained in:
Carlos Martín Nieto
2013-03-30 14:19:05 +01:00
parent 5ee6b055e9
commit 125e132af9
7 changed files with 58 additions and 2 deletions

View File

@@ -1,8 +1,17 @@
-module(geef_odb).
-export([exists/2]).
-export([exists/2, write/3]).
-include("geef_records.hrl").
-spec exists(odb(), string()) -> boolean().
exists(#odb{handle=Handle}, Sha) ->
geef:odb_object_exists(Handle, Sha).
-spec write(odb(), iolist(), atom()) -> {ok, oid()} | {error, term}.
write(#odb{handle=Handle}, Contents, Type) ->
case geef:odb_write(Handle, Contents, Type) of
{ok, Oid} ->
{ok, #oid{oid=Oid}};
Other ->
Other
end.