done with challenges
This commit is contained in:
parent
67a84aa3b6
commit
64153b7fd4
2 changed files with 11 additions and 10 deletions
|
@ -1,5 +1,6 @@
|
||||||
Working through the [Fly.io distributed systems challenge](https://fly.io/dist-sys/), in Rust.
|
Working through the [Fly.io distributed systems challenge](https://fly.io/dist-sys/), in Rust.
|
||||||
|
|
||||||
The `nebkor-maelstrom` crate is meant to be roughly equivalent to the Go Maelstrom.Node package, and
|
These solutions are built around the [nebkor-maelstrom](https://crates.io/crates/nebkor-maelstrom)
|
||||||
provides serde-backed data structures for messages as well as runner for processing messages from
|
crate, a dedicated Maelstrom client framework that uses no async and strives for simplicity of
|
||||||
the Maelstrom network. See `gg-echo/src/main.rs` for the simplest possible use of it.
|
design and use. The most complicated client in this project is the `gg-kafka` client, at 158 lines;
|
||||||
|
the entire workspace will build from clean in about five seconds.
|
||||||
|
|
|
@ -9,6 +9,13 @@ trait TxnSer {
|
||||||
fn serialize(&self) -> Value;
|
fn serialize(&self) -> Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
||||||
|
struct TxnOp {
|
||||||
|
op: String,
|
||||||
|
key: u64,
|
||||||
|
value: Option<u64>,
|
||||||
|
}
|
||||||
|
|
||||||
impl TxnSer for Txn {
|
impl TxnSer for Txn {
|
||||||
fn serialize(&self) -> Value {
|
fn serialize(&self) -> Value {
|
||||||
let out: Vec<Value> = self
|
let out: Vec<Value> = self
|
||||||
|
@ -28,13 +35,6 @@ fn main() {
|
||||||
runner.run(None);
|
runner.run(None);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Default)]
|
|
||||||
struct TxnOp {
|
|
||||||
op: String,
|
|
||||||
key: u64,
|
|
||||||
value: Option<u64>,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, Default)]
|
#[derive(Debug, Clone, Default)]
|
||||||
struct TANode {
|
struct TANode {
|
||||||
store: HashMap<u64, u64>,
|
store: HashMap<u64, u64>,
|
||||||
|
|
Loading…
Reference in a new issue