Hi, I am writing an application here <https://github.com/woosley/gogate>using
echo <https://github.com/labstack/echo> framework, this application(*client
node*) runs on every server and report its OS/Hardware facts to a master
node.

On master, it store all the server facts in a big map, the key is the
host's ip address most of the time, *user *can read a server facts by its
key.

in this case, there is a concurrent read/write to the same key in the map.
the *client node* write the key and the *user *will read the key, in
different goroutines.

I ended using a sync map in the code
<https://github.com/woosley/gogate/blob/master/gate/types/tp.go#L63>, but I
would assume it is not the best way to solve the issue, is there any best
practice in such case?

I am writing another app which run health status checking for a bunch of
other applications, I am trying Channel based sync here
<https://github.com/woosley/healer/blob/master/src/app.go#L60>, is it the
right direction?

Thanks

/Woosley

-- 
woosley.xu.    http://twitter.com/redicaps

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to