如何在Golang etcd客户端中设置一致性选项

Can anyone tell me how to set consistency=true from golang etcd client? Pr: https://github.com/coreos/etcd/pull/866/files fixing issue: https://github.com/coreos/etcd/issues/741 only changes server side behavior. Has anyone used this option?

With the new Client:

You use the GetOptions.Quorum : https://github.com/coreos/etcd/blob/master/client/keys.go#L211

Which you pass to the KeysAPI.Getcall: https://github.com/coreos/etcd/blob/master/client/keys.go#L103

With the old client:

You use the SetConsistency func on the client. c := etcd.NewClient(hosts) if err := c.SetConsistency(etcd.STRONG_CONSISTENCY); err != nil { return nil, err } example: https://github.com/lytics/metafora/blob/8ec2f856db6abe826989b255a02908fc3f0c5eef/m_etcd/transport.go#L73