General purpose sharding library