-
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.
File System Caching for remote store
Signed-off-by: Ahmad AbuKhalil <abukhali@amazon.com>
- Loading branch information
1 parent
ac18db7
commit b940bb0
Showing
37 changed files
with
3,028 additions
and
79 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
41 changes: 41 additions & 0 deletions
41
server/src/main/java/org/opensearch/common/cache/CacheUsage.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,41 @@ | ||
/* | ||
* 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; | ||
|
||
import org.opensearch.common.cache.refcounted.RefCountedCache; | ||
|
||
/** | ||
* Usage metrics for {@link RefCountedCache} | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public class CacheUsage { | ||
/** | ||
* Cache usage of the system | ||
*/ | ||
private final long usage; | ||
|
||
/** | ||
* Cache usage by entries which are referenced | ||
*/ | ||
private final long activeUsage; | ||
|
||
public CacheUsage(long usage, long activeUsage) { | ||
this.usage = usage; | ||
this.activeUsage = activeUsage; | ||
} | ||
|
||
public long usage() { | ||
return usage; | ||
} | ||
|
||
public long activeUsage() { | ||
return activeUsage; | ||
} | ||
} |
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
22 changes: 22 additions & 0 deletions
22
server/src/main/java/org/opensearch/common/cache/RemovalReason.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,22 @@ | ||
/* | ||
* 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; | ||
|
||
/** | ||
* Reason for notification removal | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public enum RemovalReason { | ||
REPLACED, | ||
INVALIDATED, | ||
EVICTED, | ||
EXPLICIT, | ||
CAPACITY | ||
} |
27 changes: 27 additions & 0 deletions
27
server/src/main/java/org/opensearch/common/cache/Weigher.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,27 @@ | ||
/* | ||
* 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; | ||
|
||
/** | ||
* A class that can determine the weight of a value. The total weight threshold | ||
* is used to determine when an eviction is required. | ||
* | ||
* @opensearch.internal | ||
*/ | ||
public interface Weigher<V> { | ||
|
||
/** | ||
* Measures an object's weight to determine how many units of capacity that | ||
* the value consumes. A value must consume a minimum of one unit. | ||
* | ||
* @param value the object to weigh | ||
* @return the object's weight | ||
*/ | ||
long weightOf(V value); | ||
} |
Oops, something went wrong.