relab / gorums

Gorums simplify fault-tolerant quorum-based protocols
MIT License
138 stars 14 forks source link

Decouple Node from channel to avoid two-way reference #142

Closed meling closed 3 years ago

meling commented 3 years ago

We could move Node.setLastError and Node.LastError to channel.go in PR #140. We currently don't use Node.LastError in the gorums codebase, and all uses of setLastError stems from channel.go. This would help to decouple Node from channel, since channel refers to Node and Node refers to channel. If we ever need to access Node.LastError, we can simply get it from channel.LastError.

There are a few other references to Node used in channel.go, e.g., two manager options (backoff and send buffer), and the Node.ID(). These can be replicated in the state of the channel struct, instead of referring back to Node. What do you think @Raytar ?

johningve commented 3 years ago

Yes, that sounds like a good idea. Should I implement that in PR #140 or do you want to merge it first?

meling commented 3 years ago

I'll merge first.