forked from opensearch-project/OpenSearch
-
Notifications
You must be signed in to change notification settings - Fork 0
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
16 changed files
with
237 additions
and
159 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
27 changes: 0 additions & 27 deletions
27
server/src/main/java/org/opensearch/common/cache/tier/TieredCacheEventListener.java
This file was deleted.
Oops, something went wrong.
38 changes: 38 additions & 0 deletions
38
server/src/main/java/org/opensearch/common/cache/tier/TieredCacheRemovalNotification.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,38 @@ | ||
/* | ||
* 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.common.cache.tier; | ||
|
||
import org.opensearch.common.cache.RemovalNotification; | ||
import org.opensearch.common.cache.RemovalReason; | ||
import org.opensearch.common.cache.tier.enums.CacheStoreType; | ||
|
||
/** | ||
* Notification when an element is removed from tiered cache. | ||
* @param <K> Type of key | ||
* @param <V> Type of value | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class TieredCacheRemovalNotification<K, V> extends RemovalNotification<K, V> { | ||
private final CacheStoreType cacheStoreType; | ||
|
||
public TieredCacheRemovalNotification(K key, V value, RemovalReason removalReason) { | ||
super(key, value, removalReason); | ||
this.cacheStoreType = CacheStoreType.ON_HEAP; | ||
} | ||
|
||
public TieredCacheRemovalNotification(K key, V value, RemovalReason removalReason, CacheStoreType cacheStoreType) { | ||
super(key, value, removalReason); | ||
this.cacheStoreType = cacheStoreType; | ||
} | ||
|
||
public CacheStoreType getTierType() { | ||
return cacheStoreType; | ||
} | ||
} |
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
28 changes: 28 additions & 0 deletions
28
...er/src/main/java/org/opensearch/common/cache/tier/listeners/TieredCacheEventListener.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,28 @@ | ||
/* | ||
* 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.common.cache.tier.listeners; | ||
|
||
import org.opensearch.common.cache.tier.enums.CacheStoreType; | ||
import org.opensearch.common.cache.tier.TieredCacheRemovalNotification; | ||
|
||
/** | ||
* This can be used to listen to tiered caching events | ||
* @param <K> Type of key | ||
* @param <V> Type of value | ||
*/ | ||
public interface TieredCacheEventListener<K, V> { | ||
|
||
void onMiss(K key, CacheStoreType cacheStoreType); | ||
|
||
void onRemoval(TieredCacheRemovalNotification<K, V> notification); | ||
|
||
void onHit(K key, V value, CacheStoreType cacheStoreType); | ||
|
||
void onCached(K key, V value, CacheStoreType cacheStoreType); | ||
} |
21 changes: 21 additions & 0 deletions
21
.../src/main/java/org/opensearch/common/cache/tier/listeners/TieredCacheRemovalListener.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,21 @@ | ||
/* | ||
* 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.common.cache.tier.listeners; | ||
|
||
import org.opensearch.common.cache.tier.TieredCacheRemovalNotification; | ||
|
||
/** | ||
* Listener for removing an element from tiered cache | ||
* | ||
* @opensearch.internal | ||
*/ | ||
@FunctionalInterface | ||
public interface TieredCacheRemovalListener<K, V> { | ||
void onRemoval(TieredCacheRemovalNotification<K, V> notification); | ||
} |
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
Oops, something went wrong.