Topic/centralize metadata

This is the first step in making metadata work on both S3 and hdfs
Same.