Crate actyxos_sdk[][src]

Expand description

ActyxOS makes it easy to run distributed applications on multiple nodes. It is a piece of software that allows you to run your own apps on one or more edge devices and have these apps seamlessly communicate and share data with each other.

This crate defines the data types needed for communicating with ActyxOS and provides Rust bindings for the ActyxOS APIs. It also provides serialization instances for processing the events with differential-dataflow under the "dataflow" feature flag.

Examples

Below you find a full example using the EventService client that retrieves some events. Please adapt the semantics to match your stored events in order to see output.

Note: this example needs the client feature to compile

use actyxos_sdk::event_service::{EventService, EventServiceError, Order, Subscription};
use actyxos_sdk::semantics;
use futures::stream::StreamExt;

#[tokio::main]
pub async fn main() -> Result<(), EventServiceError> {
    // client for locally running ActyxOS Event Service
    let service = EventService::default();

    // retrieve largest currently known event stream cursor
    let offsets = service.get_offsets().await?;

    // all events matching the given subscription
    // sorted backwards, i.e. youngest to oldest
    let sub = vec![Subscription::wildcard(semantics!("MyFish"))];
    let mut events = service
        .query_upto(offsets, sub, Order::LamportReverse)
        .await?;

    // print out the payload of each event
    // (cf. Payload::extract for more options)
    while let Some(event) = events.next().await {
        println!("{}", event.payload.json_value());
    }
    Ok(())
}

Feature flags

The default is to provide only the data types with serialization and deserialization support for serde. The following features can be enabled in addition:

Re-exports

pub use event::Payload;
pub use event_service::Order;
pub use event_service::EventServiceError;

Modules

Definition of the event envelope structure provided by ActyxOS

Data types needed for interacting with the ActyxOS Event Service, plus an optional HTTP client binding

Types and HTTP client for the Event Service v2 API with event tagging support

Types that you may want to use in describing the event payload data

Macros

Macro for constructing an AppId literal.

Helper macro to create interned string types

Macro for constructing a FishName literal.

Macro for constructing a Semantics literal.

Macro for constructing a SourceId literal.

Macro for constructing a Tag literal.

Macro for constructing a set of Tag values.

Structs

A logical timestamp taken from a Lamport clock

Event offset within a SourceId’s stream

Multi-dimensional cursor for event streams: an OffsetMap describes the set of events given by the event streams of each included source up to the associated Offset.

Event offset within a SourceId’s stream or MIN value

A ref-counted slice of memory holding a compact binary representation of an event payload

Microseconds since the UNIX epoch, without leap seconds and in UTC

Enums