datrs / hypercore

Secure, distributed, append-only log
https://docs.rs/hypercore
Apache License 2.0
332 stars 37 forks source link

Remove NodeTrait #5

Open yoshuawuyts opened 6 years ago

yoshuawuyts commented 6 years ago

Having to expose the NodeTrait just to be able to use the methods on the Node type feels leaky. We should create a "sealed" and "unsealed" Node type, where one acts as a front for the other.

We can do this by creating a facade using https://github.com/chancancode/rust-delegate, which should allow us to seal the trait requirements internally without leaking it.

We should probably name one SealedNode and the other Node. UsingNode` exclusively throughout our code as to prevent the sealed version from leaking.