Quantum non-demolition measurements in optics and quantum optical repeaters