Exemplo n.º 1
0
def dispatch_object_source(client, account_info, bid, bucket_info):
    """Select and dispatch an object source for a bucket.

    Choices are bucket partition, inventory, or direct pagination.
    """

    if account_info.get('inventory') and bucket_info[
            'keycount'] > PARTITION_QUEUE_THRESHOLD:
        inventory_info = get_bucket_inventory(
            client, bucket_info['name'],
            account_info['inventory'].get('id-selector', '*'))
        if inventory_info is not None:
            return invoke(process_bucket_inventory, bid,
                          inventory_info['bucket'], inventory_info['prefix'])

    if bucket_info['keycount'] > PARTITION_BUCKET_SIZE_THRESHOLD:
        invoke(process_bucket_partitions, bid)
    else:
        invoke(process_bucket_iterator, bid)
Exemplo n.º 2
0
def dispatch_object_source(client, account_info, bid, bucket_info):
    """Select and dispatch an object source for a bucket.

    Choices are bucket partition, inventory, or direct pagination.
    """

    if (account_info.get('inventory') and
        bucket_info['keycount'] >
            account_info['inventory'].get('bucket-size-threshold',
                                          DEFAULT_INVENTORY_BUCKET_SIZE_THRESHOLD)):
        inventory_info = get_bucket_inventory(
            client,
            bucket_info['name'],
            account_info['inventory'].get('id-selector', '*'))
        if inventory_info is not None:
            return invoke(
                process_bucket_inventory, bid,
                inventory_info['bucket'], inventory_info['prefix'])

    if bucket_info['keycount'] > PARTITION_BUCKET_SIZE_THRESHOLD:
        invoke(process_bucket_partitions, bid)
    else:
        invoke(process_bucket_iterator, bid)