-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sagar Upadhyaya <[email protected]>
- Loading branch information
Showing
17 changed files
with
1,198 additions
and
108 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
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
45 changes: 45 additions & 0 deletions
45
server/src/main/java/org/opensearch/indices/CachingTier.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,45 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.indices; | ||
|
||
import org.opensearch.common.cache.RemovalListener; | ||
|
||
/** | ||
* Caching tier interface. Can be implemented/extended by concrete classes to provide different flavors of cache like | ||
* onHeap, disk etc. | ||
* @param <K> Type of key | ||
* @param <V> Type of value | ||
*/ | ||
public interface CachingTier<K, V> { | ||
|
||
V get(K key); | ||
|
||
void put(K key, V value); | ||
|
||
V computeIfAbsent(K key, TieredCacheLoader<K, V> loader) throws Exception; | ||
|
||
void invalidate(K key); | ||
|
||
V compute(K key, TieredCacheLoader<K, V> loader) throws Exception; | ||
|
||
void setRemovalListener(RemovalListener<K, V> removalListener); | ||
|
||
void invalidateAll(); | ||
|
||
Iterable<K> keys(); | ||
|
||
int count(); | ||
|
||
TierType getTierType(); | ||
|
||
/** | ||
* Force any outstanding size-based and time-based evictions to occur | ||
*/ | ||
default void refresh() {} | ||
} |
18 changes: 18 additions & 0 deletions
18
server/src/main/java/org/opensearch/indices/DiskCachingTier.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 @@ | ||
/* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
* | ||
* The OpenSearch Contributors require contributions made to | ||
* this file be licensed under the Apache-2.0 license or a | ||
* compatible open source license. | ||
*/ | ||
|
||
package org.opensearch.indices; | ||
|
||
/** | ||
* This is specific to disk caching tier and can be used to add methods which are specific to disk tier. | ||
* @param <K> Type of key | ||
* @param <V> Type of value | ||
*/ | ||
public interface DiskCachingTier<K, V> extends CachingTier<K, V> { | ||
|
||
} |
Oops, something went wrong.