Crate actaeon

Source
Expand description

§Actaeon

Distributed PubSub and messaging protocol for decentralized real time applications.

The most important struct for the API is the Interface, which can be used for sending and receiving messages as well as subscribing to a Topic. From there most interactions with other users can be done through a Topic.

Example:

use actaeon::{
    config::Config,
    node::{Center, ToAddress},
    Interface,
};
use sodiumoxide::crypto::box_;

fn main() {
    let config = Config::new(20, 1, 100, "example.com".to_string(), 4242);
    let (_, secret) = box_::gen_keypair();
    let center = Center::new(secret, String::from("127.0.0.1"), 1235);

    let interface = Interface::new(config, center).unwrap();

    let mut topic = interface.subscribe(&"example".to_string().to_address());

    let _ = topic.broadcast("hello world".as_bytes().to_vec());
}

Re-exports§

pub use node::Center;
pub use node::ToAddress;
pub use topic::Topic;
pub use transaction::Transaction;

Modules§

bucket
Bucket
config
Config
error
Error
handler
TCP
message
Messages
node
Node
record
Records
router
Router
signaling
Signaling
switch
Switch
topic
Topics
transaction
Transactions
util
Utility

Structs§

Interface
Starting the switch will create both Interface and Switch objects. The Interface will be passed up and to the user / instance. From there the user can interact (receive messages) with the listener.

Enums§

InterfaceAction
Each module that wants to interact with the Switch has a custom enum of possible cases. This is to avoid having to handle a lot of impossible cases in the Switch loop.