Package com.qfs.desc
Interface IDuplicateKeyHandler
-
public interface IDuplicateKeyHandlerDiscriminate between two records with the same key fields.When we add a
newrecord:- If there is an
oldrecord in the datastore with the same key fields, whethernewwill replaceoldis determined by callingselectDuplicateKeyInDatastore. Ifnewreplacesold, following records in the transaction that have the same key fields will be checked againstnewusingselectDuplicateKeyWithinTransaction(IRecordReader, IRecordReader, IStoreMetadata, IDictionaryProvider, int[], int). - Else, if there is an
otherrecord in the transaction with the same key fields, the record to add is determined by callingselectDuplicateKeyWithinTransaction. Ifnew(resp.other) is chosen, following records in the transaction that have the same key fields will be checked againstnew(resp.other) usingselectDuplicateKeyWithinTransaction(IRecordReader, IRecordReader, IStoreMetadata, IDictionaryProvider, int[], int).
returnedRecordbe the record returned byselectDuplicateKeyWithinTransaction(IRecordReader, IRecordReader, IStoreMetadata, IDictionaryProvider, int[], int)orselectDuplicateKeyInDatastore(IRecordReader, IRecordReader, IStoreMetadata, IDictionaryProvider, int[], int).- If
returnedRecordisnull, then the datastore will remain unchanged. - In the case of
selectDuplicateKeyInDatastore(IRecordReader, IRecordReader, IStoreMetadata, IDictionaryProvider, int[], int), ifreturnedRecord == previousRecordandupdateOnlyIfDifferentis activated, then the datastore will remain unchanged. - In all other cases,
returnedRecordwill be added to the datastore in the current transaction.
- Author:
- ActiveViam
- If there is an
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description IRecordReaderselectDuplicateKeyInDatastore(IRecordReader duplicateRecord, IRecordReader previousRecord, IStoreMetadata storeMetadata, IDictionaryProvider dictionaryProvider, int[] uniqueIndexFields, int partitionId)Defines what should be added in the datastore when aduplicateRecordin the current transaction has the same key as apreviousRecordalready registered in the datastore.default IRecordReaderselectDuplicateKeyWithinTransaction(IRecordReader duplicateRecord, IRecordReader previousRecord, IStoreMetadata storeMetadata, IDictionaryProvider dictionaryProvider, int[] uniqueIndexFields, int partitionId)Defines what should be added in the datastore when aduplicateRecordin the current transaction has the same key as apreviousRecordalso in the current transaction.
-
-
-
Method Detail
-
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 aduplicateRecordin the current transaction has the same key as apreviousRecordalso 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 aduplicateRecordin the current transaction has the same key as apreviousRecordalready registered in the datastore. If nothing should be added (that means, keeppreviousRecord), thennullshould 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.
-
-