Using the select syscall from Rust, with the libc crate

Disclaimer

  1. I am not a Rust expert, I am just getting started, so please take everything you read here with a grain of salt.
  2. You probably don’t want to use any of this in production code. There are libraries written by actual Rust developers providing similar features, in a way that will most certainly be more efficient and more reusable, such as Tokio and nix. Additionally, select is rarely use these days, kqueue and epoll tend to be preferred.

The select syscall


What does the “ampersand, symbol” thingy as an argument to a ruby method actually do? It creates a proc.

What’s with this weird looking syntax with an ampersand and a symbol

irb(main):001:0> [ 1, 2, 3, 4, 5 ].select(&:even?)
=> [2, 4]
irb(main):002:0> [ 1, 2, 3, 4, 5 ].map(&:even?)
=> [false, true, false, true, false]


In this chapter we will write our own hash table. This will allow to remove uses of the Ruby Hash class and use our Dict class, built from scratch.

What we’ll cover


In this chapter we will focus on making RedisServer speak the Redis Protocol, RESP. Doing so will allow us to use Redis’ built-in client, redis-cli to communicate with our own server.

What we'll cover

Using redis-cli against our Redis clone

Four runners
Four runners
Photo by RUN 4 FFWPU on Pexels


Photo by hannah joshua on Unsplash

What we’ll cover

Planning our changes

  • EX seconds — Set the specified expire time, in seconds.
  • PX milliseconds — Set the specified expire time, in milliseconds.
  • NX — Only set the key if it does…


A followup to the previous post about Railway Oriented Programming in Scala, adding support for parallel validations

Multiple parallel train tracks

Combining functions in parallel


Photo by Chander R on Unsplash

Train tracks, including a switch

Intro


What we’ll cover

First problem, accepting multiple clients

pierre jambet

Software Engineer by day, Runner by day as well.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store