-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add action emitNoChangeMetadataAuditEvent & add ingestionMode i…
…n mae (#303) * add action emitNoChangeMetadataAuditEvent & add ingestionMode in mae * update doc
- Loading branch information
Showing
10 changed files
with
200 additions
and
14 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
26 changes: 26 additions & 0 deletions
26
dao-api/src/main/java/com/linkedin/metadata/dao/utils/IngestionUtils.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,26 @@ | ||
package com.linkedin.metadata.dao.utils; | ||
|
||
import com.google.common.collect.BiMap; | ||
import com.google.common.collect.HashBiMap; | ||
import com.linkedin.metadata.backfill.BackfillMode; | ||
import com.linkedin.metadata.events.IngestionMode; | ||
|
||
|
||
public class IngestionUtils { | ||
|
||
private IngestionUtils() { | ||
//Utils class | ||
} | ||
|
||
/** | ||
* This method provides the bidirectional mapping between {@link IngestionMode} and {@link BackfillMode}. Only | ||
* user-allowed ingestion modes are included in the mapping. | ||
*/ | ||
public static final BiMap<IngestionMode, BackfillMode> ALLOWED_INGESTION_BACKFILL_BIMAP = createBiMap(); | ||
private static BiMap<IngestionMode, BackfillMode> createBiMap() { | ||
BiMap<IngestionMode, BackfillMode> biMap = HashBiMap.create(); | ||
biMap.put(IngestionMode.BACKFILL, BackfillMode.BACKFILL_INCLUDING_LIVE_INDEX); | ||
biMap.put(IngestionMode.BOOTSTRAP, BackfillMode.BACKFILL_ALL); | ||
return biMap; | ||
} | ||
} |
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
23 changes: 23 additions & 0 deletions
23
dao-api/src/test/java/com/linkedin/metadata/dao/utils/IngestionUtilsTest.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,23 @@ | ||
package com.linkedin.metadata.dao.utils; | ||
|
||
import com.linkedin.metadata.backfill.BackfillMode; | ||
import com.linkedin.metadata.events.IngestionMode; | ||
import org.testng.annotations.Test; | ||
|
||
import static com.linkedin.metadata.dao.utils.IngestionUtils.*; | ||
import static org.testng.Assert.*; | ||
|
||
|
||
public class IngestionUtilsTest { | ||
|
||
@Test | ||
public void testAllowedIngestionModeBackfillModeBimap() { | ||
IngestionMode ingestionMode = IngestionMode.BACKFILL; | ||
BackfillMode backfillMode = ALLOWED_INGESTION_BACKFILL_BIMAP.get(ingestionMode); | ||
assertEquals(BackfillMode.BACKFILL_INCLUDING_LIVE_INDEX, backfillMode); | ||
|
||
assertEquals(ingestionMode, ALLOWED_INGESTION_BACKFILL_BIMAP.inverse().get(backfillMode)); | ||
assertNull(ALLOWED_INGESTION_BACKFILL_BIMAP.get(IngestionMode.LIVE)); | ||
assertNull(ALLOWED_INGESTION_BACKFILL_BIMAP.inverse().get(BackfillMode.MAE_ONLY_WITH_OLD_VALUE_NULL)); | ||
} | ||
} |
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