From 78ce346ccb3071d1a17acd8d6b58274d984ffb7e Mon Sep 17 00:00:00 2001 From: Jorge Esteban Quilcate Otoya Date: Tue, 1 Oct 2024 16:08:44 +0300 Subject: [PATCH] docs: Add documentation module Add module to generate config documentation --- config.rst | 0 docs/build.gradle | 29 ++++++++ .../kafka/tieredstorage/misc/ConfigDocs.java | 70 +++++++++++++++++++ settings.gradle | 2 + 4 files changed, 101 insertions(+) create mode 100644 config.rst create mode 100644 docs/build.gradle create mode 100644 docs/src/main/java/io/aiven/kafka/tieredstorage/misc/ConfigDocs.java diff --git a/config.rst b/config.rst new file mode 100644 index 000000000..e69de29bb diff --git a/docs/build.gradle b/docs/build.gradle new file mode 100644 index 000000000..884e84961 --- /dev/null +++ b/docs/build.gradle @@ -0,0 +1,29 @@ +/* + * Copyright 2024 Aiven Oy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +plugins { + id 'java-library' +} + +dependencies { + implementation "org.apache.kafka:kafka-clients:$kafkaVersion" + implementation project(":core") +} + +tasks.register('genConfigDocs', JavaExec) { + classpath = sourceSets.main.runtimeClasspath + mainClass = 'io.aiven.kafka.tieredstorage.misc.ConfigDocs' + standardOutput = new File("config.rst").newOutputStream() +} diff --git a/docs/src/main/java/io/aiven/kafka/tieredstorage/misc/ConfigDocs.java b/docs/src/main/java/io/aiven/kafka/tieredstorage/misc/ConfigDocs.java new file mode 100644 index 000000000..102caf8e9 --- /dev/null +++ b/docs/src/main/java/io/aiven/kafka/tieredstorage/misc/ConfigDocs.java @@ -0,0 +1,70 @@ +/* + * Copyright 2024 Aiven Oy + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package io.aiven.kafka.tieredstorage.misc; + +import org.apache.kafka.common.config.ConfigDef; + +import io.aiven.kafka.tieredstorage.config.ChunkCacheConfig; +import io.aiven.kafka.tieredstorage.config.ChunkManagerFactoryConfig; +import io.aiven.kafka.tieredstorage.config.DiskChunkCacheConfig; +import io.aiven.kafka.tieredstorage.config.RemoteStorageManagerConfig; +import io.aiven.kafka.tieredstorage.fetch.index.MemorySegmentIndexesCache; +import io.aiven.kafka.tieredstorage.fetch.manifest.MemorySegmentManifestCache; + +public class ConfigDocs { + public static void main(final String[] args) { + System.out.println("=================\n" + + "RemoteStorageManagerConfig\n" + + "================="); + final var rsmConfigDef = RemoteStorageManagerConfig.configDef(); + System.out.println(rsmConfigDef.toEnrichedRst()); + + System.out.println("=================\n" + + "SegmentManifestCacheConfig\n" + + "================="); + System.out.println("Under ``" + RemoteStorageManagerConfig.SEGMENT_MANIFEST_CACHE_PREFIX + "``\n"); + final var segmentManifestCacheDef = MemorySegmentManifestCache.configDef(); + System.out.println(segmentManifestCacheDef.toEnrichedRst()); + + System.out.println("=================\n" + + "SegmentIndexesCacheConfig\n" + + "================="); + System.out.println("Under ``" + RemoteStorageManagerConfig.FETCH_INDEXES_CACHE_PREFIX + "``\n"); + final var segmentIndexesCacheDef = MemorySegmentIndexesCache.configDef(); + System.out.println(segmentIndexesCacheDef.toEnrichedRst()); + + System.out.println("=================\n" + + "ChunkManagerFactoryConfig\n" + + "================="); + final var chunkCacheFactoryDef = ChunkManagerFactoryConfig.configDef(); + System.out.println(chunkCacheFactoryDef.toEnrichedRst()); + + System.out.println("=================\n" + + "MemoryChunkCacheConfig\n" + + "================="); + System.out.println("Under ``" + ChunkManagerFactoryConfig.FETCH_CHUNK_CACHE_PREFIX + "``\n"); + final var memChunkCacheDef = ChunkCacheConfig.configDef(new ConfigDef()); + System.out.println(memChunkCacheDef.toEnrichedRst()); + + System.out.println("=================\n" + + "DiskChunkCacheConfig\n" + + "================="); + System.out.println("Under ``" + ChunkManagerFactoryConfig.FETCH_CHUNK_CACHE_PREFIX + "``\n"); + final var diskChunkCacheDef = DiskChunkCacheConfig.configDef(); + System.out.println(diskChunkCacheDef.toEnrichedRst()); + } +} diff --git a/settings.gradle b/settings.gradle index 1d6840abc..959247562 100644 --- a/settings.gradle +++ b/settings.gradle @@ -24,3 +24,5 @@ include 'storage:gcs' include 'storage:s3' include 'e2e' include 'commons' +include 'docs' +