It has been called the key to opening Scotland’s past – a vast repository of more than three million records, images and documents detailing the country’s history from the stone age to the present day.