Shuffle some types

Put types in the modules they belong to instead of including them in
each one from the header.
This commit is contained in:
Carlos Martín Nieto
2013-08-31 14:43:25 +02:00
parent dea88e5a59
commit b04809ca59
15 changed files with 78 additions and 50 deletions

View File

@@ -6,9 +6,14 @@
-include("geef_records.hrl").
-type object() :: #geef_object{type :: blob | tree | commit | tag}.
-type object(Type) :: #geef_object{type :: Type}.
-export_type([object/0, object/1]).
-export([lookup/2, lookup/3]).
-spec lookup(pid(), geef_oid() | iolist()) -> {ok, geef_object()} | {error, term()}.
-spec lookup(pid(), geef_oid:oid() | iolist()) -> {ok, object()} | {error, term()}.
lookup(Repo, Id = #geef_oid{oid=Oid}) ->
case geef_repo:lookup_object(Repo, Oid) of
{ok, Type, Handle} ->
@@ -20,7 +25,7 @@ lookup(Repo, Id) ->
lookup(Repo, geef_oid:parse(Id)).
%% As lookup/2, but it asserts that the type is correct
-spec lookup(pid(), geef_oid() | iolist(), atom()) -> {ok, geef_object()} | {error, term()}.
-spec lookup(pid(), geef_oid:oid() | iolist(), atom()) -> {ok, object()} | {error, term()}.
lookup(Repo, Id, Type) ->
case lookup(Repo, Id) of
{ok, Obj = #geef_object{type=Type}} ->