次の方法で共有


ConflictResolutionPolicy クラス

  • java.lang.Object

public class ConflictResolutionPolicy extends JsonSerializable

異なるリージョンからの書き込みが Azure Cosmos DB サービスのコレクション内のドキュメントで競合する場合に、競合を解決する方法を指定するための競合解決ポリシー構成を表します。

ユーザー登録ストアド プロシージャのないカスタム競合解決を持つコレクション。

DocumentCollection collectionSpec = new DocumentCollection();
    collectionSpec.setId("Multi-master collection");
    
    ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy();
    collectionSpec.setConflictResolutionPolicy(policy);
    
    DocumentCollection collection = client.createCollection(databaseLink, collectionSpec, null)
            .toBlocking().single().getResource();
    

ユーザー登録ストアド プロシージャとのカスタム競合解決を含むコレクション。

DocumentCollection collectionSpec = new DocumentCollection();
    collectionSpec.setId("Multi-master collection");
    
    ConflictResolutionPolicy policy = ConflictResolutionPolicy.createCustomPolicy(conflictResolutionSprocName);
    collectionSpec.setConflictResolutionPolicy(policy);
    
    DocumentCollection collection = client.createCollection(databaseLink, collectionSpec, null)
            .toBlocking().single().getResource();
    

最後のライターを持つコレクションは、競合するドキュメント内のパスに基づいて競合解決を優先します。 ユーザー登録ストアド プロシージャとのカスタム競合解決を含むコレクション。

DocumentCollection collectionSpec = new DocumentCollection();
    collectionSpec.setId("Multi-master collection");
    
    ConflictResolutionPolicy policy = ConflictResolutionPolicy.createLastWriterWinsPolicy("/path/for/conflict/resolution");
    collectionSpec.setConflictResolutionPolicy(policy);
    
    DocumentCollection collection = client.createCollection(databaseLink, collectionSpec, null)
            .toBlocking().single().getResource();
    

コンストラクターの概要

コンストラクター 説明
ConflictResolutionPolicy(String jsonString)

メソッドの概要

修飾子と型 メソッドと説明
ConflictResolutionPolicy createCustomPolicy()

を使用StoredProcedureせずに Custom を作成しますConflictResolutionPolicy。 ユーザーは手動で競合を解決する必要があります。

競合は競合フィードに登録され、ユーザーは手動で解決する必要があります。

ConflictResolutionPolicy createCustomPolicy(String conflictResolutionSprocName)

指定したストアド プロシージャを使用して競合解決を実行する Custom を ConflictResolutionPolicy 作成します

このストアド プロシージャは、 が作成された後に DocumentCollection 作成され、必要に応じて変更できます。

    <li>
    
      <p>In case the stored procedure fails or throws an exception, the conflict resolution will default to registering conflicts in the conflicts feed </p>
    
    </li>
    
    <li>
    
      <p>The user can provide the stored procedure </p>
    
    </li>
    

ConflictResolutionPolicy createLastWriterWinsPolicy()

解決パスとして "/_ts" を持つ LastWriterWins ConflictResolutionPolicy を作成します。

ドキュメントで競合が発生した場合、既定のパス getTimestamp()の整数値が高いドキュメント ("/_ts" が使用されます。

ConflictResolutionPolicy createLastWriterWinsPolicy(String conflictResolutionPath)

解決パスとしてパスを持つ LastWriterWins ConflictResolutionPolicy を作成します。

指定したパスは、各ドキュメントに存在し、整数値である必要があります。 ドキュメントで競合が発生した場合、指定したパスの整数値が高いドキュメントが選択されます。

ConflictResolutionMode getConflictResolutionMode()

Azure Cosmos DB サービスの を ConflictResolutionMode 取得します。 既定では、 です LastWriterWins

String getConflictResolutionPath()

最後のライターが競合解決を優先するために、Azure Cosmos DB サービスの各ドキュメントに存在するパスを取得します。 このパスは、各ドキュメントに存在し、整数値である必要があります。 ドキュメントで競合が発生した場合、指定したパスの整数値が高いドキュメントが選択されます。 パスが指定されていない場合、既定ではパスが getTimestamp() 使用されます。

この値は、 を使用する場合にのみ設定する必要があります LastWriterWins

String getConflictResolutionProcedure()

StoredProcedure Azure Cosmos DB サービスの競合解決に使用される を取得します。 このストアド プロシージャは、 が作成された後に DocumentCollection 作成され、必要に応じて変更できます。

    <li>
    
      <p>This value should only be set when using <xref uid="com.microsoft.azure.cosmosdb.ConflictResolutionMode.Custom" data-throw-if-not-resolved="false" data-raw-source="ConflictResolutionMode#Custom"></xref></p>
    
    </li>
    
    <li>
    
      <p>In case the stored procedure fails or throws an exception, the conflict resolution will default to registering conflicts in the conflicts feed </p>
    
    </li>
    
    <li>
    
      <p>The user can provide the stored procedure </p>
    
    </li>
    

継承メンバー

コンストラクターの詳細

ConflictResolutionPolicy

public ConflictResolutionPolicy(String jsonString)

パラメーター:

jsonString

メソッドの詳細

createCustomPolicy

public static ConflictResolutionPolicy createCustomPolicy()

を使用StoredProcedureせずに Custom を作成しますConflictResolutionPolicy。 ユーザーは手動で競合を解決する必要があります。

競合は競合フィードに登録され、ユーザーは手動で解決する必要があります。

戻り値:

ConflictResolutionPolicy。

createCustomPolicy

public static ConflictResolutionPolicy createCustomPolicy(String conflictResolutionSprocName)

指定したストアド プロシージャを使用して競合解決を実行する Custom を ConflictResolutionPolicy 作成します

このストアド プロシージャは、 が作成された後に DocumentCollection 作成され、必要に応じて変更できます。

    <li>
    
      <p>In case the stored procedure fails or throws an exception, the conflict resolution will default to registering conflicts in the conflicts feed </p>
    
    </li>
    
    <li>
    
      <p>The user can provide the stored procedure </p>
    
    </li>
    

パラメーター:

conflictResolutionSprocName - 競合の解決を実行するストアド プロシージャ。

戻り値:

ConflictResolutionPolicy。

createLastWriterWinsPolicy

public static ConflictResolutionPolicy createLastWriterWinsPolicy()

解決パスとして "/_ts" を持つ LastWriterWins ConflictResolutionPolicy を作成します。

ドキュメントで競合が発生した場合、既定のパス getTimestamp()の整数値が高いドキュメント ("/_ts" が使用されます。

戻り値:

ConflictResolutionPolicy。

createLastWriterWinsPolicy

public static ConflictResolutionPolicy createLastWriterWinsPolicy(String conflictResolutionPath)

解決パスとしてパスを持つ LastWriterWins ConflictResolutionPolicy を作成します。

指定したパスは、各ドキュメントに存在し、整数値である必要があります。 ドキュメントで競合が発生した場合、指定したパスの整数値が高いドキュメントが選択されます。

パラメーター:

conflictResolutionPath - last-writer のチェック値へのパスが競合解決を優先します。 このパスは、ドキュメント内のプロパティのルートパスです ("/name/first" など)。

戻り値:

ConflictResolutionPolicy。

getConflictResolutionMode

public ConflictResolutionMode getConflictResolutionMode()

Azure Cosmos DB サービスの を ConflictResolutionMode 取得します。 既定では、 です LastWriterWins

戻り値:

ConflictResolutionMode。

getConflictResolutionPath

public String getConflictResolutionPath()

最後のライターが競合解決を優先するために、Azure Cosmos DB サービスの各ドキュメントに存在するパスを取得します。 このパスは、各ドキュメントに存在し、整数値である必要があります。 ドキュメントで競合が発生した場合、指定したパスの整数値が高いドキュメントが選択されます。 パスが指定されていない場合、既定ではパスが getTimestamp() 使用されます。

この値は、 を使用する場合にのみ設定する必要があります LastWriterWins

戻り値:

last-writer のチェック値へのパスが競合解決を優先します。 このパスは、ドキュメント内のプロパティのルートパスです ("/name/first" など)。

getConflictResolutionProcedure

public String getConflictResolutionProcedure()

StoredProcedure Azure Cosmos DB サービスの競合解決に使用される を取得します。 このストアド プロシージャは、 が作成された後に DocumentCollection 作成され、必要に応じて変更できます。

    <li>
    
      <p>This value should only be set when using <xref uid="com.microsoft.azure.cosmosdb.ConflictResolutionMode.Custom" data-throw-if-not-resolved="false" data-raw-source="ConflictResolutionMode#Custom"></xref></p>
    
    </li>
    
    <li>
    
      <p>In case the stored procedure fails or throws an exception, the conflict resolution will default to registering conflicts in the conflicts feed </p>
    
    </li>
    
    <li>
    
      <p>The user can provide the stored procedure </p>
    
    </li>
    

戻り値:

競合解決を実行するストアド プロシージャ。

適用対象