diff options
Diffstat (limited to 'src/fabric.erl')
-rw-r--r-- | src/fabric.erl | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/fabric.erl b/src/fabric.erl index 3a4575bd..26b379af 100644 --- a/src/fabric.erl +++ b/src/fabric.erl @@ -2,7 +2,8 @@ -export([all_databases/1, create_db/2, delete_db/2, get_db_info/2, db_path/2]). --export([open_doc/3, open_revs/4, update_doc/3, update_docs/3]). +-export([open_doc/3, open_revs/4, get_missing_revs/2]). +-export([update_doc/3, update_docs/3]). -include("../../couch/src/couch_db.hrl"). @@ -34,6 +35,10 @@ open_doc(DbName, Id, Options) -> open_revs(DbName, Id, Revs, Options) -> fabric_doc:open_revs(dbname(DbName), docid(Id), Revs, Options). +get_missing_revs(DbName, IdsRevs) when is_list(IdsRevs) -> + Sanitized = [idrevs(IdR) || IdR <- IdsRevs], + fabric_doc:get_missing_revs(dbname(DbName), Sanitized). + update_doc(DbName, Doc, Options) -> {ok, [Result]} = update_docs(DbName, [Doc], Options), Result. @@ -70,6 +75,14 @@ doc({_} = Doc) -> doc(Doc) -> erlang:error({illegal_doc_format, Doc}). +idrevs({Id, Revs}) when is_list(Revs) -> + {docid(Id), [rev(R) || R <- Revs]}. + +rev(Rev) when is_list(Rev); is_binary(Rev) -> + couch_doc:parse_rev(Rev); +rev({Seq, Hash} = Rev) when is_integer(Seq), is_binary(Hash) -> + Rev. + generate_customer_path("/", _Customer) -> ""; generate_customer_path("/favicon.ico", _Customer) -> |