Skip to content

Commit 9990341

Browse files
authored
Merge pull request #327 from aiven/ivanyu/config-package
Create config package
2 parents 6700ae0 + f1414cf commit 9990341

File tree

5 files changed

+20
-19
lines changed

5 files changed

+20
-19
lines changed

core/src/main/java/io/aiven/kafka/tieredstorage/RemoteStorageManager.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
import io.aiven.kafka.tieredstorage.chunkmanager.ChunkManager;
4444
import io.aiven.kafka.tieredstorage.chunkmanager.ChunkManagerFactory;
45+
import io.aiven.kafka.tieredstorage.config.RemoteStorageManagerConfig;
4546
import io.aiven.kafka.tieredstorage.manifest.SegmentEncryptionMetadata;
4647
import io.aiven.kafka.tieredstorage.manifest.SegmentEncryptionMetadataV1;
4748
import io.aiven.kafka.tieredstorage.manifest.SegmentManifest;
@@ -78,9 +79,9 @@
7879
import org.slf4j.Logger;
7980
import org.slf4j.LoggerFactory;
8081

81-
import static io.aiven.kafka.tieredstorage.RemoteStorageManagerConfig.METRICS_NUM_SAMPLES_CONFIG;
82-
import static io.aiven.kafka.tieredstorage.RemoteStorageManagerConfig.METRICS_RECORDING_LEVEL_CONFIG;
83-
import static io.aiven.kafka.tieredstorage.RemoteStorageManagerConfig.METRICS_SAMPLE_WINDOW_MS_CONFIG;
82+
import static io.aiven.kafka.tieredstorage.config.RemoteStorageManagerConfig.METRICS_NUM_SAMPLES_CONFIG;
83+
import static io.aiven.kafka.tieredstorage.config.RemoteStorageManagerConfig.METRICS_RECORDING_LEVEL_CONFIG;
84+
import static io.aiven.kafka.tieredstorage.config.RemoteStorageManagerConfig.METRICS_SAMPLE_WINDOW_MS_CONFIG;
8485
import static org.apache.kafka.server.log.remote.storage.RemoteStorageManager.IndexType.LEADER_EPOCH;
8586
import static org.apache.kafka.server.log.remote.storage.RemoteStorageManager.IndexType.OFFSET;
8687
import static org.apache.kafka.server.log.remote.storage.RemoteStorageManager.IndexType.PRODUCER_SNAPSHOT;

core/src/main/java/io/aiven/kafka/tieredstorage/KeyPairPaths.java renamed to core/src/main/java/io/aiven/kafka/tieredstorage/config/KeyPairPaths.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package io.aiven.kafka.tieredstorage;
17+
package io.aiven.kafka.tieredstorage.config;
1818

1919
import java.nio.file.Path;
2020
import java.util.Objects;
@@ -23,7 +23,7 @@ public class KeyPairPaths {
2323
public final Path publicKey;
2424
public final Path privateKey;
2525

26-
public KeyPairPaths(final Path publicKey, final Path privateKey) {
26+
KeyPairPaths(final Path publicKey, final Path privateKey) {
2727
this.publicKey = Objects.requireNonNull(publicKey, "publicKey cannot be null");
2828
this.privateKey = Objects.requireNonNull(privateKey, "privateKey cannot be null");
2929
}

core/src/main/java/io/aiven/kafka/tieredstorage/RemoteStorageManagerConfig.java renamed to core/src/main/java/io/aiven/kafka/tieredstorage/config/RemoteStorageManagerConfig.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package io.aiven.kafka.tieredstorage;
17+
package io.aiven.kafka.tieredstorage.config;
1818

1919
import java.nio.file.Path;
2020
import java.time.Duration;
@@ -274,7 +274,7 @@ private static String privateKeyFileConfig(final String keyPairId) {
274274

275275
private final EncryptionConfig encryptionConfig;
276276

277-
RemoteStorageManagerConfig(final Map<String, ?> props) {
277+
public RemoteStorageManagerConfig(final Map<String, ?> props) {
278278
super(CONFIG, props);
279279
encryptionConfig = encryptionEnabled() ? EncryptionConfig.create(props) : null;
280280
validate();
@@ -291,57 +291,57 @@ private void validateCompression() {
291291
}
292292
}
293293

294-
StorageBackend storage() {
294+
public StorageBackend storage() {
295295
final Class<?> storageClass = getClass(STORAGE_BACKEND_CLASS_CONFIG);
296296
final StorageBackend storage = Utils.newInstance(storageClass, StorageBackend.class);
297297
storage.configure(this.originalsWithPrefix(STORAGE_PREFIX));
298298
return storage;
299299
}
300300

301-
Optional<Long> segmentManifestCacheSize() {
301+
public Optional<Long> segmentManifestCacheSize() {
302302
final long rawValue = getLong(SEGMENT_MANIFEST_CACHE_SIZE_CONFIG);
303303
if (rawValue == -1) {
304304
return Optional.empty();
305305
}
306306
return Optional.of(rawValue);
307307
}
308308

309-
Optional<Duration> segmentManifestCacheRetention() {
309+
public Optional<Duration> segmentManifestCacheRetention() {
310310
final long rawValue = getLong(SEGMENT_MANIFEST_CACHE_RETENTION_MS_CONFIG);
311311
if (rawValue == -1) {
312312
return Optional.empty();
313313
}
314314
return Optional.of(Duration.ofMillis(rawValue));
315315
}
316316

317-
String keyPrefix() {
317+
public String keyPrefix() {
318318
return getString(OBJECT_KEY_PREFIX_CONFIG);
319319
}
320320

321-
int chunkSize() {
321+
public int chunkSize() {
322322
return getInt(CHUNK_SIZE_CONFIG);
323323
}
324324

325-
boolean compressionEnabled() {
325+
public boolean compressionEnabled() {
326326
return getBoolean(COMPRESSION_ENABLED_CONFIG);
327327
}
328328

329-
boolean compressionHeuristicEnabled() {
329+
public boolean compressionHeuristicEnabled() {
330330
return getBoolean(COMPRESSION_HEURISTIC_ENABLED_CONFIG);
331331
}
332332

333-
boolean encryptionEnabled() {
333+
public boolean encryptionEnabled() {
334334
return getBoolean(ENCRYPTION_CONFIG);
335335
}
336336

337-
String encryptionKeyPairId() {
337+
public String encryptionKeyPairId() {
338338
if (!encryptionEnabled()) {
339339
return null;
340340
}
341341
return encryptionConfig.activeKeyPairId();
342342
}
343343

344-
Map<String, KeyPairPaths> encryptionKeyRing() {
344+
public Map<String, KeyPairPaths> encryptionKeyRing() {
345345
if (!encryptionEnabled()) {
346346
return null;
347347
}

core/src/test/java/io/aiven/kafka/tieredstorage/NoopStorageBackend.java renamed to core/src/test/java/io/aiven/kafka/tieredstorage/config/NoopStorageBackend.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package io.aiven.kafka.tieredstorage;
17+
package io.aiven.kafka.tieredstorage.config;
1818

1919
import java.io.InputStream;
2020
import java.util.Map;

core/src/test/java/io/aiven/kafka/tieredstorage/RemoteStorageManagerConfigTest.java renamed to core/src/test/java/io/aiven/kafka/tieredstorage/config/RemoteStorageManagerConfigTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package io.aiven.kafka.tieredstorage;
17+
package io.aiven.kafka.tieredstorage.config;
1818

1919
import java.nio.file.Path;
2020
import java.time.Duration;

0 commit comments

Comments
 (0)