crodas / microredis

Redis server implemented in rust.
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Better dispatcher/command routing #20

Closed crodas closed 2 years ago

crodas commented 2 years ago

A lot of the logic of the dispatcher/command router is behind an obscure macro.

Some optimizations are:

  1. Prior each command was their own individual struct, sharing only a common trait. That was pointless. To improve this and remove all dynamic bits from runtime a single Command struct is available now. It is created in a Dispatcher object, one instance of command per command, with all their definition. Having the same struct removes the need of a dynamic trait.
  2. The command struct definition is outside of a macro, making the code more readable.