... didn't read the blog ... haven't used it... but the closest thing to netchan I can think of is https://github.com/kylelemons/fatchan
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
The big problem is that errors are out of band, because channel communication itself cannot fail.
On Tuesday, October 8, 2013 12:45:45 PM UTC-6, Kyle Lemons wrote:The big problem is that errors are out of band, because channel communication itself cannot fail.I recall this as being the primary reason netchan was deprecated, though I think it's not as much of an issue as it would seem; flag.ContinueOnError and friends provide something of a precedent for how to approach the problem. I would think a good API would involve creating a network context, and per context being able to define how errors are handled. Some options would be:
1) ignore error, blocking indefinitely until reconnection occurs,
2) close the runtime channel (if on the read side, no apparent error, otherwise, will panic on the next send),
3) register an additional `chan error` to receive connection errors on, the receiver of which can call methods on the context for custom behavior (the first two could just be sensible defaults, ala default signal handlers, that are implemented in terms of these methods).
I thought about this, but I decided on the function because the only time you could create/register such a second channel would be when the initial channel is created... all future channels sent/received over that channel would produce indistinguishable errors.
On Tuesday, October 8, 2013 2:27:38 PM UTC-6, Kyle Lemons wrote:I thought about this, but I decided on the function because the only time you could create/register such a second channel would be when the initial channel is created... all future channels sent/received over that channel would produce indistinguishable errors.I thought about you thinking about that: being able to define independent contexts (though in your case, it'd be per ReadWriteCloser), means that the straightforward approach of one error channel per context means that such errors won't be indistinguishable. Further, including in each error a reference back to the originating context would allow the application to use a combined channel for multiple contexts while still being able to determine the source of errors.
To facilitate transparent reconnection, the context implementation should allow the ReadWriteCloser to be swapped out (during a safe state, of course) without closing the exposed channel.