emqx_session_mem.hrl 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. %%--------------------------------------------------------------------
  2. %% Copyright (c) 2022-2024 EMQ Technologies Co., Ltd. All Rights Reserved.
  3. %%
  4. %% Licensed under the Apache License, Version 2.0 (the "License");
  5. %% you may not use this file except in compliance with the License.
  6. %% You may obtain a copy of the License at
  7. %%
  8. %% http://www.apache.org/licenses/LICENSE-2.0
  9. %%
  10. %% Unless required by applicable law or agreed to in writing, software
  11. %% distributed under the License is distributed on an "AS IS" BASIS,
  12. %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. %% See the License for the specific language governing permissions and
  14. %% limitations under the License.
  15. %%--------------------------------------------------------------------
  16. -ifndef(EMQX_SESSION_MEM_HRL).
  17. -define(EMQX_SESSION_MEM_HRL, true).
  18. -record(session, {
  19. %% Client's id
  20. clientid :: emqx_types:clientid(),
  21. id :: emqx_session:session_id(),
  22. %% Is this session a persistent session i.e. was it started with Session-Expiry > 0
  23. is_persistent :: boolean(),
  24. %% Client’s Subscriptions.
  25. subscriptions :: map(),
  26. %% Max subscriptions allowed
  27. max_subscriptions :: non_neg_integer() | infinity,
  28. %% Upgrade QoS?
  29. upgrade_qos = false :: boolean(),
  30. %% Client <- Broker: QoS1/2 messages sent to the client but
  31. %% have not been unacked.
  32. inflight :: emqx_inflight:inflight(),
  33. %% All QoS1/2 messages published to when client is disconnected,
  34. %% or QoS1/2 messages pending transmission to the Client.
  35. %%
  36. %% Optionally, QoS0 messages pending transmission to the Client.
  37. mqueue :: emqx_mqueue:mqueue(),
  38. %% Next packet id of the session
  39. next_pkt_id = 1 :: emqx_types:packet_id(),
  40. %% Retry interval for redelivering QoS1/2 messages (Unit: millisecond)
  41. retry_interval :: timeout(),
  42. %% Client -> Broker: QoS2 messages received from the client, but
  43. %% have not been completely acknowledged
  44. awaiting_rel :: map(),
  45. %% Maximum number of awaiting QoS2 messages allowed
  46. max_awaiting_rel :: non_neg_integer() | infinity,
  47. %% Awaiting PUBREL Timeout (Unit: millisecond)
  48. await_rel_timeout :: timeout(),
  49. %% Created at
  50. created_at :: pos_integer()
  51. }).
  52. -endif.