-
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: Peter Alfonsi <[email protected]>
- Loading branch information
Peter Alfonsi
committed
Mar 4, 2024
1 parent
0da7c29
commit 810096f
Showing
3 changed files
with
834 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
plugins/cache-ehcache/src/main/java/org/opensearch/cache/keystore/KeyStoreStats.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,44 @@ | ||
/* | ||
* 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.cache.keystore; | ||
|
||
import org.opensearch.common.metrics.CounterMetric; | ||
|
||
import java.util.concurrent.atomic.AtomicBoolean; | ||
|
||
/** | ||
* A stats holder for use in KeyLookupStore implementations. | ||
* Getters should be exposed by the KeyLookupStore which uses it. | ||
*/ | ||
public class KeyStoreStats { | ||
// Number of entries | ||
protected CounterMetric size; | ||
// Memory cap in bytes | ||
protected long memSizeCapInBytes; | ||
// Number of add attempts | ||
protected CounterMetric numAddAttempts; | ||
// Number of collisions | ||
protected CounterMetric numCollisions; | ||
// True if the store is at capacity | ||
protected AtomicBoolean atCapacity; | ||
// Number of removal attempts | ||
protected CounterMetric numRemovalAttempts; | ||
// Number of successful removal attempts | ||
protected CounterMetric numSuccessfulRemovals; | ||
|
||
protected KeyStoreStats(long memSizeCapInBytes) { | ||
this.size = new CounterMetric(); | ||
this.numAddAttempts = new CounterMetric(); | ||
this.numCollisions = new CounterMetric(); | ||
this.memSizeCapInBytes = memSizeCapInBytes; | ||
this.atCapacity = new AtomicBoolean(false); | ||
this.numRemovalAttempts = new CounterMetric(); | ||
this.numSuccessfulRemovals = new CounterMetric(); | ||
} | ||
} |
Oops, something went wrong.