Skip to content

Commit

Permalink
Added RBM keystore impl
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Alfonsi <[email protected]>
  • Loading branch information
Peter Alfonsi committed Mar 4, 2024
1 parent 0da7c29 commit 810096f
Show file tree
Hide file tree
Showing 3 changed files with 834 additions and 0 deletions.
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();
}
}
Loading

0 comments on commit 810096f

Please sign in to comment.