All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.azure.cosmos.implementation.throughputControl.controller.group.ThroughputGroupControllerFactory Maven / Gradle / Ivy

Go to download

This Package contains Microsoft Azure Cosmos SDK (with Reactive Extension Reactor support) for Azure Cosmos DB SQL API

There is a newer version: 4.61.1
Show newest version
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package com.azure.cosmos.implementation.throughputControl.controller.group;

import com.azure.cosmos.ConnectionMode;
import com.azure.cosmos.implementation.GlobalEndpointManager;
import com.azure.cosmos.implementation.caches.RxPartitionKeyRangeCache;
import com.azure.cosmos.implementation.throughputControl.LinkedCancellationToken;
import com.azure.cosmos.implementation.throughputControl.config.ThroughputControlGroupInternal;
import com.azure.cosmos.implementation.throughputControl.config.GlobalThroughputControlGroup;
import com.azure.cosmos.implementation.throughputControl.config.LocalThroughputControlGroup;
import com.azure.cosmos.implementation.throughputControl.controller.group.global.GlobalThroughputControlGroupController;
import com.azure.cosmos.implementation.throughputControl.controller.group.local.LocalThroughputControlGroupController;

public class ThroughputGroupControllerFactory {

    public static ThroughputGroupControllerBase createController(
        ConnectionMode connectionMode,
        ThroughputControlGroupInternal group,
        Integer maxContainerThroughput,
        RxPartitionKeyRangeCache partitionKeyRangeCache,
        String targetCollectionRid,
        LinkedCancellationToken parentToken) {

        if (group instanceof LocalThroughputControlGroup) {
            return new LocalThroughputControlGroupController(
                connectionMode,
                (LocalThroughputControlGroup) group,
                maxContainerThroughput,
                partitionKeyRangeCache,
                targetCollectionRid,
                parentToken);
        } else if (group instanceof GlobalThroughputControlGroup) {
            return new GlobalThroughputControlGroupController(
                connectionMode,
                (GlobalThroughputControlGroup) group,
                maxContainerThroughput,
                partitionKeyRangeCache,
                targetCollectionRid,
                parentToken);
        }

        throw new IllegalArgumentException(String.format("Throughput group control group %s is not supported", group.getClass()));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy