-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue #3437 remote index kafka consumer
Signed-off-by: Robin Arnold <robin.arnold@ibm.com>
- Loading branch information
1 parent
68819ab
commit 0752bbb
Showing
26 changed files
with
2,225 additions
and
253 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
86 changes: 86 additions & 0 deletions
86
fhir-remote-index/src/main/java/com/ibm/fhir/remote/index/api/BatchParameterProcessor.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,86 @@ | ||
/* | ||
* (C) Copyright IBM Corp. 2022 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.ibm.fhir.remote.index.api; | ||
|
||
import com.ibm.fhir.persistence.exception.FHIRPersistenceException; | ||
import com.ibm.fhir.persistence.index.DateParameter; | ||
import com.ibm.fhir.persistence.index.LocationParameter; | ||
import com.ibm.fhir.persistence.index.NumberParameter; | ||
import com.ibm.fhir.persistence.index.QuantityParameter; | ||
import com.ibm.fhir.persistence.index.StringParameter; | ||
import com.ibm.fhir.persistence.index.TokenParameter; | ||
import com.ibm.fhir.remote.index.database.CodeSystemValue; | ||
import com.ibm.fhir.remote.index.database.CommonTokenValue; | ||
import com.ibm.fhir.remote.index.database.ParameterNameValue; | ||
|
||
/** | ||
* Processes batched parameters | ||
*/ | ||
public interface BatchParameterProcessor { | ||
/** | ||
* Compute the shard key value use to distribute resources among nodes | ||
* of the database | ||
* @param resourceType | ||
* @param logicalId | ||
* @return | ||
*/ | ||
short encodeShardKey(String resourceType, String logicalId); | ||
|
||
/** | ||
* @param resourceType | ||
* @param logicalId | ||
* @param logicalResourceId | ||
* @param parameterNameValue | ||
* @param parameter | ||
*/ | ||
void process(String resourceType, String logicalId, long logicalResourceId, ParameterNameValue parameterNameValue, StringParameter parameter) throws FHIRPersistenceException; | ||
|
||
/** | ||
* @param resourceType | ||
* @param logicalId | ||
* @param logicalResourceId | ||
* @param parameterNameValue | ||
* @param parameter | ||
*/ | ||
void process(String resourceType, String logicalId, long logicalResourceId, ParameterNameValue parameterNameValue, NumberParameter parameter) throws FHIRPersistenceException; | ||
|
||
/** | ||
* @param resourceType | ||
* @param logicalId | ||
* @param logicalResourceId | ||
* @param parameterNameValue | ||
* @param parameter | ||
*/ | ||
void process(String resourceType, String logicalId, long logicalResourceId, ParameterNameValue parameterNameValue, QuantityParameter parameter, CodeSystemValue codeSystemValue) throws FHIRPersistenceException; | ||
|
||
/** | ||
* @param resourceType | ||
* @param logicalId | ||
* @param logicalResourceId | ||
* @param parameterNameValue | ||
* @param parameter | ||
*/ | ||
void process(String resourceType, String logicalId, long logicalResourceId, ParameterNameValue parameterNameValue, LocationParameter parameter) throws FHIRPersistenceException; | ||
|
||
/** | ||
* @param resourceType | ||
* @param logicalId | ||
* @param logicalResourceId | ||
* @param parameterNameValue | ||
* @param parameter | ||
*/ | ||
void process(String resourceType, String logicalId, long logicalResourceId, ParameterNameValue parameterNameValue, DateParameter parameter) throws FHIRPersistenceException; | ||
|
||
/** | ||
* @param resourceType | ||
* @param logicalId | ||
* @param logicalResourceId | ||
* @param parameterNameValue | ||
* @param parameter | ||
*/ | ||
void process(String resourceType, String logicalId, long logicalResourceId, ParameterNameValue parameterNameValue, TokenParameter parameter, CommonTokenValue commonTokenValue) throws FHIRPersistenceException; | ||
} |
40 changes: 40 additions & 0 deletions
40
fhir-remote-index/src/main/java/com/ibm/fhir/remote/index/api/BatchParameterValue.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,40 @@ | ||
/* | ||
* (C) Copyright IBM Corp. 2022 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.ibm.fhir.remote.index.api; | ||
|
||
import com.ibm.fhir.persistence.exception.FHIRPersistenceException; | ||
import com.ibm.fhir.remote.index.database.ParameterNameValue; | ||
|
||
/** | ||
* A parameter value batched for later processing | ||
*/ | ||
public abstract class BatchParameterValue { | ||
protected final ParameterNameValue parameterNameValue; | ||
protected final String resourceType; | ||
protected final String logicalId; | ||
protected final long logicalResourceId; | ||
|
||
/** | ||
* Protected constructor | ||
* @param resourceType | ||
* @param logicalId | ||
* @param logicalResourceId | ||
* @param parameterNameValue | ||
*/ | ||
protected BatchParameterValue(String resourceType, String logicalId, long logicalResourceId, ParameterNameValue parameterNameValue) { | ||
this.resourceType = resourceType; | ||
this.logicalId = logicalId; | ||
this.logicalResourceId = logicalResourceId; | ||
this.parameterNameValue = parameterNameValue; | ||
} | ||
|
||
/** | ||
* Apply this parameter value to the target processor | ||
* @param processor | ||
*/ | ||
public abstract void apply(BatchParameterProcessor processor) throws FHIRPersistenceException; | ||
} |
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
44 changes: 44 additions & 0 deletions
44
fhir-remote-index/src/main/java/com/ibm/fhir/remote/index/api/IdentityCache.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,44 @@ | ||
/* | ||
* (C) Copyright IBM Corp. 2022 | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package com.ibm.fhir.remote.index.api; | ||
|
||
|
||
/** | ||
* Interface to hides the implementation of various caches we use during | ||
* ingestion persistence | ||
*/ | ||
public interface IdentityCache { | ||
/** | ||
* Get the parameter_name_id value for the given parameterName | ||
* @param parameterName | ||
* @return the parameter_name_id or null if the value is not found in the cache | ||
*/ | ||
Integer getParameterNameId(String parameterName); | ||
|
||
/** | ||
* Get the code_system_id value for the given codeSystem value | ||
* @param codeSystem | ||
* @return the code_system_id or null if the value is not found in the cache | ||
*/ | ||
Integer getCodeSystemId(String codeSystem); | ||
|
||
/** | ||
* Get the common_token_value_id for the given codeSystem and tokenValue | ||
* @param shardKey | ||
* @param codeSystem | ||
* @param tokenValue | ||
* @return the common_token_value_id or null if the value is not found in the cache | ||
*/ | ||
Long getCommonTokenValueId(short shardKey, String codeSystem, String tokenValue); | ||
|
||
/** | ||
* Add the given parameterName to parameterNameId mapping to the cache | ||
* @param parameterName | ||
* @param parameterNameId | ||
*/ | ||
void addParameterName(String parameterName, int parameterNameId); | ||
} |
Oops, something went wrong.