Skip to content

implement trie based wildcard support #686

Closed
@redboltz

Description

@redboltz

See #684 #676 #685 #681

We have topic_name and topic_filter validatiton functions. They are already been meged.
I already merged tire supporting functions.

Now, it is a time to implement trie version of wildcard support to test_broker.

@kleunen , could you demonstrate how to use subscription_map and retained_topic map ?

Could you write a code example or pull request ?

I'm not sure sub_con_online and sub_con_offline need to be shared_ptr or not. I remember your previous approach uses shared_ptr for them. Please check it is still required in the current master.

I guess that you replace

mqtt_cpp/test/test_broker.hpp

Lines 1699 to 1700 in d035c5b

mi_session_online sessions_online_; ///< Map of active client id and connections
mi_session_offline sessions_offline_; ///< Storage for sessions not currently active. Indexed by client id.

to subscription_map.

I think that subscription_map needs to have search by the address of endpoint_t and client_id.
Consider the following scenario.

  1. client1 connected to the broker with CleanStart:false SessionExpiryInterval:inifinity
  2. client1 subscribed topic1. Broker updates subscription_map.
  3. client1 disconnected. Broker need to search subscription_map by the address of endpoint_t and move it to offline one.

It is implemented using multi_index now. See tag_con.

mqtt_cpp/test/test_broker.hpp

Lines 1554 to 1557 in d035c5b

mi::ordered_non_unique<
mi::tag<tag_con>,
BOOST_MULTI_INDEX_MEMBER(sub_con_online, con_sp_t, con)
>,

There are some kind of events to be a trigger to access to subscription_map.

  1. publish: access to subscription_map by topic_name and get a set of matched sub_con_online or sub_con_offline.
  2. subscribe: insert to subscription_map.
  3. unsubscribe: remove from subscription_map. The key is topic_filter.
  4. disconnect: move or update sub_con_online element in subscription_map. The key is the address of endpoint_t.
  5. connect: move or update sub_con_offine element in subscription_map. The key is client_id.
  6. timeout: Session expire case. remove sub_con_offline from subscription_map. The key is client_id.

@kleunen , could you tell me how to implement them ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions