-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: reuse cache config on chunk cache
Extend cache config with chunk cache configs (default and disk-based config) to reuse the configuration definitions.
- Loading branch information
Showing
10 changed files
with
73 additions
and
109 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
48 changes: 48 additions & 0 deletions
48
core/src/main/java/io/aiven/kafka/tieredstorage/config/ChunkCacheConfig.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,48 @@ | ||
/* | ||
* Copyright 2023 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.config; | ||
|
||
import java.util.Map; | ||
|
||
import org.apache.kafka.common.config.ConfigDef; | ||
|
||
public class ChunkCacheConfig extends CacheConfig { | ||
private static final String CACHE_PREFETCH_MAX_SIZE_CONFIG = "prefetch.max.size"; | ||
private static final String CACHE_PREFETCH_MAX_SIZE_DOC = | ||
"The amount of data that should be eagerly prefetched and cached"; | ||
private static final int CACHE_PREFETCHING_SIZE_DEFAULT = 0; //TODO find out what it should be | ||
|
||
private static ConfigDef addCacheConfigs(final ConfigDef configDef) { | ||
configDef.define( | ||
CACHE_PREFETCH_MAX_SIZE_CONFIG, | ||
ConfigDef.Type.INT, | ||
CACHE_PREFETCHING_SIZE_DEFAULT, | ||
ConfigDef.Range.between(0, Integer.MAX_VALUE), | ||
ConfigDef.Importance.MEDIUM, | ||
CACHE_PREFETCH_MAX_SIZE_DOC | ||
); | ||
return configDef; | ||
} | ||
|
||
public ChunkCacheConfig(final ConfigDef configDef, final Map<String, ?> props) { | ||
super(addCacheConfigs(configDef), props, ConfigDef.NO_DEFAULT_VALUE, CacheConfig.CACHE_RETENTION_MS_DEFAULT); | ||
} | ||
|
||
public int cachePrefetchingSize() { | ||
return getInt(CACHE_PREFETCH_MAX_SIZE_CONFIG); | ||
} | ||
} |
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
93 changes: 0 additions & 93 deletions
93
core/src/main/java/io/aiven/kafka/tieredstorage/fetch/cache/ChunkCacheConfig.java
This file was deleted.
Oops, something went wrong.
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