refactor(all): shared code of clustering and partitioning extracted into module

- group_keys -> cluster_keys
- shared code of clustering and partitioning extracted into module