Giter Club home page Giter Club logo

submap's Introduction

submap

B-tree map for pub/sub services.

Subscription map

Usage

let mut smap: SubMap<Client> = SubMap::new();

where "Client" is a pub/sub client type, which is usually either a channel or a structure which contains a channel or locked socket or anything else, required to work with the client.

The client type MUST provide traits Ord, Eq and Clone.

All clients must be registered in the map, before they can subscribe/unsubscribe. Use "register_client" function for this.

When "unregister_client" is called, it also automatically unsubscribes the client from all the subscribed topics.

Separators and wildcards

SubMap supports the following masks:

  • this/is/a/topic - single topic subscription
  • this/?/a/topic - all topics which match the pattern (2nd chunk - any value)
  • this/is/* - all subtopics of "this/is"
  • * - all topics

Service symbols can be changed. E.g. let us create a subscription map with MQTT-style wildcards (+ for ? and # for *) but with the dot as the subtopic separator:

let mut smap: SubMap<Client> =
    SubMap::new().separator('.').match_any("+").wildcard("#");

Note that "/topic/x", "topic/x" and "topic//x" are 3 different topics. If any kind of normalization is required, it should be done manually, before calling SubMap functions.

Broadcast map

let mut bmap: BroadcastMap<Client> = BroadcastMap::new();

Does the opposite job - clients are registered with regular names, while "get_clients_by_mask" function returns clients, which match the mask.

Note: the default separator is dot.

ACL map

let mut acl_map = AclMap::new();

SubMap-based high-speed access control lists checker. Uses SubMap algorithm with a single unit "client" to verify various access control lists.

Usage

Cargo crate

https://crates.io/crates/submap

submap's People

Contributors

divi255 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.