Przeglądaj źródła

Merge pull request #1791 from emqplus/emqx30-code-review

Rename emqx_mqtt_properties module to emqx_mqtt_props
Feng Lee 7 lat temu
rodzic
commit
60fb2a1007

+ 1 - 1
Makefile

@@ -37,7 +37,7 @@ EUNIT_OPTS = verbose
 
 CT_SUITES = emqx emqx_banned emqx_connection emqx_session emqx_access emqx_broker emqx_cm emqx_frame emqx_guid emqx_inflight \
 			emqx_json emqx_keepalive emqx_lib emqx_metrics emqx_misc emqx_mod emqx_mqtt_caps \
-			emqx_mqtt_compat emqx_mqtt_properties emqx_mqueue emqx_net emqx_pqueue emqx_router emqx_sm \
+			emqx_mqtt_compat emqx_mqtt_props emqx_mqueue emqx_net emqx_pqueue emqx_router emqx_sm \
 			emqx_stats emqx_tables emqx_time emqx_topic emqx_trie emqx_vm emqx_zone \
 		 	emqx_mountpoint emqx_listeners emqx_protocol
 

+ 3 - 3
src/emqx_client.erl

@@ -159,7 +159,7 @@ start_link() -> start_link([]).
 start_link(Options) when is_map(Options) ->
     start_link(maps:to_list(Options));
 start_link(Options) when is_list(Options) ->
-    ok  = emqx_mqtt_properties:validate(
+    ok  = emqx_mqtt_props:validate(
             proplists:get_value(properties, Options, #{})),
     case start_client(with_owner(Options)) of
         {ok, Client} ->
@@ -265,7 +265,7 @@ publish(Client, Topic, Payload, Opts) when is_binary(Topic), is_list(Opts) ->
       -> ok | {ok, packet_id()} | {error, term()}).
 publish(Client, Topic, Properties, Payload, Opts)
     when is_binary(Topic), is_map(Properties), is_list(Opts) ->
-    ok = emqx_mqtt_properties:validate(Properties),
+    ok = emqx_mqtt_props:validate(Properties),
     Retain = proplists:get_bool(retain, Opts),
     QoS = ?QOS_I(proplists:get_value(qos, Opts, ?QOS_0)),
     publish(Client, #mqtt_msg{qos     = QoS,
@@ -541,7 +541,7 @@ mqtt_connect(State = #state{client_id   = ClientId,
                             will_msg    = WillMsg,
                             properties  = Properties}) ->
     ?WILL_MSG(WillQoS, WillRetain, WillTopic, WillProps, WillPayload) = WillMsg,
-    ConnProps = emqx_mqtt_properties:filter(?CONNECT, Properties),
+    ConnProps = emqx_mqtt_props:filter(?CONNECT, Properties),
     send(?CONNECT_PACKET(
             #mqtt_packet_connect{proto_ver    = ProtoVer,
                                  proto_name   = ProtoName,

+ 1 - 1
src/emqx_mqtt_properties.erl

@@ -13,7 +13,7 @@
 %% limitations under the License.
 
 %% @doc MQTT5 Properties
--module(emqx_mqtt_properties).
+-module(emqx_mqtt_props).
 
 -include("emqx_mqtt.hrl").
 

+ 5 - 4
test/emqx_mqtt_properties_SUITE.erl

@@ -12,7 +12,7 @@
 %% See the License for the specific language governing permissions and
 %% limitations under the License.
 
--module(emqx_mqtt_properties_SUITE).
+-module(emqx_mqtt_props_SUITE).
 
 -compile(export_all).
 -compile(nowarn_export_all).
@@ -22,6 +22,7 @@
 all() -> [t_mqtt_properties_all].
 
 t_mqtt_properties_all(_) ->
-    Props = emqx_mqtt_properties:filter(?CONNECT, #{'Session-Expiry-Interval' => 1, 'Maximum-Packet-Size' => 255}),
-    ok = emqx_mqtt_properties:validate(Props),
-    #{} = emqx_mqtt_properties:filter(?CONNECT, #{'Maximum-QoS' => ?QOS_2}).
+    Props = emqx_mqtt_props:filter(?CONNECT, #{'Session-Expiry-Interval' => 1, 'Maximum-Packet-Size' => 255}),
+    ok = emqx_mqtt_props:validate(Props),
+    #{} = emqx_mqtt_props:filter(?CONNECT, #{'Maximum-QoS' => ?QOS_2}).
+