https://github.com/bytedance/ipmb
An interprocess message bus system built in Rust.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (9.4%) to scientific vocabulary
Keywords
Repository
An interprocess message bus system built in Rust.
Basic Info
Statistics
- Stars: 108
- Watchers: 7
- Forks: 14
- Open Issues: 1
- Releases: 17
Topics
Metadata Files
README.md
An interprocess message bus system built in Rust, which can be used to pass messages between multiple processes, even including kernel objects (HANDLE/MachPort/FD).
|
Goals
- Easy to use:
join,send,recv, that's everything - Bus architecture: No server or client, messages can be freely transmitted among multiple endpoints
- Message typing: An endpoint can send or receive multiple message types simultaneously without all endpoints defining a complete global message structure
- Practical features: Object, Memory Region, Selector and so on
Getting Started
toml
[dependencies]
ipmb = "0.8"
earth.rs:
```rust
use ipmb::label;
fn main () -> Result<(), Box
// Receive messages
while let Ok(message) = receiver.recv(None) {
log::info!("received: {}", message.payload);
}
Ok(())
} ```
moon.rs:
```rust
use ipmb::label;
use std::thread;
use std::time::Duration;
fn main () -> Result<(), Box
loop {
// Create a message
let selector = ipmb::Selector::unicast("earth");
let mut message = ipmb::Message::new(selector, "hello world".to_string());
// Send the message
sender.send(message)?;
thread::sleep(Duration::from_secs(1));
}
} ```
Concepts
Identifier
An identifier is a system-level unique name for a bus, and only endpoints on the same bus can communicate with each other. On macOS, it will be used to register the MachPort service, on Windows, it will be used to create the corresponding named pipe, and on Linux, it will be used to bind abstract socket address.
Label
Label is the description of an endpoint, and a message can be routed to an endpoint with a LabelOp.
A label can contain multiple elements, such as label!("renderer", "codec").
Selector
Selector is used to describe the routing rules of the message, which consists of 2 parts:
- SelectorMode: Specify how to consume the message when multiple endpoints satisfy routing rules at the same time.
Unicast: Only one endpoint can consume this messageMulticast: All endpoints can consume this message
- LabelOp: Describe the matching rules of label, and supports logical operations of AND/OR/NOT.
Payload
Payload is the body content of a message, and its type can be specified by the type parameter of the join function. You can define your own message types:
toml
[dependencies]
type-uuid = "0.1.2"
```rust use serde::{Deserialize, Serialize}; use type_uuid::TypeUuid;
[derive(Debug, Serialize, Deserialize, TypeUuid)]
[uuid = "7b07473e-9659-4d47-a502-8245d71c0078"]
struct MyMessage { foo: i32, bar: bool, }
fn main() -> Result<(), Box
MessageBox
MessageBox is a container for multiple message types, allowing endpoints to send/receive multiple message types.
```rust use ipmb::MessageBox;
[derive(MessageBox)]
enum MultipleMessage { String(String), I32(i32), MyMessage(MyMessage), }
fn main() -> Result<(), Box
Object
Object is the kernel object representation, MachPort on macOS, HANDLE on Windows, FD on Linux, ipmb supports sending Object as message attachment to other endpoints.
rust
fn main () {
let mut message = ipmb::Message::new(..);
let obj = unsafe { ipmb::Object::from_raw(libc::mach_task_self()) };
message.objects.push(obj);
}
MemoryRegion
MemoryRegion is a shared memory block, ipmb supports sending MemoryRegion as message attachment to other endpoints without copying.
rust
fn main() -> Result<(), Box<dyn Error>>{
let mut message = ipmb::Message::new(..);
let mut region = ipmb::MemoryRegion::new(16 << 10);
let view = region.map(..)?;
writeln!(view, "Hello")?;
message.memory_regions.push(region);
Ok(())
}
MemoryRegistry
Efficiently performs many MemoryRegions allocation by sharing and reusing MemoryRegions.
rust
fn main() {
let mut registry = ipmb::MemoryRegistry::default();
// Alloc memory region from the registry
let mut region = registry.alloc(8 << 20, None);
}
Language Bindings
- C/C++:
ipmb-ffiprovidesipmb_ffi.h/ipmb.h, prebuilt libraries can be downloaded here - Node.js:
ipmb-jsprovides node package ()
Supported Platforms
| Platform | | |----------|-----| | macOS | ✅ | | Windows | ✅ | | Linux | ✅ |
Benchmark
Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz, macOS 13.4
[2023-06-29T08:54:48Z INFO bench] 16 B 752,469/s 12.0 MB/s
[2023-06-29T08:54:48Z INFO bench] 64 B 437,096/s 28.0 MB/s
[2023-06-29T08:54:48Z INFO bench] 1.0 KB 412,224/s 422.1 MB/s
[2023-06-29T08:54:48Z INFO bench] 4.1 KB 327,748/s 1.3 GB/s
[2023-06-29T08:54:49Z INFO bench] 16.4 KB 33,261/s 544.9 MB/s
License
ipmb is dual-licensed:
Owner
- Name: Bytedance Inc.
- Login: bytedance
- Kind: organization
- Location: Singapore
- Website: https://opensource.bytedance.com
- Twitter: ByteDanceOSS
- Repositories: 255
- Profile: https://github.com/bytedance
GitHub Events
Total
- Create event: 3
- Release event: 1
- Issues event: 3
- Watch event: 41
- Issue comment event: 4
- Push event: 24
- Fork event: 5
Last Year
- Create event: 3
- Release event: 1
- Issues event: 3
- Watch event: 41
- Issue comment event: 4
- Push event: 24
- Fork event: 5
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Xiaopeng Li | l****k@b****m | 89 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 7 months ago
All Time
- Total issues: 6
- Total pull requests: 3
- Average time to close issues: 14 days
- Average time to close pull requests: about 7 hours
- Total issue authors: 4
- Total pull request authors: 2
- Average comments per issue: 2.0
- Average comments per pull request: 0.33
- Merged pull requests: 2
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 3
- Pull requests: 2
- Average time to close issues: about 5 hours
- Average time to close pull requests: about 2 hours
- Issue authors: 3
- Pull request authors: 2
- Average comments per issue: 1.67
- Average comments per pull request: 0.5
- Merged pull requests: 1
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- wangjia184 (3)
- ksdhyPro (1)
- nicolaspernoud (1)
- sofoxe1 (1)
Pull Request Authors
- xiaopengli89 (3)
- wangjia184 (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 3
-
Total downloads:
- cargo 13,411 total
- npm 57 last-month
-
Total dependent packages: 1
(may contain duplicates) -
Total dependent repositories: 0
(may contain duplicates) - Total versions: 34
- Total maintainers: 2
npmjs.org: ipmb-js
ipmb-js
- Homepage: https://github.com/bytedance/ipmb#readme
- License: Apache-2.0 OR MIT
-
Latest release: 0.8.3
published 7 months ago
Rankings
Maintainers (1)
crates.io: ipmb-derive
ipmb-derive
- Documentation: https://docs.rs/ipmb-derive/
- License: Apache-2.0 OR MIT
-
Latest release: 0.5.1
published over 2 years ago
Rankings
Maintainers (1)
crates.io: ipmb
Inter-process message bus
- Documentation: https://docs.rs/ipmb/
- License: Apache-2.0 OR MIT
-
Latest release: 0.8.3
published 7 months ago
Rankings
Maintainers (1)
Dependencies
- 110 dependencies
- bytesize 1.1.0 development
- env_logger 0.10.0 development
- num-format 0.4.0 development
- bincode 2.0.0-rc.3
- log 0.4.17
- once_cell 1.17.1
- rand 0.8.5
- serde 1.0.137
- serde_bytes 0.11.7
- smallvec 1.9.0
- smol_str 0.1.23
- thiserror 1.0.31
- type-uuid 0.1.2
- uuid 1.1.2
- Swatinem/rust-cache v2 composite
- actions/checkout v3 composite
- hustcer/setup-nu v3 composite
- softprops/action-gh-release v1 composite
- Swatinem/rust-cache v2 composite
- actions/checkout v3 composite
- actions/download-artifact v3 composite
- actions/upload-artifact v3 composite
- hustcer/setup-nu v3 composite
- softprops/action-gh-release v1 composite
- Swatinem/rust-cache v2 composite
- actions/checkout v3 composite
- hustcer/setup-nu v3 composite
An interprocess message bus system built in Rust, which can be used to pass messages between multiple processes, even including kernel objects (HANDLE/MachPort/FD).