chore: sync diverged modules modules from ee back to ce
This commit is contained in:
parent
1e90ef428f
commit
f24728ee7b
|
@ -1,6 +1,6 @@
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
"name": "mongo",
|
"name": "mongo_single",
|
||||||
"listen": "0.0.0.0:27017",
|
"listen": "0.0.0.0:27017",
|
||||||
"upstream": "mongo:27017",
|
"upstream": "mongo:27017",
|
||||||
"enabled": true
|
"enabled": true
|
||||||
|
|
|
@ -686,7 +686,7 @@ heal_failure(FailureType, ProxyHost, ProxyPort) ->
|
||||||
end.
|
end.
|
||||||
|
|
||||||
switch_proxy(Switch, ProxyHost, ProxyPort) ->
|
switch_proxy(Switch, ProxyHost, ProxyPort) ->
|
||||||
Url = "http://" ++ ProxyHost ++ ":" ++ integer_to_list(ProxyPort) ++ "/proxies/mongo",
|
Url = "http://" ++ ProxyHost ++ ":" ++ integer_to_list(ProxyPort) ++ "/proxies/mongo_single",
|
||||||
Body = case Switch of
|
Body = case Switch of
|
||||||
off -> <<"{\"enabled\":false}">>;
|
off -> <<"{\"enabled\":false}">>;
|
||||||
on -> <<"{\"enabled\":true}">>
|
on -> <<"{\"enabled\":true}">>
|
||||||
|
@ -695,27 +695,27 @@ switch_proxy(Switch, ProxyHost, ProxyPort) ->
|
||||||
[{body_format, binary}]).
|
[{body_format, binary}]).
|
||||||
|
|
||||||
timeout_proxy(on, ProxyHost, ProxyPort) ->
|
timeout_proxy(on, ProxyHost, ProxyPort) ->
|
||||||
Url = "http://" ++ ProxyHost ++ ":" ++ integer_to_list(ProxyPort) ++ "/proxies/mongo/toxics",
|
Url = "http://" ++ ProxyHost ++ ":" ++ integer_to_list(ProxyPort) ++ "/proxies/mongo_single/toxics",
|
||||||
Body = <<"{\"name\":\"timeout\",\"type\":\"timeout\","
|
Body = <<"{\"name\":\"timeout\",\"type\":\"timeout\","
|
||||||
"\"stream\":\"upstream\",\"toxicity\":1.0,"
|
"\"stream\":\"upstream\",\"toxicity\":1.0,"
|
||||||
"\"attributes\":{\"timeout\":0}}">>,
|
"\"attributes\":{\"timeout\":0}}">>,
|
||||||
{ok, {{_, 200, _}, _, _}} = httpc:request(post, {Url, [], "application/json", Body}, [],
|
{ok, {{_, 200, _}, _, _}} = httpc:request(post, {Url, [], "application/json", Body}, [],
|
||||||
[{body_format, binary}]);
|
[{body_format, binary}]);
|
||||||
timeout_proxy(off, ProxyHost, ProxyPort) ->
|
timeout_proxy(off, ProxyHost, ProxyPort) ->
|
||||||
Url = "http://" ++ ProxyHost ++ ":" ++ integer_to_list(ProxyPort) ++ "/proxies/mongo/toxics/timeout",
|
Url = "http://" ++ ProxyHost ++ ":" ++ integer_to_list(ProxyPort) ++ "/proxies/mongo_single/toxics/timeout",
|
||||||
Body = <<>>,
|
Body = <<>>,
|
||||||
{ok, {{_, 204, _}, _, _}} = httpc:request(delete, {Url, [], "application/json", Body}, [],
|
{ok, {{_, 204, _}, _, _}} = httpc:request(delete, {Url, [], "application/json", Body}, [],
|
||||||
[{body_format, binary}]).
|
[{body_format, binary}]).
|
||||||
|
|
||||||
latency_up_proxy(on, ProxyHost, ProxyPort) ->
|
latency_up_proxy(on, ProxyHost, ProxyPort) ->
|
||||||
Url = "http://" ++ ProxyHost ++ ":" ++ integer_to_list(ProxyPort) ++ "/proxies/mongo/toxics",
|
Url = "http://" ++ ProxyHost ++ ":" ++ integer_to_list(ProxyPort) ++ "/proxies/mongo_single/toxics",
|
||||||
Body = <<"{\"name\":\"latency_up\",\"type\":\"latency\","
|
Body = <<"{\"name\":\"latency_up\",\"type\":\"latency\","
|
||||||
"\"stream\":\"upstream\",\"toxicity\":1.0,"
|
"\"stream\":\"upstream\",\"toxicity\":1.0,"
|
||||||
"\"attributes\":{\"latency\":20000,\"jitter\":3000}}">>,
|
"\"attributes\":{\"latency\":20000,\"jitter\":3000}}">>,
|
||||||
{ok, {{_, 200, _}, _, _}} = httpc:request(post, {Url, [], "application/json", Body}, [],
|
{ok, {{_, 200, _}, _, _}} = httpc:request(post, {Url, [], "application/json", Body}, [],
|
||||||
[{body_format, binary}]);
|
[{body_format, binary}]);
|
||||||
latency_up_proxy(off, ProxyHost, ProxyPort) ->
|
latency_up_proxy(off, ProxyHost, ProxyPort) ->
|
||||||
Url = "http://" ++ ProxyHost ++ ":" ++ integer_to_list(ProxyPort) ++ "/proxies/mongo/toxics/latency_up",
|
Url = "http://" ++ ProxyHost ++ ":" ++ integer_to_list(ProxyPort) ++ "/proxies/mongo_single/toxics/latency_up",
|
||||||
Body = <<>>,
|
Body = <<>>,
|
||||||
{ok, {{_, 204, _}, _, _}} = httpc:request(delete, {Url, [], "application/json", Body}, [],
|
{ok, {{_, 204, _}, _, _}} = httpc:request(delete, {Url, [], "application/json", Body}, [],
|
||||||
[{body_format, binary}]).
|
[{body_format, binary}]).
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
|
|
||||||
用户需要实现的方法,和数据类型的定义在 `priv/protos/exhook.proto` 文件中:
|
用户需要实现的方法,和数据类型的定义在 `priv/protos/exhook.proto` 文件中:
|
||||||
|
|
||||||
```protobuff
|
```protobuf
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package emqx.exhook.v1;
|
package emqx.exhook.v1;
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
|
|
||||||
详情参见:`priv/protos/exproto.proto`,例如接口的定义有:
|
详情参见:`priv/protos/exproto.proto`,例如接口的定义有:
|
||||||
|
|
||||||
```protobuff
|
```protobuf
|
||||||
syntax = "proto3";
|
syntax = "proto3";
|
||||||
|
|
||||||
package emqx.exproto.v1;
|
package emqx.exproto.v1;
|
||||||
|
|
|
@ -131,7 +131,7 @@
|
||||||
|
|
||||||
-record(resource_params,
|
-record(resource_params,
|
||||||
{ id :: resource_id()
|
{ id :: resource_id()
|
||||||
, params :: #{} %% the params got after initializing the resource
|
, params :: map() %% the params got after initializing the resource
|
||||||
, status = #{is_alive => false} :: #{is_alive := boolean(), atom() => term()}
|
, status = #{is_alive => false} :: #{is_alive := boolean(), atom() => term()}
|
||||||
}).
|
}).
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue