modularize query evaluation in metadata
remove unused types
use a curry function to include archiver pointer in TCP handlers