Add partition/chunk type to DataSource.

Significant additional refactor, as well.