-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added CosmosRequestContext reacting to api review * removed unnecessary imports * updated javadoc * revert change * initialized in bridgeInternal * Reacting to api comments * added missing javadocs * added missing javadocs * revert deleting readonly * reacting to api comments * reacting to api comments * reacting to api comments
- Loading branch information
Showing
13 changed files
with
373 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
190 changes: 190 additions & 0 deletions
190
sdk/cosmos/azure-cosmos/src/main/java/com/azure/cosmos/CosmosRequestContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,190 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
package com.azure.cosmos; | ||
|
||
import com.azure.cosmos.implementation.ImplementationBridgeHelpers; | ||
import com.azure.cosmos.implementation.OverridableRequestOptions; | ||
import com.azure.cosmos.models.DedicatedGatewayRequestOptions; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Getters for the common request context for operations in CosmosDB. | ||
*/ | ||
public final class CosmosRequestContext { | ||
|
||
private OverridableRequestOptions requestOptions; | ||
|
||
CosmosRequestContext(OverridableRequestOptions requestOptions) { | ||
this.requestOptions = requestOptions; | ||
} | ||
|
||
/** | ||
* Gets the CosmosEndToEndLatencyPolicyConfig. | ||
* | ||
* @return the CosmosEndToEndLatencyPolicyConfig. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public CosmosEndToEndOperationLatencyPolicyConfig getCosmosEndToEndLatencyPolicyConfig() { | ||
return requestOptions.getCosmosEndToEndLatencyPolicyConfig(); | ||
} | ||
|
||
/** | ||
* Gets the consistency level. | ||
* | ||
* @return the consistency level. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public ConsistencyLevel getConsistencyLevel() { | ||
return requestOptions.getConsistencyLevel(); | ||
} | ||
|
||
/** | ||
* Gets the content response on write enabled. | ||
* | ||
* @return the content response on write enabled. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public Boolean isContentResponseOnWriteEnabled() { | ||
return requestOptions.isContentResponseOnWriteEnabled(); | ||
} | ||
|
||
/** | ||
* Gets the non idempotent write retries enabled. | ||
* | ||
* @return the non idempotent write retries enabled. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public Boolean getNonIdempotentWriteRetriesEnabled() { | ||
return requestOptions.getNonIdempotentWriteRetriesEnabled(); | ||
} | ||
|
||
/** | ||
* Gets the dedicated gateway request options. | ||
* | ||
* @return the dedicated gateway request options. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public DedicatedGatewayRequestOptions getDedicatedGatewayRequestOptions() { | ||
return requestOptions.getDedicatedGatewayRequestOptions(); | ||
} | ||
|
||
/** | ||
* Gets the excluded regions. | ||
* | ||
* @return the excluded regions. | ||
*/ | ||
public List<String> getExcludedRegions() { | ||
return requestOptions.getExcludedRegions(); | ||
} | ||
|
||
/** | ||
* Gets the resource token. | ||
* | ||
* @return the resource token. | ||
*/ | ||
public String getThroughputControlGroupName() { | ||
return requestOptions.getThroughputControlGroupName(); | ||
} | ||
|
||
/** | ||
* Gets the diagnostics thresholds. | ||
* | ||
* @return the diagnostics thresholds. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public CosmosDiagnosticsThresholds getDiagnosticsThresholds() { | ||
return requestOptions.getDiagnosticsThresholds(); | ||
} | ||
|
||
/** | ||
* Gets the scan in query enabled. | ||
* | ||
* @return the scan in query enabled. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public Boolean isScanInQueryEnabled() { | ||
return requestOptions.isScanInQueryEnabled(); | ||
} | ||
|
||
/** | ||
* Gets the max degree of parallelism. | ||
* | ||
* @return the max degree of parallelism. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public Integer getMaxDegreeOfParallelism() { | ||
return requestOptions.getMaxDegreeOfParallelism(); | ||
} | ||
|
||
/** | ||
* Gets the max buffered item count. | ||
* | ||
* @return the max buffered item count. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public Integer getMaxBufferedItemCount() { | ||
return requestOptions.getMaxBufferedItemCount(); | ||
} | ||
|
||
/** | ||
* Gets the response continuation token limit in KB. | ||
* | ||
* @return the response continuation token limit in KB. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public Integer getResponseContinuationTokenLimitInKb() { | ||
return requestOptions.getResponseContinuationTokenLimitInKb(); | ||
} | ||
|
||
/** | ||
* Gets the max item count. | ||
* | ||
* @return the max item count. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public Integer getMaxItemCount() { | ||
return requestOptions.getMaxItemCount(); | ||
} | ||
|
||
/** | ||
* Gets the query metrics enabled. | ||
* | ||
* @return the query metrics enabled. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public Boolean isQueryMetricsEnabled() { | ||
return requestOptions.isQueryMetricsEnabled(); | ||
} | ||
|
||
/** | ||
* Gets the index metrics enabled. | ||
* | ||
* @return the index metrics enabled. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public Boolean isIndexMetricsEnabled() { | ||
return requestOptions.isIndexMetricsEnabled(); | ||
} | ||
|
||
/** | ||
* Gets the query name. | ||
* | ||
* @return the query name. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public Integer getMaxPrefetchPageCount() { | ||
return requestOptions.getMaxPrefetchPageCount(); | ||
} | ||
|
||
/** | ||
* Gets the query name. | ||
* @param defaultQueryName the default query name. | ||
* | ||
* @return the query name. It could be null if not defined or called on an irrelevant operation. | ||
*/ | ||
public String getQueryNameOrDefault(String defaultQueryName) { | ||
return requestOptions.getQueryNameOrDefault(defaultQueryName); | ||
} | ||
|
||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
// the following helper/accessor only helps to access this class outside of this package.// | ||
/////////////////////////////////////////////////////////////////////////////////////////// | ||
static void initialize() { | ||
ImplementationBridgeHelpers.CosmosRequestContextHelper | ||
.setCosmosRequestContextAccessor( | ||
new ImplementationBridgeHelpers.CosmosRequestContextHelper.CosmosRequestContextAccessor() { | ||
@Override | ||
public CosmosRequestContext create(OverridableRequestOptions requestOptions) { | ||
return new CosmosRequestContext(requestOptions); | ||
} | ||
} | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.