Merge pull request #13135 from ieQu1/dev/refactor-sessds2
Refactor session DS code. No functional change.
This commit is contained in:
commit
02d10a2023
|
@ -0,0 +1,35 @@
|
|||
%%--------------------------------------------------------------------
|
||||
%% Copyright (c) 2022, 2024 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||
%%
|
||||
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||
%% you may not use this file except in compliance with the License.
|
||||
%% You may obtain a copy of the License at
|
||||
%%
|
||||
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||
%%
|
||||
%% Unless required by applicable law or agreed to in writing, software
|
||||
%% distributed under the License is distributed on an "AS IS" BASIS,
|
||||
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
%% See the License for the specific language governing permissions and
|
||||
%% limitations under the License.
|
||||
%%--------------------------------------------------------------------
|
||||
|
||||
%% @doc This header contains definitions of durable session metadata
|
||||
%% keys, that can be consumed by the external code.
|
||||
-ifndef(EMQX_DURABLE_SESSION_META_HRL).
|
||||
-define(EMQX_DURABLE_SESSION_META_HRL, true).
|
||||
|
||||
%% Session metadata keys:
|
||||
-define(created_at, created_at).
|
||||
-define(last_alive_at, last_alive_at).
|
||||
-define(expiry_interval, expiry_interval).
|
||||
%% Unique integer used to create unique identities:
|
||||
-define(last_id, last_id).
|
||||
%% Connection info (relevent for the dashboard):
|
||||
-define(peername, peername).
|
||||
-define(will_message, will_message).
|
||||
-define(clientinfo, clientinfo).
|
||||
-define(protocol, protocol).
|
||||
-define(offline_info, offline_info).
|
||||
|
||||
-endif.
|
|
@ -2,7 +2,7 @@
|
|||
{application, emqx, [
|
||||
{id, "emqx"},
|
||||
{description, "EMQX Core"},
|
||||
{vsn, "5.3.0"},
|
||||
{vsn, "5.4.0"},
|
||||
{modules, []},
|
||||
{registered, []},
|
||||
{applications, [
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
-include("emqx_mqtt.hrl").
|
||||
|
||||
-include("emqx_persistent_session_ds.hrl").
|
||||
-include("emqx_persistent_session_ds/session_internals.hrl").
|
||||
|
||||
-ifdef(TEST).
|
||||
-include_lib("proper/include/proper.hrl").
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
-include_lib("stdlib/include/qlc.hrl").
|
||||
-include_lib("stdlib/include/ms_transform.hrl").
|
||||
|
||||
-include("emqx_persistent_session_ds.hrl").
|
||||
-include("session_internals.hrl").
|
||||
|
||||
%% API
|
||||
-export([
|
|
@ -21,7 +21,7 @@
|
|||
-include_lib("stdlib/include/qlc.hrl").
|
||||
-include_lib("stdlib/include/ms_transform.hrl").
|
||||
|
||||
-include("emqx_persistent_session_ds.hrl").
|
||||
-include("session_internals.hrl").
|
||||
|
||||
%% API
|
||||
-export([
|
|
@ -79,7 +79,7 @@
|
|||
]).
|
||||
|
||||
-include("emqx_mqtt.hrl").
|
||||
-include("emqx_persistent_session_ds.hrl").
|
||||
-include("session_internals.hrl").
|
||||
-include_lib("snabbkaffe/include/trace.hrl").
|
||||
-include_lib("stdlib/include/qlc.hrl").
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
-include_lib("emqx/include/logger.hrl").
|
||||
-include("emqx_mqtt.hrl").
|
||||
-include("emqx_persistent_session_ds.hrl").
|
||||
-include("session_internals.hrl").
|
||||
|
||||
%%================================================================================
|
||||
%% Type declarations
|
|
@ -41,7 +41,7 @@
|
|||
|
||||
-export_type([subscription_state_id/0, subscription/0, subscription_state/0]).
|
||||
|
||||
-include("emqx_persistent_session_ds.hrl").
|
||||
-include("session_internals.hrl").
|
||||
-include("emqx_mqtt.hrl").
|
||||
-include_lib("snabbkaffe/include/trace.hrl").
|
||||
|
|
@ -13,10 +13,11 @@
|
|||
%% See the License for the specific language governing permissions and
|
||||
%% limitations under the License.
|
||||
%%--------------------------------------------------------------------
|
||||
-ifndef(EMQX_PERSISTENT_SESSION_DS_HRL_HRL).
|
||||
-define(EMQX_PERSISTENT_SESSION_DS_HRL_HRL, true).
|
||||
-ifndef(EMQX_SESSION_DS_INTERNALS_HRL).
|
||||
-define(EMQX_SESSION_DS_INTERNALS_HRL, true).
|
||||
|
||||
-include("emqx_persistent_message.hrl").
|
||||
-include("emqx_durable_session_metadata.hrl").
|
||||
|
||||
-define(SESSION_TAB, emqx_ds_session).
|
||||
-define(SESSION_SUBSCRIPTIONS_TAB, emqx_ds_session_subscriptions).
|
||||
|
@ -70,17 +71,4 @@
|
|||
sub_state_id :: emqx_persistent_session_ds_subs:subscription_state_id()
|
||||
}).
|
||||
|
||||
%% Session metadata keys:
|
||||
-define(created_at, created_at).
|
||||
-define(last_alive_at, last_alive_at).
|
||||
-define(expiry_interval, expiry_interval).
|
||||
%% Unique integer used to create unique identities:
|
||||
-define(last_id, last_id).
|
||||
%% Connection info (relevent for the dashboard):
|
||||
-define(peername, peername).
|
||||
-define(will_message, will_message).
|
||||
-define(clientinfo, clientinfo).
|
||||
-define(protocol, protocol).
|
||||
-define(offline_info, offline_info).
|
||||
|
||||
-endif.
|
|
@ -1,7 +1,7 @@
|
|||
%% -*- mode: erlang -*-
|
||||
{application, emqx_auth, [
|
||||
{description, "EMQX Authentication and authorization"},
|
||||
{vsn, "0.3.0"},
|
||||
{vsn, "0.4.0"},
|
||||
{modules, []},
|
||||
{registered, [emqx_auth_sup]},
|
||||
{applications, [
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
{application, emqx_management, [
|
||||
{description, "EMQX Management API and CLI"},
|
||||
% strict semver, bump manually!
|
||||
{vsn, "5.2.0"},
|
||||
{vsn, "5.3.0"},
|
||||
{modules, []},
|
||||
{registered, [emqx_management_sup]},
|
||||
{applications, [
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
-include_lib("hocon/include/hoconsc.hrl").
|
||||
-include_lib("emqx/include/logger.hrl").
|
||||
-include_lib("emqx_utils/include/emqx_utils_api.hrl").
|
||||
-include_lib("emqx/include/emqx_durable_session_metadata.hrl").
|
||||
|
||||
-include("emqx_mgmt.hrl").
|
||||
|
||||
|
@ -1739,7 +1740,7 @@ format_channel_info(undefined, {ClientId, PSInfo0 = #{}}, _Opts) ->
|
|||
format_persistent_session_info(
|
||||
_ClientId,
|
||||
#{
|
||||
metadata := #{offline_info := #{chan_info := ChanInfo, stats := Stats} = OfflineInfo} =
|
||||
metadata := #{?offline_info := #{chan_info := ChanInfo, stats := Stats} = OfflineInfo} =
|
||||
Metadata
|
||||
} =
|
||||
PSInfo
|
||||
|
|
Loading…
Reference in New Issue