azure-docs-sdk-java/docs-ref-autogen/com.azure.cosmos.models.Con...

138 строки
18 KiB
YAML

### YamlMime:JavaType
uid: "com.azure.cosmos.models.ConflictResolutionPolicy"
fullName: "com.azure.cosmos.models.ConflictResolutionPolicy"
name: "ConflictResolutionPolicy"
nameWithType: "ConflictResolutionPolicy"
summary: "Represents the conflict resolution policy configuration for specifying how to resolve conflicts in case writes from different regions result in conflicts on items in the container in the Azure Cosmos DB service."
inheritances:
- "<xref href=\"java.lang.Object?displayProperty=fullName\" data-throw-if-not-resolved=\"False\" />"
inheritedClassMethods:
- classRef: "java.lang.<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html\">Object</a>"
methodsRef:
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--\">clone</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-\">equals</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--\">finalize</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--\">getClass</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--\">hashCode</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--\">notify</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--\">notifyAll</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--\">toString</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-\">wait</a>"
- "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-\">wait</a>"
syntax: "public final class **ConflictResolutionPolicy**"
methods:
- uid: "com.azure.cosmos.models.ConflictResolutionPolicy.createCustomPolicy()"
fullName: "com.azure.cosmos.models.ConflictResolutionPolicy.createCustomPolicy()"
name: "createCustomPolicy()"
nameWithType: "ConflictResolutionPolicy.createCustomPolicy()"
summary: "Creates a CUSTOM <xref uid=\"com.azure.cosmos.models.ConflictResolutionPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionPolicy\"></xref> without any <xref uid=\"com.azure.cosmos.implementation.StoredProcedure\" data-throw-if-not-resolved=\"false\" data-raw-source=\"StoredProcedure\"></xref>."
modifiers:
- "static"
syntax: "public static ConflictResolutionPolicy createCustomPolicy()"
desc: "Creates a CUSTOM <xref uid=\"com.azure.cosmos.models.ConflictResolutionPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionPolicy\"></xref> without any <xref uid=\"com.azure.cosmos.implementation.StoredProcedure\" data-throw-if-not-resolved=\"false\" data-raw-source=\"StoredProcedure\"></xref>. User manually should resolve conflicts.\n\nThe conflicts will be registered in the conflicts feed and the user should manually resolve them."
returns:
description: "ConflictResolutionPolicy."
type: "<xref href=\"com.azure.cosmos.models.ConflictResolutionPolicy?alt=com.azure.cosmos.models.ConflictResolutionPolicy&text=ConflictResolutionPolicy\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.models.ConflictResolutionPolicy.createCustomPolicy(java.lang.String)"
fullName: "com.azure.cosmos.models.ConflictResolutionPolicy.createCustomPolicy(String conflictResolutionStoredProcFullPath)"
name: "createCustomPolicy(String conflictResolutionStoredProcFullPath)"
nameWithType: "ConflictResolutionPolicy.createCustomPolicy(String conflictResolutionStoredProcFullPath)"
summary: "Creates a CUSTOM <xref uid=\"com.azure.cosmos.models.ConflictResolutionPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionPolicy\"></xref> which uses the specified stored procedure to perform conflict resolution"
modifiers:
- "static"
parameters:
- description: "stored procedure full path to perform conflict resolution."
name: "conflictResolutionStoredProcFullPath"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public static ConflictResolutionPolicy createCustomPolicy(String conflictResolutionStoredProcFullPath)"
desc: "Creates a CUSTOM <xref uid=\"com.azure.cosmos.models.ConflictResolutionPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionPolicy\"></xref> which uses the specified stored procedure to perform conflict resolution\n\nThis stored procedure may be created after the <xref uid=\"com.azure.cosmos.models.CosmosContainerProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosContainerProperties\"></xref> is created and can be changed as required.\n\n * This method requires conflictResolutionStoredProcFullPath in format dbs/%s/colls/%s/sprocs/%s. User can also use equivalent method <xref uid=\"com.azure.cosmos.models.ConflictResolutionPolicy.createCustomPolicy(java.lang.String,java.lang.String,java.lang.String)\" data-throw-if-not-resolved=\"false\" data-raw-source=\"#createCustomPolicy(String, String, String)\"></xref>\n * In case the stored procedure fails or throws an exception, the conflict resolution will default to registering conflicts in the conflicts feed\n * The user can provide the stored procedure @see <xref uid=\"com.azure.cosmos.implementation.Resource.getId*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Resource#getId()\"></xref>"
returns:
description: "ConflictResolutionPolicy."
type: "<xref href=\"com.azure.cosmos.models.ConflictResolutionPolicy?alt=com.azure.cosmos.models.ConflictResolutionPolicy&text=ConflictResolutionPolicy\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.models.ConflictResolutionPolicy.createCustomPolicy(java.lang.String,java.lang.String,java.lang.String)"
fullName: "com.azure.cosmos.models.ConflictResolutionPolicy.createCustomPolicy(String dbName, String containerName, String sprocName)"
name: "createCustomPolicy(String dbName, String containerName, String sprocName)"
nameWithType: "ConflictResolutionPolicy.createCustomPolicy(String dbName, String containerName, String sprocName)"
summary: "Creates a CUSTOM <xref uid=\"com.azure.cosmos.models.ConflictResolutionPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionPolicy\"></xref> which uses the specified stored procedure to perform conflict resolution"
modifiers:
- "static"
parameters:
- description: "database name."
name: "dbName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "container name."
name: "containerName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- description: "stored procedure name to perform conflict resolution."
name: "sprocName"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public static ConflictResolutionPolicy createCustomPolicy(String dbName, String containerName, String sprocName)"
desc: "Creates a CUSTOM <xref uid=\"com.azure.cosmos.models.ConflictResolutionPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionPolicy\"></xref> which uses the specified stored procedure to perform conflict resolution\n\nThis stored procedure may be created after the <xref uid=\"com.azure.cosmos.models.CosmosContainerProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosContainerProperties\"></xref> is created and can be changed as required.\n\n * In case the stored procedure fails or throws an exception, the conflict resolution will default to registering conflicts in the conflicts feed\n * The user can provide the stored procedure @see <xref uid=\"com.azure.cosmos.implementation.Resource.getId*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Resource#getId()\"></xref>"
returns:
description: "ConflictResolutionPolicy."
type: "<xref href=\"com.azure.cosmos.models.ConflictResolutionPolicy?alt=com.azure.cosmos.models.ConflictResolutionPolicy&text=ConflictResolutionPolicy\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.models.ConflictResolutionPolicy.createLastWriterWinsPolicy()"
fullName: "com.azure.cosmos.models.ConflictResolutionPolicy.createLastWriterWinsPolicy()"
name: "createLastWriterWinsPolicy()"
nameWithType: "ConflictResolutionPolicy.createLastWriterWinsPolicy()"
summary: "Creates a LAST\\_WRITER\\_WINS <xref uid=\"com.azure.cosmos.models.ConflictResolutionPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionPolicy\"></xref> with \"/\\_ts\" as the resolution path."
modifiers:
- "static"
syntax: "public static ConflictResolutionPolicy createLastWriterWinsPolicy()"
desc: "Creates a LAST\\_WRITER\\_WINS <xref uid=\"com.azure.cosmos.models.ConflictResolutionPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionPolicy\"></xref> with \"/\\_ts\" as the resolution path.\n\nIn case of a conflict occurring on an item, the item with the higher integer value in the default path <xref uid=\"com.azure.cosmos.implementation.Resource.getTimestamp*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Resource#getTimestamp()\"></xref> ()\\}, i.e., \"/\\_ts\" will be used. <xref uid=\"com.azure.cosmos.implementation.Resource.getTimestamp*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Resource#getTimestamp()\"></xref>, i.e., \"/\\_ts\" will be used."
returns:
description: "ConflictResolutionPolicy."
type: "<xref href=\"com.azure.cosmos.models.ConflictResolutionPolicy?alt=com.azure.cosmos.models.ConflictResolutionPolicy&text=ConflictResolutionPolicy\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.models.ConflictResolutionPolicy.createLastWriterWinsPolicy(java.lang.String)"
fullName: "com.azure.cosmos.models.ConflictResolutionPolicy.createLastWriterWinsPolicy(String conflictResolutionPath)"
name: "createLastWriterWinsPolicy(String conflictResolutionPath)"
nameWithType: "ConflictResolutionPolicy.createLastWriterWinsPolicy(String conflictResolutionPath)"
summary: "Creates a LAST\\_WRITER\\_WINS <xref uid=\"com.azure.cosmos.models.ConflictResolutionPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionPolicy\"></xref> with path as the resolution path."
modifiers:
- "static"
parameters:
- description: "The path to check values for last-writer wins conflict resolution.\n That path is a rooted path of the property in the item, such as \"/name/first\"."
name: "conflictResolutionPath"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
syntax: "public static ConflictResolutionPolicy createLastWriterWinsPolicy(String conflictResolutionPath)"
desc: "Creates a LAST\\_WRITER\\_WINS <xref uid=\"com.azure.cosmos.models.ConflictResolutionPolicy\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionPolicy\"></xref> with path as the resolution path.\n\nThe specified path must be present in each item and must be an integer value. In case of a conflict occurring on an item, the item with the higher integer value in the specified path will be picked."
returns:
description: "ConflictResolutionPolicy."
type: "<xref href=\"com.azure.cosmos.models.ConflictResolutionPolicy?alt=com.azure.cosmos.models.ConflictResolutionPolicy&text=ConflictResolutionPolicy\" data-throw-if-not-resolved=\"False\" />"
- uid: "com.azure.cosmos.models.ConflictResolutionPolicy.getConflictResolutionPath()"
fullName: "com.azure.cosmos.models.ConflictResolutionPolicy.getConflictResolutionPath()"
name: "getConflictResolutionPath()"
nameWithType: "ConflictResolutionPolicy.getConflictResolutionPath()"
summary: "Gets the path which is present in each item in the Azure Cosmos DB service for last writer wins conflict-resolution."
syntax: "public String getConflictResolutionPath()"
desc: "Gets the path which is present in each item in the Azure Cosmos DB service for last writer wins conflict-resolution. This path must be present in each item and must be an integer value. In case of a conflict occurring on an item, the item with the higher integer value in the specified path will be picked. If the path is unspecified, by default the <xref uid=\"com.azure.cosmos.implementation.Resource.getTimestamp*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Resource#getTimestamp()\"></xref> ()\\} path will be used.\n\nThis value should only be set when using <xref uid=\"com.azure.cosmos.models.ConflictResolutionMode.LAST_WRITER_WINS\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionMode#LAST_WRITER_WINS\"></xref>"
returns:
description: "The path to check values for last-writer wins conflict resolution.\n That path is a rooted path of the property in the item, such as \"/name/first\"."
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.azure.cosmos.models.ConflictResolutionPolicy.getConflictResolutionProcedure()"
fullName: "com.azure.cosmos.models.ConflictResolutionPolicy.getConflictResolutionProcedure()"
name: "getConflictResolutionProcedure()"
nameWithType: "ConflictResolutionPolicy.getConflictResolutionProcedure()"
summary: "Gets the <xref uid=\"com.azure.cosmos.implementation.StoredProcedure\" data-throw-if-not-resolved=\"false\" data-raw-source=\"StoredProcedure\"></xref> which is used for conflict resolution in the Azure Cosmos DB service."
syntax: "public String getConflictResolutionProcedure()"
desc: "Gets the <xref uid=\"com.azure.cosmos.implementation.StoredProcedure\" data-throw-if-not-resolved=\"false\" data-raw-source=\"StoredProcedure\"></xref> which is used for conflict resolution in the Azure Cosmos DB service. This stored procedure may be created after the <xref uid=\"com.azure.cosmos.models.CosmosContainerProperties\" data-throw-if-not-resolved=\"false\" data-raw-source=\"CosmosContainerProperties\"></xref> is created and can be changed as required.\n\n * This value should only be set when using <xref uid=\"com.azure.cosmos.models.ConflictResolutionMode.CUSTOM\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionMode#CUSTOM\"></xref>\n * In case the stored procedure fails or throws an exception, the conflict resolution will default to registering conflicts in the conflicts feed\n * The user can provide the stored procedure @see <xref uid=\"com.azure.cosmos.implementation.Resource.getId*\" data-throw-if-not-resolved=\"false\" data-raw-source=\"Resource#getId()\"></xref> ()\\}\n\n\\*"
returns:
description: "the stored procedure to perform conflict resolution.]"
type: "<a href=\"https://docs.oracle.com/javase/8/docs/api/java/lang/String.html\">String</a>"
- uid: "com.azure.cosmos.models.ConflictResolutionPolicy.getMode()"
fullName: "com.azure.cosmos.models.ConflictResolutionPolicy.getMode()"
name: "getMode()"
nameWithType: "ConflictResolutionPolicy.getMode()"
summary: "Gets the <xref uid=\"com.azure.cosmos.models.ConflictResolutionMode\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionMode\"></xref> in the Azure Cosmos DB service."
syntax: "public ConflictResolutionMode getMode()"
desc: "Gets the <xref uid=\"com.azure.cosmos.models.ConflictResolutionMode\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionMode\"></xref> in the Azure Cosmos DB service. By default it is <xref uid=\"com.azure.cosmos.models.ConflictResolutionMode.LAST_WRITER_WINS\" data-throw-if-not-resolved=\"false\" data-raw-source=\"ConflictResolutionMode#LAST_WRITER_WINS\"></xref>."
returns:
description: "ConflictResolutionMode."
type: "<xref href=\"com.azure.cosmos.models.ConflictResolutionMode?alt=com.azure.cosmos.models.ConflictResolutionMode&text=ConflictResolutionMode\" data-throw-if-not-resolved=\"False\" />"
type: "class"
desc: "Represents the conflict resolution policy configuration for specifying how to resolve conflicts in case writes from different regions result in conflicts on items in the container in the Azure Cosmos DB service. Refer to: https://docs.microsoft.com/en-us/azure/cosmos-db/conflict-resolution-policies\n\nA container with custom conflict resolution with no user-registered stored procedure.\n\n```java\nCosmosContainerProperties containerProperties =\n new CosmosContainerProperties(\"Multi-master container\", \"Multi-master container partition key\");\n containerProperties.setConflictResolutionPolicy(ConflictResolutionPolicy.createCustomPolicy());\n\n CosmosAsyncDatabase database = client.createDatabase(databaseProperties).block().getDatabase();\n CosmosAsyncContainer container = database.createContainer(containerProperties).block().getContainer();\n```\n\nA container with custom conflict resolution with a user-registered stored procedure.\n\n```java\nCosmosContainerProperties containerProperties =\n new CosmosContainerProperties(\"Multi-master container\", \"Multi-master container partition key\");\n\n ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy(conflictResolutionSprocName);\n containerProperties.setConflictResolutionPolicy(policy);\n\n CosmosAsyncDatabase database = client.createDatabase(databaseProperties).block().getDatabase();\n CosmosAsyncContainer container = database.createContainer(containerProperties).block().getContainer();\n```\n\nA container with last writer wins conflict resolution, based on a path in the conflicting items. A container with custom conflict resolution with a user-registered stored procedure.\n\n```java\nCosmosContainerProperties containerProperties =\n new CosmosContainerProperties(\"Multi-master container\", \"Multi-master container partition key\");\n\n ConflictResolutionPolicy policy = ConflictResolutionPolicy.createLastWriterWinsPolicy(\"/path/for/conflict/resolution\");\n containerProperties.setConflictResolutionPolicy(policy);\n\n CosmosAsyncDatabase database = client.createDatabase(databaseProperties).block().getDatabase();\n CosmosAsyncContainer container = database.createContainer(containerProperties).block().getContainer();\n```"
metadata: {}
package: "com.azure.cosmos.models"
artifact: com.azure:azure-cosmos:4.63.3