-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: nrtmv4 client setup * feat: add whois-nrtm4-client everywhere * feat: get common dependencies in whois-nrtm-client (aspectJ in them) * feat: read unf and store main information * feat: fix repository * feat: clarify reader * feat: remove unnecesary value injection * feat: add schema creation changes * feat: fix schema syntax error * feat: hardcode for now nrtm baseUrl * feat: hardcode RC * feat: fix compilation issues * feat: add logs and fix the name * feat: change properties and put logs in the condition * feat: add logs * feat: fix log * feat: create nrtm rest client * feat: fix typo * feat: run schedule task each minute * feat: add nrtm4 client to api db endtoend modules * feat: add source log * feat: try catch duplicated key exception when the version already exist * feat: refactor * feat: remove the changes of rest client * feat: remove unused import * feat: change nrtm data soure configurations name * feat: use a rowmapper in between sources call and jsonnode * feat: fix compilation issue * feat: add retrn statment * feat: fix get resources * feat: fix baseUrl * feat: remove the slash from url * feat: ignore unknown properties * feat: filter by version and fix the mapper * feat: handle when table is null * feat: refactor for clarifications * feat: fix sql * feat: check not null * feat: add logs * feat: remove logs and add the group by to fix the query * feat: refactor * feat: put the dependency again in whois-api * feat: do no restart if notification is the same * feat: remove initializeNRTMClient module body * feat: create nrtm dummy server * feat: remove unused import and add the conditional * feat: rename it by client * feat: rename the condition * feat: add dependsOn dependency and conditional just for the config * feat: do not use dependsOn use conditional * feat: add UNF client ITs * feat: add snapshot support * feat: add ITs of snapshot file creation * feat: fix ITs * feat: add hash validation * feat: test fake hash * feat: remove unrelated changes * feat: unrelated changes * feat: unrelated changes * feat: move into confition packets and fix ITs * feat: refactor * feat: little refactor * feat: catch all exceptions * feat: add rollback * feat: add deltas import in NRTM client, ITs remaining * feat: refactor * feat: refactor deltas and add ITs * feat: rename * feat: add stopwatch * feat: log miliseconds * feat: add log for loading snapshot * feat: add log * feat: refactor decompress and put a bigger buffer * feat: add logs * feat: refactor and use parallel stream * feat: move the stopwatch * feat: fix indentation * feat: some performance improvements * feat: fix logs and timer issues * feat: save the update notification after creating the snapshot * feat: redo previous change * feat: add logs * feat: refactor code * feat: parallelise * feat: do not process the decompression in parallel, use parallel are record level * feat: use batches and reduce the threads * feat: reduce threads usage * feat: shudown the executor * parallelise the batches * feat: try with batches of 1k objects * feat: use library * feat: refactor and increase the size of the batches * feat: remove unecessary code and logs * feat: remove unecessary changes * feat: update tests * feat: fix tests * feat: add content type as a header * feat: add correct public key in main resources and move test public key to test resources * feat: put the correct key * feat: add data to serials and remaining tables * feat: do not ignore error when inserting deltas and fix the Mocks instead * feat: refactors * feat: comments * feat: process record directly without reading whole payload beforehand * feat: change public key * feat: rename * feat: add ITs of reinitialisation * feat: refactor * feat: rename and remove unecessary import
- Loading branch information
Showing
27 changed files
with
703 additions
and
118 deletions.
There are no files selected for viewing
58 changes: 58 additions & 0 deletions
58
whois-nrtm4-client/src/main/java/net/ripe/db/nrtm4/client/client/MirrorDeltaInfo.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,58 @@ | ||
package net.ripe.db.nrtm4.client.client; | ||
|
||
import com.fasterxml.jackson.annotation.JsonValue; | ||
import net.ripe.db.whois.common.rpsl.ObjectType; | ||
import net.ripe.db.whois.common.rpsl.RpslObject; | ||
|
||
public class MirrorDeltaInfo extends MirrorObjectInfo { | ||
|
||
public enum Action { | ||
DELETE, | ||
ADD_MODIFY; | ||
|
||
@JsonValue | ||
public String toLowerCaseName() { | ||
return name().toLowerCase(); | ||
} | ||
} | ||
|
||
private final Action action; | ||
private final ObjectType objectType; | ||
private final String primaryKey; | ||
|
||
public MirrorDeltaInfo() { | ||
super(null); | ||
this.objectType = null; | ||
this.primaryKey = null; | ||
this.action = null; | ||
} | ||
|
||
public MirrorDeltaInfo(final RpslObject rpslObject) { | ||
super(rpslObject); | ||
this.objectType = null; | ||
this.primaryKey = null; | ||
this.action = null; | ||
} | ||
|
||
public MirrorDeltaInfo(final RpslObject object, | ||
final String action, | ||
final String objectType, | ||
final String primaryKey) { | ||
super(object); | ||
this.action = Action.valueOf(action.toUpperCase()); | ||
this.objectType = objectType != null ? ObjectType.valueOf(objectType) : null; | ||
this.primaryKey = primaryKey; | ||
} | ||
|
||
public Action getAction() { | ||
return action; | ||
} | ||
|
||
public ObjectType getObjectType() { | ||
return objectType; | ||
} | ||
|
||
public String getPrimaryKey() { | ||
return primaryKey; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
whois-nrtm4-client/src/main/java/net/ripe/db/nrtm4/client/client/MirrorObjectInfo.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 net.ripe.db.nrtm4.client.client; | ||
|
||
import com.fasterxml.jackson.databind.annotation.JsonDeserialize; | ||
import net.ripe.db.whois.common.rpsl.RpslObject; | ||
|
||
public abstract class MirrorObjectInfo { | ||
|
||
@JsonDeserialize(using = RpslObjectDeserializer.class) | ||
private final RpslObject object; | ||
|
||
public MirrorObjectInfo(RpslObject object) { | ||
this.object = object; | ||
} | ||
|
||
public RpslObject getRpslObject() { | ||
return object; | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
whois-nrtm4-client/src/main/java/net/ripe/db/nrtm4/client/client/MirrorSnapshotInfo.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,10 @@ | ||
package net.ripe.db.nrtm4.client.client; | ||
|
||
|
||
public class MirrorSnapshotInfo extends MirrorObjectInfo { | ||
|
||
public MirrorSnapshotInfo() { | ||
super(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
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
37 changes: 37 additions & 0 deletions
37
...-nrtm4-client/src/main/java/net/ripe/db/nrtm4/client/importer/AbstractMirrorImporter.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,37 @@ | ||
package net.ripe.db.nrtm4.client.importer; | ||
|
||
import net.ripe.db.nrtm4.client.dao.Nrtm4ClientInfoRepository; | ||
import net.ripe.db.nrtm4.client.dao.Nrtm4ClientRepository; | ||
|
||
import java.security.MessageDigest; | ||
import java.security.NoSuchAlgorithmException; | ||
|
||
import static org.apache.commons.codec.binary.Hex.encodeHexString; | ||
|
||
public abstract class AbstractMirrorImporter { | ||
|
||
final Nrtm4ClientInfoRepository nrtm4ClientInfoRepository; | ||
|
||
final Nrtm4ClientRepository nrtm4ClientRepository; | ||
|
||
public AbstractMirrorImporter(final Nrtm4ClientInfoRepository nrtm4ClientInfoRepository, | ||
final Nrtm4ClientRepository nrtm4ClientRepository){ | ||
this.nrtm4ClientInfoRepository = nrtm4ClientInfoRepository; | ||
this.nrtm4ClientRepository = nrtm4ClientRepository; | ||
} | ||
|
||
String calculateSha256(final byte[] bytes) { | ||
try { | ||
final MessageDigest digest = MessageDigest.getInstance("SHA-256"); | ||
final byte[] encodedSha256hex = digest.digest(bytes); | ||
return encodeHexString(encodedSha256hex); | ||
} catch (final NoSuchAlgorithmException e) { | ||
throw new IllegalStateException(e); | ||
} | ||
} | ||
|
||
public void truncateTables(){ | ||
nrtm4ClientInfoRepository.truncateTables(); | ||
nrtm4ClientRepository.truncateTables(); | ||
} | ||
} |
Oops, something went wrong.