Skip to main content

Module keyspace

Module keyspace 

Source
Expand description

The Redis string keyspace, from the embedded side.

This is Y23 where you can see it. A program that calls Strings::incr reaches the same yo_kv::Keyspace::incr that INCR off a socket reaches, not a second implementation that agrees with it today. The difference between the two callers is a socket, a parser and a reply, and this side pays none of them: an embedded INCR is a probe, an add and a store.

It is also where inline execution mode (15 section 7) actually happens. The calling thread is the shard, so there is no queue, no message and no wakeup, which is what makes the number in bench/00 a number about the store rather than about a channel.

§About the clock

04 section 5 says the clock is read once per turn of the shard loop and never on the data path, because a clock read is tens of nanoseconds against a budget of a hundred and fifty. Inline mode has no loop, so one call is one turn, and reading the clock per call would double the cost of a GET.

So the clock is read only when its answer can be observed, which is when some key in the keyspace has a deadline. A database that has never been given one cannot have an expired key, and its clock never moves and is never read. The first call that sets a deadline turns the reads on, and from then on the cost is the same one a server pays per batch.

Structs§

Strings
The keyspace every Redis string command works on.