Пример #1
0
    def shard_plan(self):
        with open(self.shard_plan_path) as f:
            plan = yaml.safe_load(f)

        return [
            ShardAllocationDoc.from_plan_json(db_name, plan_json)
            for db_name, plan_json in plan.items()
        ]
Пример #2
0
def _get_aliased_allocation_docs(migration):
    def convert_to_aliases(nodes):
        return [
            migration.target_couch_config.aliases.get(node, node)
            for node in nodes
        ]

    printable_docs = []
    for doc in migration.shard_plan:
        doc_json = doc.to_plan_json()
        doc_json['by_range'] = {
            shard: convert_to_aliases(by_range)
            for shard, by_range in doc_json['by_range'].items()
        }
        printable_docs.append(ShardAllocationDoc.from_plan_json(doc.db_name, doc_json))
    return printable_docs
Пример #3
0
def _get_aliased_allocation_docs(migration):
    def convert_to_aliases(nodes):
        return [
            migration.target_couch_config.aliases.get(node, node)
            for node in nodes
        ]

    printable_docs = []
    for doc in migration.shard_plan:
        doc_json = doc.to_plan_json()
        doc_json['by_range'] = {
            shard: convert_to_aliases(by_range)
            for shard, by_range in doc_json['by_range'].items()
        }
        printable_docs.append(ShardAllocationDoc.from_plan_json(doc.db_name, doc_json))
    return printable_docs