./ct_report/coverage/mongoose_component_cets.COVER.html

1 -module(mongoose_component_cets).
2 -behaviour(mongoose_component_backend).
3
4 -export([init/1,
5 node_cleanup/1,
6 register_components/1,
7 unregister_components/1,
8 lookup_component/1,
9 lookup_component/2,
10 get_all_components/1]).
11
12 -include("external_component.hrl").
13 -define(TABLE, cets_external_component).
14
15 init(_) ->
16 33 cets:start(?TABLE, #{type => bag, keypos => 2}),
17 33 cets_discovery:add_table(mongoose_cets_discovery, ?TABLE).
18
19 node_cleanup(Node) ->
20
:-(
ets:match_delete(?TABLE, #external_component{node = Node, _ = '_'}),
21
:-(
ok.
22
23 register_components(Components) ->
24 28 cets:insert_many(?TABLE, Components),
25 28 ok.
26
27 unregister_components(Components) ->
28 28 cets:delete_objects(?TABLE, Components),
29 28 ok.
30
31 lookup_component(Domain) ->
32 341 ets:lookup(?TABLE, Domain).
33
34 lookup_component(Domain, Node) ->
35 311 ets:match_object(?TABLE, #external_component{domain = Domain, node = Node, _ = '_'}).
36
37 get_all_components(all) ->
38 43 MatchAll = {#external_component{ domain = '$1', _ = '_' }, [], ['$1']},
39 43 ets:select(?TABLE, [MatchAll]);
40 get_all_components(only_public) ->
41 36 MatchNonHidden = {#external_component{ domain = '$1', is_hidden = false, _ = '_' }, [], ['$1']},
42 36 ets:select(?TABLE, [MatchNonHidden]).
Line Hits Source