Package com.qfs.desc

Interface IDuplicateKeyHandler


public interface IDuplicateKeyHandler
Discriminate between two records with the same key fields.

When we add a new record:

  1. If there is an old record in the datastore with the same key fields, whether new will replace old is determined by calling selectDuplicateKeyInDatastore. If new replaces old, following records in the transaction that have the same key fields will be checked against new using selectDuplicateKeyWithinTransaction(IRecordReader, IRecordReader, IStoreMetadata, IDictionaryProvider, int[], int).
  2. Else, if there is an other record in the transaction with the same key fields, the record to add is determined by calling selectDuplicateKeyWithinTransaction. If new (resp. other) is chosen, following records in the transaction that have the same key fields will be checked against new (resp. other) using selectDuplicateKeyWithinTransaction(IRecordReader, IRecordReader, IStoreMetadata, IDictionaryProvider, int[], int).
Let returnedRecord be the record returned by selectDuplicateKeyWithinTransaction(IRecordReader, IRecordReader, IStoreMetadata, IDictionaryProvider, int[], int) or selectDuplicateKeyInDatastore(IRecordReader, IRecordReader, IStoreMetadata, IDictionaryProvider, int[], int).
Author:
ActiveViam
  • Method Details

    • selectDuplicateKeyWithinTransaction

      default IRecordReader selectDuplicateKeyWithinTransaction(IRecordReader duplicateRecord, IRecordReader previousRecord, IStoreMetadata storeMetadata, IDictionaryProvider dictionaryProvider, int[] uniqueIndexFields, int partitionId)
      Defines what should be added in the datastore when a duplicateRecord in the current transaction has the same key as a previousRecord also in the current transaction.
      Parameters:
      duplicateRecord - The new record that has the same key as the previous record.
      previousRecord - The record registered in the datastore that has the same key as the duplicate record.
      storeMetadata - The store on which the duplication happened.
      dictionaryProvider - The dictionary provider for the store.
      uniqueIndexFields - The id of the fields of the unique index on which we caught a duplicate key event.
      partitionId - The ID of the partition on which the records are.
      Returns:
      The record that will be added in the datastore, or null if the datastore should not be altered.
    • selectDuplicateKeyInDatastore

      IRecordReader selectDuplicateKeyInDatastore(IRecordReader duplicateRecord, IRecordReader previousRecord, IStoreMetadata storeMetadata, IDictionaryProvider dictionaryProvider, int[] uniqueIndexFields, int partitionId)
      Defines what should be added in the datastore when a duplicateRecord in the current transaction has the same key as a previousRecord already registered in the datastore. If nothing should be added (that means, keep previousRecord), then null should be returned..
      Parameters:
      duplicateRecord - The new record that has the same key as the previous record.
      previousRecord - The record registered in the datastore that has the same key as the duplicate record.
      storeMetadata - The store on which the duplication happened.
      dictionaryProvider - The dictionary provider for the store.
      uniqueIndexFields - The id of the fields of the unique index on which we caught a duplicate key event.
      partitionId - The ID of the partition on which the records are.
      Returns:
      The record that will be added in the datastore, or null if the datastore should not be altered.