8 releases

0.4.2 Oct 15, 2024
0.4.1 Dec 3, 2023
0.3.1 Nov 23, 2023
0.2.0 Nov 16, 2023
0.1.1 Oct 29, 2023

#13 in #map-reduce


Used in paladin-core

MIT/Apache

10KB
113 lines

A derive macro for the RemoteExecute trait.

This construction enables operations to be serialized and executed by a remote service in an opaque manner. It uses the linkme crate to collect all operation execution pointers into a single slice that are gathered into a contiguous section of the binary by the linker.

Implementation details

A globally unique identifier is assigned to each operation. Then, a unique function that handles deserialization, execution, and re-serialization of the result is generated for each operation. A pointer to this function is registered with the distributed slice at the index of the operation's identifier. This allows execution function to be dereferenced by only the operation identifier, which is serialized with the task.

This scheme allows the tasks sent to workers to be opaque, while still enabling efficient lookup and execution of the appropriate operation.


Paladin

Bringing divine order to distributed computation.

Crates.io version docs.rs docs

Paladin in 2 sentences

Paladin is a Rust library that aims to simplify writing distributed programs. It provides a declarative API, allowing developers to articulate their distributed programs clearly and concisely, without thinking about the complexities of distributed systems programming.

Features

  • Declarative API: Express distributed computations with clarity and ease.
  • Automated Distribution: Paladin’s runtime seamlessly handles task distribution and execution across the cluster.
  • Simplified Development: Concentrate on the program logic, leaving the complexities of distributed systems to Paladin.
  • Infrastructure Agnostic: Paladin is generic over its messaging backend and infrastructure provider. Bring your own infra!

Example

Below is a (contrived) example of how a typical Paladin program looks.

#[tokio::main]
async fn main() {
    let stream = IndexedStream::from([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
    // Compute the fibonacci number at each element in the stream.
    let fibs = stream.map(FibAt);
    // Sum the fibonacci numbers.
    let sum = fibs.fold(Sum);

    // Run the computation.
    let result = sum.run(&runtime).await.unwrap();
    assert_eq!(result, 143);
}

In this example program, we define an algorithm for computing the fibonacci number at each element in a stream, after which we sum the results. Behind the scenes, Paladin will distribute the computations across the cluster and return the result back to the main thread.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~165–580KB
~14K SLoC