TS McNamara (42) [Avatar] Offline
#1
Welcome to the latest progress report for Rust in Action, a book on the Rust programming language for intermediate programmers that teaches Rust via systems programming.

Several chapters are already currently available via Manning's Early Access Program (MEAP). If you don't own the book and would like to preview its contents for free, visit the book's liveBook page. To get there, visit the book's webpage and click "Look inside".

Book Progress

Chapter 7 should be published shortly. It is going through a few stages of editorial review. Even though this book is a MEAP, we don't want to release something that causes confusion. The chapter is quite large and there have been internal discussions about splitting into two or three smaller chapters. The chapter takes readers through the process of building several key/value stores and discusses how hashing and B-Trees operates.

With upcoming changes to the concurrency landscape in Rust (esp. Tokio stabilization due in July), I've decided to work on another chapter: Time.

Time covers: representing time in a digital computer, how hardware and software clocks work and how NTP operates. There's no need to be mystified by how this process works. Readers will be writing an NTP client from scratch!

If you would like to do some pre-reading, I've made one of the code projects available for review here: https://git.nzoss.org.nz/tim-mcnamara/timepong. I'm hoping that this project will outlive the book! If you have Rust installed, you should be able to keep your system's time in sync right away!
19705 (2) [Avatar] Offline
#2
Coincidentally my 'learning rust' project has been a key value store with b-tree indexes. It will be really interesting to compare our solutions. I suspect yours will be a lot more elegant!

I hope this means that chapter 8 will be covering Tokio? I've tried to learn it using the official documentation and it has left me completely befuddled! Really looking forward to that.
TS McNamara (42) [Avatar] Offline
#3
19705 wrote:Coincidentally my 'learning rust' project has been a key value store with b-tree indexes. It will be really interesting to compare our solutions. I suspect yours will be a lot more elegant!
Lol - possibly, although unlikely! Its lack of elegance is actually partially to blame for the delay.

I took the unwise choice to try to explain how to create an on-disk b-tree on top of an append-only key/value store. This is actually the on-disk architecture of the CouchDB database and the primary reason why data corruption is impossible within CouchDB. Why is that unwise? Well, to explain everything the chapter needs to explain a) key/value stores, b) secondary storage (e.g. spinning disks introduce delays), c) b-trees, d) CRC checks, e) ...

I'm hoping that the material will actually be seen by the readership as very impressive. But the editorial team are rightly concerned that it is far too much material to pack into a single chapter.


19705 wrote:I hope this means that chapter 8 will be covering Tokio? I've tried to learn it using the official documentation and it has left me completely befuddled! Really looking forward to that.
I hope to, but to be honest I'm still somewhat undecided. If I'm perfectly honest, I'm feeling a little exhausted and would prefer an easier task! The last year has been quite a mental battle. Most evenings from 8-11pm have been stuck in front of the computer.

In the table of contents submitted to the editors, I intended to explain networking by either implementing a proxy for the Postgres on-wire protocol that measures queries/minute. tokio would be a very good choice for that kind of system.

I have had some readers ask if I could do something lower-level though. Another part of me would like to explain layer 4 protocols (e.g. UDP and TCP) by implementing something else on top of IP.

At this stage, I only have sketches of designs. Happy to hear more thoughts..