-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BREAKING] Break dependency of ebean-dao on metadata-models. (#1895)
The coupling was between the static path extractor API. This broken by making a new `UrnPathExtractor` interface, and adding an overload of `EbeanLocalDAO`'s constructor to accept one (no breaking constructor change). The old constructors default to an `EmptyPathExtractor`, which does nothing (which is a breaking behavioral change, see below). BREAKING: `DatasetUrnPathExtractor` was deleted. No one should've been depending on this directly. However, downstreams that were relying on it being there at runtime (dataset GMS) need to copy `DatasetUrnPathExtractor` and create their `EbeanLocalDAO` with one. Note that this is a little dangerous becasue it is a runtime behavioral change only. Potential impact is that SCSI suddenly stops working as intended. SYNC=metadata-models_101.0.0
- Loading branch information
John Plaisted
authored
Sep 28, 2020
1 parent
b6d26f7
commit 2f86cd6
Showing
11 changed files
with
290 additions
and
216 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
18 changes: 18 additions & 0 deletions
18
...a-dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/scsi/EmptyPathExtractor.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,18 @@ | ||
package com.linkedin.metadata.dao.scsi; | ||
|
||
import com.linkedin.common.urn.Urn; | ||
import java.util.Collections; | ||
import java.util.Map; | ||
import javax.annotation.Nonnull; | ||
|
||
|
||
/** | ||
* A path extractor which does nothing. | ||
*/ | ||
public final class EmptyPathExtractor<URN extends Urn> implements UrnPathExtractor<URN> { | ||
@Nonnull | ||
@Override | ||
public Map<String, Object> extractPaths(@Nonnull URN urn) { | ||
return Collections.emptyMap(); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
...ata-dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/scsi/UrnPathExtractor.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,29 @@ | ||
package com.linkedin.metadata.dao.scsi; | ||
|
||
import com.linkedin.common.urn.Urn; | ||
import java.util.Map; | ||
import javax.annotation.Nonnull; | ||
|
||
|
||
/** | ||
* Given an URN, extracts a map containing parts of the urn to values to index in the secondary index. | ||
* | ||
* <p>This should map all urn parts and values you may wish to query in the secondary index. Nested values can also | ||
* be extracted. | ||
* | ||
* <p>For example, if dataset URN is like {@code urn:li:dataset:(urn:li:platform:%PLATFORM_NAME%),%NAME%,%ORIGIN%)} then | ||
* an implementation that parses datset URNs may return a map like: | ||
* | ||
* <pre> | ||
* /platform -> urn:li:platform:%PLATFORM_NAME% | ||
* /platform/platformName -> %PLATFORM_NAME% | ||
* /datasetName -> %NAME% | ||
* /origin -> %ORIGIN% | ||
* </pre> | ||
* | ||
* @param <URN> the concrete URN type this can extract paths from | ||
*/ | ||
public interface UrnPathExtractor<URN extends Urn> { | ||
@Nonnull | ||
Map<String, Object> extractPaths(@Nonnull URN urn); | ||
} |
25 changes: 0 additions & 25 deletions
25
...impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/utils/DatasetUrnPathExtractor.java
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
.../ebean-dao/src/main/java/com/linkedin/metadata/dao/utils/RegisteredUrnPathExtractors.java
This file was deleted.
Oops, something went wrong.
14 changes: 0 additions & 14 deletions
14
...ta-dao-impl/ebean-dao/src/main/java/com/linkedin/metadata/dao/utils/UrnPathExtractor.java
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.