Skip to content

Commit aad4592

Browse files
Renaming and adding small fixes
1 parent eb0fd11 commit aad4592

File tree

5 files changed

+20
-18
lines changed

5 files changed

+20
-18
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.uid2</groupId>
88
<artifactId>uid2-operator</artifactId>
9-
<version>5.42.6</version>
9+
<version>6.0.0</version>
1010

1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

src/main/java/com/uid2/operator/Main.java

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public class Main {
8282
private IStatsCollectorQueue _statsCollectorQueue;
8383
private RotatingServiceStore serviceProvider;
8484
private RotatingServiceLinkStore serviceLinkProvider;
85-
private RotatingCloudEncryptionKeyApiProvider s3KeyProvider;
85+
private RotatingCloudEncryptionKeyApiProvider cloudEncryptionKeyProvider;
8686

8787
public Main(Vertx vertx, JsonObject config) throws Exception {
8888
this.vertx = vertx;
@@ -134,17 +134,17 @@ public Main(Vertx vertx, JsonObject config) throws Exception {
134134
this.fsOptOut = configureCloudOptOutStore();
135135
}
136136

137-
String s3KeyMdPath = this.config.getString(Const.Config.CloudEncryptionKeysMetadataPathProp);
138-
this.s3KeyProvider = new RotatingCloudEncryptionKeyApiProvider(fsStores, new GlobalScope(new CloudPath(s3KeyMdPath)));
137+
String cloudEncryptionKeyMdPath = this.config.getString(Const.Config.CloudEncryptionKeysMetadataPathProp);
138+
this.cloudEncryptionKeyProvider = new RotatingCloudEncryptionKeyApiProvider(fsStores, new GlobalScope(new CloudPath(cloudEncryptionKeyMdPath)));
139139
String sitesMdPath = this.config.getString(Const.Config.SitesMetadataPathProp);
140140
String keypairMdPath = this.config.getString(Const.Config.ClientSideKeypairsMetadataPathProp);
141141
this.clientSideKeypairProvider = new RotatingClientSideKeypairStore(fsStores, new GlobalScope(new CloudPath(keypairMdPath)));
142142
String clientsMdPath = this.config.getString(Const.Config.ClientsMetadataPathProp);
143-
this.clientKeyProvider = new RotatingClientKeyProvider(fsStores, new GlobalScope(new CloudPath(clientsMdPath)),s3KeyProvider);
143+
this.clientKeyProvider = new RotatingClientKeyProvider(fsStores, new GlobalScope(new CloudPath(clientsMdPath)), cloudEncryptionKeyProvider);
144144
String keysetKeysMdPath = this.config.getString(Const.Config.KeysetKeysMetadataPathProp);
145-
this.keysetKeyStore = new RotatingKeysetKeyStore(fsStores, new GlobalScope(new CloudPath(keysetKeysMdPath)),s3KeyProvider);
145+
this.keysetKeyStore = new RotatingKeysetKeyStore(fsStores, new GlobalScope(new CloudPath(keysetKeysMdPath)), cloudEncryptionKeyProvider);
146146
String keysetMdPath = this.config.getString(Const.Config.KeysetsMetadataPathProp);
147-
this.keysetProvider = new RotatingKeysetProvider(fsStores, new GlobalScope(new CloudPath(keysetMdPath)),s3KeyProvider);
147+
this.keysetProvider = new RotatingKeysetProvider(fsStores, new GlobalScope(new CloudPath(keysetMdPath)), cloudEncryptionKeyProvider);
148148
String saltsMdPath = this.config.getString(Const.Config.SaltsMetadataPathProp);
149149
this.saltProvider = new RotatingSaltProvider(fsStores, saltsMdPath);
150150
this.optOutStore = new CloudSyncOptOutStore(vertx, fsLocal, this.config, operatorKey, Clock.systemUTC());
@@ -156,7 +156,7 @@ public Main(Vertx vertx, JsonObject config) throws Exception {
156156
this.serviceLinkProvider = new RotatingServiceLinkStore(fsStores, new GlobalScope(new CloudPath(serviceLinkMdPath)));
157157
}
158158

159-
this.siteProvider = clientSideTokenGenerate ? new RotatingSiteStore(fsStores, new GlobalScope(new CloudPath(sitesMdPath)), s3KeyProvider) : null;
159+
this.siteProvider = clientSideTokenGenerate ? new RotatingSiteStore(fsStores, new GlobalScope(new CloudPath(sitesMdPath)), cloudEncryptionKeyProvider) : null;
160160

161161
if (useStorageMock && coreAttestUrl == null) {
162162
if (clientSideTokenGenerate) {
@@ -167,7 +167,7 @@ public Main(Vertx vertx, JsonObject config) throws Exception {
167167
this.saltProvider.loadContent();
168168
this.keysetProvider.loadContent();
169169
this.keysetKeyStore.loadContent();
170-
this.s3KeyProvider.loadContent();
170+
this.cloudEncryptionKeyProvider.loadContent();
171171

172172
if (this.validateServiceLinks) {
173173
this.serviceProvider.loadContent();
@@ -307,6 +307,8 @@ private void run() throws Exception {
307307

308308
private Future<Void> createStoreVerticles() throws Exception {
309309
// load metadatas for the first time
310+
cloudEncryptionKeyProvider.loadContent();
311+
310312
if (clientSideTokenGenerate) {
311313
siteProvider.getMetadata();
312314
clientSideKeypairProvider.getMetadata();
@@ -335,7 +337,7 @@ private Future<Void> createStoreVerticles() throws Exception {
335337
fs.add(createAndDeployRotatingStoreVerticle("auth", clientKeyProvider, "auth_refresh_ms"));
336338
fs.add(createAndDeployRotatingStoreVerticle("keyset", keysetProvider, "keyset_refresh_ms"));
337339
fs.add(createAndDeployRotatingStoreVerticle("keysetkey", keysetKeyStore, "keysetkey_refresh_ms"));
338-
fs.add(createAndDeployRotatingStoreVerticle("cloud_encryption_keys", s3KeyProvider, "s3keys_refresh_ms"));
340+
fs.add(createAndDeployRotatingStoreVerticle("cloud_encryption_keys", cloudEncryptionKeyProvider, "cloud_encryption_keys_refresh_ms"));
339341
fs.add(createAndDeployRotatingStoreVerticle("salt", saltProvider, "salt_refresh_ms"));
340342
fs.add(createAndDeployCloudSyncStoreVerticle("optout", fsOptOut, optOutCloudSync));
341343
CompositeFuture.all(fs).onComplete(ar -> {

src/main/java/com/uid2/operator/reader/ApiStoreReader.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ public long loadContent(JsonObject contents, String dataType) throws Exception {
2828
}
2929

3030
try {
31-
JsonArray s3KeysArray = contents.getJsonArray(dataType);
32-
if (s3KeysArray == null) {
31+
JsonArray dataArray = contents.getJsonArray(dataType);
32+
if (dataArray == null) {
3333
throw new IllegalArgumentException("No array found in the contents");
3434
}
3535

36-
String jsonString = s3KeysArray.toString();
36+
String jsonString = dataArray.toString();
3737
InputStream inputStream = new ByteArrayInputStream(jsonString.getBytes(StandardCharsets.UTF_8));
3838

3939
ParsingResult<T> parsed = parser.deserialize(inputStream);

src/main/java/com/uid2/operator/reader/RotatingCloudEncryptionKeyApiProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public CloudPath getMetadataPath() {
3535

3636
@Override
3737
public long loadContent(JsonObject metadata) throws Exception {
38-
return apiStoreReader.loadContent(metadata, "s3Keys");
38+
return apiStoreReader.loadContent(metadata, "cloudEncryptionKeys");
3939
}
4040

4141
@Override

src/test/java/com/uid2/operator/RotatingCloudEncryptionKeyApiProviderTest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,11 @@ void testGetMetadataPath() {
6161
@Test
6262
void testLoadContentWithMetadata() throws Exception {
6363
JsonObject metadata = new JsonObject();
64-
when(mockApiStoreReader.loadContent(metadata, "s3Keys")).thenReturn(1L);
64+
when(mockApiStoreReader.loadContent(metadata, "cloudEncryptionKeys")).thenReturn(1L);
6565

6666
long version = rotatingCloudEncryptionKeyApiProvider.loadContent(metadata);
6767
assertEquals(1L, version);
68-
verify(mockApiStoreReader).loadContent(metadata, "s3Keys");
68+
verify(mockApiStoreReader).loadContent(metadata, "cloudEncryptionKeys");
6969
}
7070

7171
@Test
@@ -94,10 +94,10 @@ void testGetAllWithNullSnapshot() {
9494
void testLoadContent() throws Exception {
9595
JsonObject metadata = new JsonObject().put("version", 1L);
9696
when(mockApiStoreReader.getMetadata()).thenReturn(metadata);
97-
when(mockApiStoreReader.loadContent(metadata, "s3Keys")).thenReturn(1L);
97+
when(mockApiStoreReader.loadContent(metadata, "cloudEncryptionKeys")).thenReturn(1L);
9898

9999
rotatingCloudEncryptionKeyApiProvider.loadContent();
100100
verify(mockApiStoreReader).getMetadata();
101-
verify(mockApiStoreReader).loadContent(metadata, "s3Keys");
101+
verify(mockApiStoreReader).loadContent(metadata, "cloudEncryptionKeys");
102102
}
103103
}

0 commit comments

Comments
 (0)