Closed yanganto closed 10 months ago
It may be an intentional design to keep the mutability inside. The thing I should use is TestMessageQueue
, but the test queue is private, and the trait is public.
It may be an intentional design to keep the mutability inside. The thing I should use is
TestMessageQueue
, but the test queue is private, and the trait is public.
It is in fact intentional. As noted in #73, the trait was introduced essentially as an intermediate step when moving the PeerManager
dependency from all of the message handlers to just one place: the message queue. However, users probably wouldn't benefit from using a custom MessageQueue
implementation, which is why we're considering to just remove it again and just use DefaultMessageQueue
everywhere.
Got it
The
enqueue
function of the public trait MessageQueue is immutable. In general, we do mutate some data from the Queue, when we put things into it.