1 |
|
%% Copyright (c) 2022 Peter Morgan <peter.james.morgan@gmail.com> |
2 |
|
%% |
3 |
|
%% Licensed under the Apache License, Version 2.0 (the "License"); |
4 |
|
%% you may not use this file except in compliance with the License. |
5 |
|
%% You may obtain a copy of the License at |
6 |
|
%% |
7 |
|
%% http://www.apache.org/licenses/LICENSE-2.0 |
8 |
|
%% |
9 |
|
%% Unless required by applicable law or agreed to in writing, software |
10 |
|
%% distributed under the License is distributed on an "AS IS" BASIS, |
11 |
|
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 |
|
%% See the License for the specific language governing permissions and |
13 |
|
%% limitations under the License. |
14 |
|
|
15 |
|
|
16 |
|
-module(pgec_pg). |
17 |
|
|
18 |
|
|
19 |
|
-export([get_members/1]). |
20 |
|
-export([join/1]). |
21 |
|
-export([leave/1]). |
22 |
|
-export([which_groups/0]). |
23 |
|
-include_lib("kernel/include/logger.hrl"). |
24 |
|
|
25 |
|
|
26 |
|
leave(Group) -> |
27 |
:-( |
?LOG_DEBUG(#{group => Group}), |
28 |
:-( |
pg:leave(pgec_util:scope(), Group, self()). |
29 |
|
|
30 |
|
|
31 |
|
join(Group) -> |
32 |
:-( |
?LOG_DEBUG(#{group => Group}), |
33 |
:-( |
pg:join(pgec_util:scope(), Group, self()). |
34 |
|
|
35 |
|
|
36 |
|
get_members(Group) -> |
37 |
8 |
Scope = pgec_util:scope(), |
38 |
8 |
?LOG_DEBUG(#{scope => Scope, group => Group}), |
39 |
8 |
pg:get_members(Scope, Group). |
40 |
|
|
41 |
|
|
42 |
|
which_groups() -> |
43 |
8 |
Scope = pgec_util:scope(), |
44 |
8 |
?LOG_DEBUG(#{scope => Scope}), |
45 |
8 |
pg:which_groups(Scope). |