mit-pdos / noria

Fast web applications through dynamic, partially-stateful dataflow
Apache License 2.0
4.98k stars 242 forks source link

Refactored state impl via macro and trait #128

Closed JustusAdam closed 5 years ago

JustusAdam commented 5 years ago

The idea here is to make the conversion between Row (or &[DataType]) and an index for the state map reusable, namely for other State impls. It just so happens that that also allows me to apply some do-not-repeat-yourself principles to the state impls using small macro_rules.

I did this change in preparation of implementing a custom State. I don't necessarily mean to suggest that this version is better, and should be merged` but I thought I'd inform you about the possibility.

The code isn't actually shorter, which I think is a bit unfortunate, but perhaps more readable.

jonhoo commented 5 years ago

This seems like a reasonable change to me! I'd be happy to merge with the two minor macro changes above.