From 1d383b283fe0a9b3c23b7e1d0ed246c91752e258 Mon Sep 17 00:00:00 2001 From: Ghamza-Jd Date: Sun, 3 Nov 2024 13:04:33 +0200 Subject: [PATCH] docs: added architecture description --- ARCHITECTURE.md | 39 +++++++++++++++++++++++++++++++++++++++ README.md | 13 +++++++++---- 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 ARCHITECTURE.md diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md new file mode 100644 index 0000000..bc9cbe8 --- /dev/null +++ b/ARCHITECTURE.md @@ -0,0 +1,39 @@ +Jarust is just an umbrella crate for `jarust_core`, `jarust_plugins` and `jarust_interface`. + +```mermaid +graph TD + P[jarust_plugins] --> C[jarust_core] + C--> I[jarust_interface] + I --> R[jarust_rt] + C --> R + P --> I + J[jarust] -->|jarust::plugins| P + J -->|jarust::core| C + J -->|jarust::inteface| I +``` + +## Core + +The core provides high-level api to connect, create session, attach, detach, ... + +It relies on abstractions from the interface crate, meaning we can provide our own implementation of `JanusInterface` and +pass it to the core, for example, to use the RabbitMQ interface. + +## Interface + +It contains the core data structures; errors, responses, and messages as well as the transport that communicates with +the janus server. The transport is abstract, so to create a new transport we can implement the `JanusInterface` trait +then provide it to the connect functions. + +The transaction generation is also abstract with 2 built-in ones, UUID v4 and random string. + +## Plugins + +Plugins wraps the generic handle from the core crate and adds the plugin specific functionalities and event parsing, +while also has a handle `Deref` to add unsupported functionalities. + +## Runtime + +We're trying to be runtime agnostic so we created `jarust_rt` that abstracts the runtime, but currenctly only tokio is supported. + +Any task spawing should be from `jarust_rt::spawn` function. diff --git a/README.md b/README.md index eb9028c..f37163c 100644 --- a/README.md +++ b/README.md @@ -3,9 +3,9 @@ [Latest Version]: https://img.shields.io/crates/v/jarust.svg [crates.io]: https://crates.io/crates/jarust -Jarust is a Rust adapter for [Janus WebRTC server](https://github.com/meetecho/janus-gateway) - -Internally uses WebSockets to connect to Janus. But you can provide your own transport. +Jarust is a memory safe and high-performance Rust adapter for [Janus WebRTC server](https://github.com/meetecho/janus-gateway). +Inspired by [Janode](https://github.com/meetecho/janode), jarust offers similar functionalities but it's designed +to be customizable, for exmaple, you could use the built-in WebSocket transport or provide your own RabbitMQ transport implementation. For more details about the architecture check [ARCHITECTURE](./ARCHITECTURE.md). The library wraps the Janus core API and some of the most popular plugins APIs. @@ -13,8 +13,13 @@ The supported Janus plugins currently are: - EchoTest - AudioBridge -- VideoBridge - Streaming +- VideoRoom + +The supported interfaces are: + +- WebSocket +- Restful ## Examples