~ubuntu-branches/ubuntu/trusty/rabbitmq-server/trusty

« back to all changes in this revision

Viewing changes to src/rabbit_vhost.erl

  • Committer: Package Import Robot
  • Author(s): Emile Joubert
  • Date: 2013-05-28 11:15:13 UTC
  • mfrom: (0.5.3) (0.1.38 sid)
  • Revision ID: package-import@ubuntu.com-20130528111513-5j5kgypgx9mmwzse
Tags: 3.1.1-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
%%----------------------------------------------------------------------------
22
22
 
23
 
-export([add/1, delete/1, exists/1, list/0, with/2]).
 
23
-export([add/1, delete/1, exists/1, list/0, with/2, assert/1]).
24
24
-export([info/1, info/2, info_all/0, info_all/1]).
25
25
 
26
26
-ifdef(use_specs).
30
30
-spec(exists/1 :: (rabbit_types:vhost()) -> boolean()).
31
31
-spec(list/0 :: () -> [rabbit_types:vhost()]).
32
32
-spec(with/2 :: (rabbit_types:vhost(), rabbit_misc:thunk(A)) -> A).
 
33
-spec(assert/1 :: (rabbit_types:vhost()) -> 'ok').
33
34
 
34
35
-spec(info/1 :: (rabbit_types:vhost()) -> rabbit_types:infos()).
35
36
-spec(info/2 :: (rabbit_types:vhost(), rabbit_types:info_keys())
120
121
            end
121
122
    end.
122
123
 
 
124
%% Like with/2 but outside an Mnesia tx
 
125
assert(VHostPath) -> case rabbit_vhost:exists(VHostPath) of
 
126
                         true  -> ok;
 
127
                         false -> throw({error, {no_such_vhost, VHostPath}})
 
128
                     end.
 
129
 
123
130
%%----------------------------------------------------------------------------
124
131
 
125
132
infos(Items, X) -> [{Item, i(Item, X)} || Item <- Items].