I’m a bit late to the party but I came across your gen_statem
blogposts via here and found this library! The ETS replication via logical is a really cool application of logical replication.
I was reading a fair bit through the code yesterday and I hope you don’t mind me asking: What made you go for using gen_statem
? I haven’t seen it used much (maybe I have been looking in the wrong spots) but your blog posts on it made me curious. Looking at the code, I found the query and connection logic as well as ETS replication logic relatively easy to follow but it was an approach I did not see before. If I understood it properly, you queue outstanding requests by connection owner in here and then return the results to the client as they come in from the backing connection.
Is the benefit of using gen_statem
performance? Or maintainability of the code: you can more easily reason about how to deal with queries in different states of the connection?
Sorry for my noob-ish questions but I’m curious to learn