SetNodeEx is used by gossip service to broadcast to other nodes.
(node *proto.Node, ttl uint32, origin proto.NodeID)
| 153 | |
| 154 | // SetNodeEx is used by gossip service to broadcast to other nodes. |
| 155 | func (s *KVServer) SetNodeEx(node *proto.Node, ttl uint32, origin proto.NodeID) (err error) { |
| 156 | log.WithFields(log.Fields{ |
| 157 | "node": node.ID, |
| 158 | "ttl": ttl, |
| 159 | "origin": origin, |
| 160 | }).Debug("update node to kv storage") |
| 161 | |
| 162 | // set local |
| 163 | if err = s.storage.SetNode(node); err != nil { |
| 164 | err = errors.Wrap(err, "set node failed") |
| 165 | return |
| 166 | } |
| 167 | |
| 168 | if ttl > 0 { |
| 169 | s.nonBlockingSync(node, origin, ttl-1) |
| 170 | } |
| 171 | |
| 172 | return |
| 173 | } |
| 174 | |
| 175 | // DelNode implements consistent.Persistence. |
| 176 | func (s *KVServer) DelNode(nodeID proto.NodeID) (err error) { |
no test coverage detected