diff options
author | Adam Kocoloski <adam@cloudant.com> | 2010-07-14 14:49:22 -0400 |
---|---|---|
committer | Adam Kocoloski <adam@cloudant.com> | 2010-07-14 14:50:12 -0400 |
commit | 5c1c2422dcf9673d67681f999ece72a019461306 (patch) | |
tree | bada2a0ec7f639250eadfa75d0d82a8cf6c205cb /src/fabric_db_meta.erl | |
parent | 63330eb0bd922f504fb7b4111f98236879711288 (diff) |
support for revs_limit and security metadata
Diffstat (limited to 'src/fabric_db_meta.erl')
-rw-r--r-- | src/fabric_db_meta.erl | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/fabric_db_meta.erl b/src/fabric_db_meta.erl new file mode 100644 index 00000000..3b0ae109 --- /dev/null +++ b/src/fabric_db_meta.erl @@ -0,0 +1,30 @@ +-module(fabric_db_meta). + +-export([set_revs_limit/3, set_security/3]). + +-include("fabric.hrl"). +-include_lib("mem3/include/mem3.hrl"). + +set_revs_limit(DbName, Limit, Options) -> + Shards = mem3:shards(DbName), + Workers = fabric_util:submit_jobs(Shards, set_revs_limit, [Limit, Options]), + Waiting = length(Workers) - 1, + case fabric_util:recv(Workers, #shard.ref, fun handle_message/3, Waiting) of + {ok, ok} -> + ok; + Error -> + Error + end. + +set_security(DbName, SecObj, Options) -> + Shards = mem3:shards(DbName), + Workers = fabric_util:submit_jobs(Shards, set_security, [SecObj, Options]), + Waiting = length(Workers) - 1, + fabric_util:recv(Workers, #shard.ref, fun handle_message/3, Waiting). + +handle_message(ok, _, 0) -> + {stop, ok}; +handle_message(ok, _, Waiting) -> + {ok, Waiting - 1}; +handle_message(Error, _, _Waiting) -> + {error, Error}.
\ No newline at end of file |