Skip to content

Commit

Permalink
Merge pull request #53 from constellation-rs/cargo-deploy
Browse files Browse the repository at this point in the history
Use clap for cargo-deploy
  • Loading branch information
mergify[bot] authored Jan 20, 2020
2 parents 06075b7 + 00b8969 commit 742da09
Show file tree
Hide file tree
Showing 11 changed files with 472 additions and 217 deletions.
11 changes: 7 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[package]
name = "constellation-rs"
version = "0.1.9"
version = "0.1.10"
license = "Apache-2.0"
authors = ["Alec Mocatta <[email protected]>"]
categories = ["development-tools","network-programming","concurrency","asynchronous","command-line-utilities"]
Expand All @@ -12,15 +12,16 @@ Constellation is a framework for Rust (nightly) that aides in the writing, debug
"""
repository = "https://github.com/alecmocatta/constellation"
homepage = "https://github.com/alecmocatta/constellation"
documentation = "https://docs.rs/constellation-rs/0.1.9"
documentation = "https://docs.rs/constellation-rs/0.1.10"
readme = "README.md"
links = "constellation"
build = "build.rs"
default-run = "constellation"
edition = "2018"
autotests = true

[badges]
azure-devops = { project = "alecmocatta/constellation", pipeline = "tests" }
azure-devops = { project = "alecmocatta/constellation", pipeline = "tests", build = "25" }
maintenance = { status = "actively-developed" }

[features]
Expand All @@ -32,10 +33,12 @@ no_alloc = ["constellation-internal/no_alloc"]
kubernetes = ["distribute_binaries", "k8s-openapi", "kube", "openssl", "tokio"]

[dependencies]
constellation-internal = { path = "constellation-internal", version = "=0.1.9" }
constellation-internal = { path = "constellation-internal", version = "=0.1.10" }
atty = "0.2"
backtrace = "0.3"
bincode = "1.2"
cargo_metadata = { version = "0.9", default-features = false }
clap = "2.33"
crossbeam = "0.7"
docopt = "1.0"
either = "1.5"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ RUN rustup target add x86_64-unknown-linux-musl
# Create a dummy project and build the app's dependencies.
# If the Cargo.toml and Cargo.lock files have not changed,
# we can use the docker build cache and skip this slow step.
RUN USER=root cargo init && USER=root cargo new --lib constellation-internal
RUN USER=root cargo init --bin && USER=root cargo new --lib constellation-internal && mkdir -p src/bin/constellation && echo 'fn main(){}' > src/bin/constellation/main.rs
COPY Cargo.toml build.rs ./
RUN sed -i '/^###$/q' Cargo.toml
COPY constellation-internal/Cargo.toml ./constellation-internal/
Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
<p align="center">
<a href="https://crates.io/crates/constellation-rs"><img src="https://img.shields.io/crates/v/constellation-rs.svg?maxAge=86400" alt="Crates.io" /></a>
<a href="LICENSE.txt"><img src="https://img.shields.io/crates/l/constellation-rs.svg?maxAge=2592000" alt="Apache-2.0 licensed" /></a>
<a href="https://dev.azure.com/alecmocatta/constellation/_build/latest?branchName=master"><img src="https://dev.azure.com/alecmocatta/constellation/_apis/build/status/tests?branchName=master" alt="Build Status" /></a>
<a href="https://dev.azure.com/alecmocatta/constellation/_build/latest?definitionId=25&branchName=master"><img src="https://dev.azure.com/alecmocatta/constellation/_apis/build/status/tests?branchName=master" alt="Build Status" /></a>
</p>

<p align="center">
<a href="https://docs.rs/constellation-rs/0.1.9">Docs</a>
<a href="https://docs.rs/constellation-rs/0.1.10">Docs</a>
</p>

Constellation is a framework for Rust (nightly) that aides in the writing, debugging and deployment of distributed programs. It draws heavily from [Erlang/OTP](https://en.wikipedia.org/wiki/Erlang_(programming_language)), [MPI](https://en.wikipedia.org/wiki/Message_Passing_Interface), and [CSP](https://en.wikipedia.org/wiki/Communicating_sequential_processes); and leverages the Rust ecosystem where it can including [serde](https://serde.rs/) + [bincode](https://github.com/servo/bincode) for network serialization, and [mio](https://github.com/tokio-rs/mio) and [futures-rs](https://github.com/rust-lang-nursery/futures-rs) for asynchronous channels over TCP.
Expand All @@ -27,13 +27,13 @@ For leveraging Constellation directly, read on.

## Constellation framework

* Constellation is a framework that's initialised with a call to [`init()`](https://docs.rs/constellation-rs/0.1.9/constellation/fn.init.html) at the beginning of your program.
* You can [`spawn(closure)`](https://docs.rs/constellation-rs/0.1.9/constellation/fn.spawn.html) new processes, which run `closure`.
* Constellation is a framework that's initialised with a call to [`init()`](https://docs.rs/constellation-rs/0.1.10/constellation/fn.init.html) at the beginning of your program.
* You can [`spawn(closure)`](https://docs.rs/constellation-rs/0.1.10/constellation/fn.spawn.html) new processes, which run `closure`.
* `spawn(closure)` returns the Pid of the new process.
* You can communicate between processes by creating channels with [`Sender::new(remote_pid)`](https://docs.rs/constellation-rs/0.1.9/constellation/struct.Sender.html#method.new) and [`Receiver::new(remote_pid)`](https://docs.rs/constellation-rs/0.1.9/constellation/struct.Receiver.html#method.new).
* Channels can be used asynchronously with [`sender.send(value).await`](https://docs.rs/constellation-rs/0.1.9/constellation/struct.Sender.html#method.send) and [`receiver.recv().await`](https://docs.rs/constellation-rs/0.1.9/constellation/struct.Receiver.html#method.recv).
* You can communicate between processes by creating channels with [`Sender::new(remote_pid)`](https://docs.rs/constellation-rs/0.1.10/constellation/struct.Sender.html#method.new) and [`Receiver::new(remote_pid)`](https://docs.rs/constellation-rs/0.1.10/constellation/struct.Receiver.html#method.new).
* Channels can be used asynchronously with [`sender.send(value).await`](https://docs.rs/constellation-rs/0.1.10/constellation/struct.Sender.html#method.send) and [`receiver.recv().await`](https://docs.rs/constellation-rs/0.1.10/constellation/struct.Receiver.html#method.recv).
* [futures-rs](https://github.com/rust-lang-nursery/futures-rs) provides useful functions and adapters including `select()` and `join()` for working with channels.
* You can also block on channels with the [`.block()`](https://docs.rs/constellation-rs/0.1.9/constellation/trait.FutureExt1.html#method.block) convenience method: `sender.send().block()` and `receiver.recv().block()`.
* You can also block on channels with the [`.block()`](https://docs.rs/constellation-rs/0.1.10/constellation/trait.FutureExt1.html#method.block) convenience method: `sender.send().block()` and `receiver.recv().block()`.
* For more information on asynchronous programming in Rust check out the [Async Book](https://rust-lang.github.io/async-book/index.html)!

Here's a simple example recursively spawning processes to distribute the task of finding Fibonacci numbers:
Expand Down Expand Up @@ -248,7 +248,7 @@ Please file an issue if you experience any other requirements.

## API

[see Rust doc](https://docs.rs/constellation-rs/0.1.9)
[see Rust doc](https://docs.rs/constellation-rs/0.1.10)

## Testing

Expand Down
5 changes: 2 additions & 3 deletions constellation-internal/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "constellation-internal"
version = "0.1.9"
version = "0.1.10"
license = "Apache-2.0"
authors = ["Alec Mocatta <[email protected]>"]
categories = ["development-tools","network-programming","concurrency","asynchronous"]
Expand All @@ -10,7 +10,7 @@ Common components for the `constellation` framework.
"""
repository = "https://github.com/alecmocatta/constellation"
homepage = "https://github.com/alecmocatta/constellation"
documentation = "https://docs.rs/constellation-internal/0.1.9"
documentation = "https://docs.rs/constellation-internal/0.1.10"
edition = "2018"

[features]
Expand All @@ -22,7 +22,6 @@ aes = "0.3"
alloc_counter = { optional = true, version = "0.0", default-features = false, features = ["std", "no_alloc"] }
ansi_term = "0.12"
bincode = "1.0"
cargo_metadata = { version = "0.9", default-features = false }
either = { version = "1.5", features = ["serde"] }
palaver = "0.2"
rand = { version = "0.7", features = ["small_rng"] }
Expand Down
42 changes: 1 addition & 41 deletions constellation-internal/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![doc(html_root_url = "https://docs.rs/constellation-internal/0.1.9")]
#![doc(html_root_url = "https://docs.rs/constellation-internal/0.1.10")]
#![warn(
// missing_copy_implementations,
missing_debug_implementations,
Expand Down Expand Up @@ -760,43 +760,3 @@ pub fn abort_on_unwind<F: FnOnce() -> T, T>(f: F) -> impl FnOnce() -> T {
pub fn abort_on_unwind_1<F: FnOnce(&A) -> T, T, A>(f: F) -> impl FnOnce(&A) -> T {
|a| abort_on_unwind_(|| f(a))
}

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////

pub mod cargo_metadata {
use cargo_metadata::Target;
use serde::Deserialize;
use std::path::PathBuf;

// https://github.com/rust-lang/cargo/blob/c24a09772c2c1cb315970dbc721f2a42d4515f21/src/cargo/util/machine_message.rs
#[derive(Deserialize, Debug)]
#[serde(tag = "reason", rename_all = "kebab-case")]
#[allow(clippy::pub_enum_variant_names)]
pub enum Message {
CompilerArtifact {
#[serde(flatten)]
artifact: Artifact,
},
CompilerMessage {},
BuildScriptExecuted {},
#[serde(skip)]
Unknown, // TODO https://github.com/serde-rs/serde/issues/912
}
#[derive(Deserialize, Debug)]
pub struct Artifact {
pub package_id: String,
pub target: Target, // https://github.com/rust-lang/cargo/blob/c24a09772c2c1cb315970dbc721f2a42d4515f21/src/cargo/core/manifest.rs#L188
pub profile: ArtifactProfile,
pub features: Vec<String>,
pub filenames: Vec<PathBuf>,
pub fresh: bool,
}
#[derive(Deserialize, Debug)]
pub struct ArtifactProfile {
pub opt_level: String,
pub debuginfo: Option<u32>,
pub debug_assertions: bool,
pub overflow_checks: bool,
pub test: bool,
}
}
4 changes: 2 additions & 2 deletions k8s.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ spec:
spec:
containers:
- name: constellation
image: constellationrs/constellation:0.1.9
image: constellationrs/constellation:0.1.10
args:
- kube
- 0.0.0.0:32123
Expand Down Expand Up @@ -68,7 +68,7 @@ spec:
spec:
containers:
- name: constellation
image: constellationrs/constellation:0.1.9
image: constellationrs/constellation:0.1.10
args:
- 0.0.0.0:32123
env:
Expand Down
Loading

0 comments on commit 742da09

Please sign in to comment.