We’ve already set up the development environment, so let’s write some Rust code! A good place to start is with the bottom layer data structures, known as Str and Ch in the C# version. To review, Ch is an enumeration…
Watching a directory: debouncing
Over the last few posts, we have created a relatively full-featured DirectoryWatcher library, but it has one glaring omission. To demonstrate, let’s review the output of the sample program which randomly modifies the files it is watching: For many types…
Watching a directory: composability
Last time, I mentioned that our DirectoryTreeWatcher code demonstrates composition but not composability. To see what I mean, imagine that you wanted to add logging so you could track whenever a subscription is created or destroyed. A nice separation-of-concerns way…
Watching a directory: composition and thread-safety
We have a testable DirectoryWatcher; now what? Given that the DirectoryWatcher can only watch files in a single directory, we can extend this to a whole directory tree. Perhaps the best way to achieve this is with composition (in the…
Watching a directory: testability
Previously, I introduced DirectoryWatcher but it was woefully untestable. Tight coupling to the file system is something that would be at odds with a microtesting practice as described by “Geepaw” Hill. I agree with him and nearly always avoid extraneous…
Watching a directory: basic intro
Let’s say we want to write a .NET Core class that watches for file changes in a single directory. The implementation should only notify for explicitly subscribed files. For example, if DIR is being watched and DIR\file1.txt is subscribed, we…
Let’s do DHCP: more diagnostic events
While thinking about how to combine latency measurement with diagnostic events in the DHCP server, I noticed a particular gap in the design. Right now the event interfaces look like this: However, if we want to incorporate latency metrics, we…
Let’s do DHCP: diagnostic events
There is always something new to do with the DHCP server sample. Today we will look at how to add diagnostic events. After all, any good server technology intended to run in real world production scenarios needs observability. One approach…
Let’s do DHCP: sockets
After our foray into DHCP options, we are ready for the last piece of the puzzle — actually sending and receiving data on a socket. First, we need to encode the high performance receive pattern. I’ve decided on an async…
Let’s do DHCP: options
Last time we built our DHCP buffer with header fields. For a fully formed DHCP message, we also need to support DHCP options. Each option has a tag byte specifying its type, a length byte, and a number of data…