Expand description

A library for low level message passing

To send new messages, the clients place a new message at the end of their client_out_mem. If the current map is filled up, they place an end of page (EOP) msg and alloc a new ShMem. Once the broker mapped this same page, it flags it as safe for unmapping.

[client0]        [client1]    ...    [clientN]
  |                  |                 /
[client0_out] [client1_out] ... [clientN_out]
  |                 /                /
  |________________/                /
  |________________________________/
 \|/
[broker]

After the broker received a new message for clientN, (clientN_out->current_id != last_message->message_id) the broker will copy the message content to its own, centralized page.

The clients periodically check (current_broadcast_shmem->current_id != last_message->message_id) for new incoming messages. If the page is filled up, the broker instead creates a new page and places an end of page (EOP) message in its queue. The EOP buf contains the new description to access the shared map. The clients then switch over to read from that new current map.

[broker]
  |
[current_broadcast_shmem]
  |
  |___________________________________
  |_________________                  \
  |                 \                  \
  |                  |                  |
 \|/                \|/                \|/
[client0]        [client1]    ...    [clientN]

In the future, if we would need zero copy, the current_broadcast_shmem could instead list the client_out_shmem ID an offset for each message. In that case, the clients also need to create a new ShMem each time their bufs are filled up.

To use, you will have to create a broker using LlmpBroker::new(). Then, create some LlmpClients in other threads and register them with the main thread using LlmpBroker::register_client. Finally, call LlmpBroker::loop_forever().

For broker2broker communication, all messages are forwarded via network sockets.

Check out the llmp_test example in ./examples, or build it with cargo run --example llmp_test.

Structs

The broker (node 0)

A signal handler for the LlmpBroker.

Client side of LLMP

A restorable client description

Description of a shared map. May be used to restore the map by id.

Message sent over the “wire”

Contents of the share mem pages, used by llmp internally

Receiving end on a (unidirectional) sharedmap channel

Sending end on a (unidirectional) sharedmap channel

A page wrapper

Messages for broker 2 broker connection.

Enums

Abstraction for listeners

A listener stream abstraction

An Llmp instance

Result of an LLMP Message hook

This is for the server the broker will spawn. If an llmp connection is local - use sharedmaps or remote (broker2broker) - forwarded via tcp

Responses for requests to the server.

Constants

This message was compressed in transit

From another broker.

Type Definitions

The broker ID, for broker 2 broker communication.

The client ID == the sender id.

The flags, indicating, for example, enabled compression.

The message ID, an ever-increasing number, unique only to a sharedmap/page.

TAGs used throughout llmp