// RefreshNode keeps the heartbeats with etcd
RefreshNode keeps the heartbeats with etcd
// RefreshNode keeps the heartbeats with etcd
func (r *EtcdRegistry) RefreshNode(pctx context.Context, prefix, nodeID string, ttl int64, latestFilePos, latestKafkaPos pb.Pos) error {
	ctx, cancel := context.WithTimeout(pctx, r.reqTimeout)
	defer cancel()
	aliveKey := r.prefixed(prefix, nodeID, "alive")
	latestPos := &LatestPos{
		FilePos:  latestFilePos,
		KafkaPos: latestKafkaPos,
	}
	latestPosBytes, err := json.Marshal(latestPos)
	if err != nil {
		return errors.Trace(err)
	}
	err = r.client.UpdateOrCreate(ctx, aliveKey, string(latestPosBytes), ttl)
	return errors.Trace(err)
}
func ( r * EtcdRegistry ) RefreshNode ( pctx context . Context , prefix , nodeID string , ttl int64 , latestFilePos , latestKafkaPos pb . Pos ) error { ctx , cancel := context . WithTimeout ( pctx , r . reqTimeout ) defer cancel ( ) aliveKey := r . prefixed ( prefix , nodeID , " " ) latestPos := & LatestPos { FilePos : latestFilePos , KafkaPos : latestKafkaPos , } latestPosBytes , err := json . Marshal ( latestPos ) if err != nil { return errors . Trace ( err ) } err = r . client . UpdateOrCreate ( ctx , aliveKey , string ( latestPosBytes ) , ttl ) return errors . Trace ( err ) }
RefreshNode keeps the heartbeats with etcd
RefreshNode keeps the heartbeats with etcd
// try to touch alive state of node, update ttl