|
54 | 54 | -export([const/1]).
|
55 | 55 | -export([ntoa/1, ntoab/1]).
|
56 | 56 | -export([is_process_alive/1]).
|
57 |
| --export([pget/2, pget/3, pget_or_die/2, pset/3]). |
| 57 | +-export([pget/2, pget/3, pget_or_die/2, pmerge/3, pset/3]). |
58 | 58 | -export([format_message_queue/2]).
|
59 | 59 | -export([append_rpc_all_nodes/4]).
|
60 | 60 | -export([os_cmd/1]).
|
|
227 | 227 | -spec(pget/2 :: (term(), [term()]) -> term()).
|
228 | 228 | -spec(pget/3 :: (term(), [term()], term()) -> term()).
|
229 | 229 | -spec(pget_or_die/2 :: (term(), [term()]) -> term() | no_return()).
|
| 230 | +-spec(pmerge/3 :: (term(), term(), [term()]) -> term()). |
230 | 231 | -spec(pset/3 :: (term(), term(), [term()]) -> term()).
|
231 | 232 | -spec(format_message_queue/2 :: (any(), priority_queue:q()) -> term()).
|
232 | 233 | -spec(append_rpc_all_nodes/4 :: ([node()], atom(), atom(), [any()]) -> [any()]).
|
@@ -882,6 +883,12 @@ pget_or_die(K, P) ->
|
882 | 883 | V -> V
|
883 | 884 | end.
|
884 | 885 |
|
| 886 | +pmerge(Key, Val, List) -> |
| 887 | + case proplists:is_defined(Key, List) of |
| 888 | + true -> List; |
| 889 | + _ -> [{Key, Val} | List] |
| 890 | + end. |
| 891 | + |
885 | 892 | pset(Key, Value, List) -> [{Key, Value} | proplists:delete(Key, List)].
|
886 | 893 |
|
887 | 894 | format_message_queue(_Opt, MQ) ->
|
|
0 commit comments