We created a design document conforming to project description.
Some thoughts and ideas by yours truly (Lauri) (written while others are busy writing the design document):
- We could do integration testing by mocking TcpStream
- Server logic needs to be generic,
T: Read + Write + ...
- Server logic needs to be generic,
- We should do unit testing
- Automatic test coverage generation would be interesting but not required
- The actual protocol definition will just be some Rust
structs andenums, decorated with serde macros - In a release version, the server-server protocol should probably have a version field... This can be done with an enum if we want to
We broke ground and wrote first code for the server node, including configuration file parsing and server peer listener thread. It was mostly straightforward, but joining threads had us thinking for a while.
What we learned, was that Rust's thread JoinHandle's join-method returns a Result, whose:
Ok-variant contains the return value from the function/closure which the thread ran- This could be a nested
Result<T, E>!
- This could be a nested
Err-variant contains the value passed to panic (usually a string reference)- But it's provided to us through a
Box<dyn Any + Send + 'static>>-pointer! - This is because
panic!(...)doesn't have to be called with a&str, some applications need a different type to return from a paniced thread - But in our case it's going to be a
&strif anything, so we calldowncast_ref::<&str>()on it to get anOption<&str>that can be debug-printed
- But it's provided to us through a
The session itself was conducted on Discord with voice communication and a desktop share stream. This seems to work pretty well.