Olympic legend Sir Chris Hoy says he has terminal cancer and "two to four years" to live.