Class MLRateLimiter
java.lang.Object
org.opensearch.ml.common.controller.MLRateLimiter
- All Implemented Interfaces:
org.opensearch.core.common.io.stream.Writeable,org.opensearch.core.xcontent.ToXContent,org.opensearch.core.xcontent.ToXContentObject
public class MLRateLimiter
extends Object
implements org.opensearch.core.xcontent.ToXContentObject, org.opensearch.core.common.io.stream.Writeable
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.opensearch.core.xcontent.ToXContent
org.opensearch.core.xcontent.ToXContent.DelegatingMapParams, org.opensearch.core.xcontent.ToXContent.MapParams, org.opensearch.core.xcontent.ToXContent.ParamsNested classes/interfaces inherited from interface org.opensearch.core.common.io.stream.Writeable
org.opensearch.core.common.io.stream.Writeable.Reader<V>, org.opensearch.core.common.io.stream.Writeable.WriteableRegistry, org.opensearch.core.common.io.stream.Writeable.Writer<V> -
Field Summary
FieldsFields inherited from interface org.opensearch.core.xcontent.ToXContent
EMPTY_PARAMS -
Constructor Summary
ConstructorsConstructorDescriptionMLRateLimiter(String limit, TimeUnit unit) MLRateLimiter(org.opensearch.core.common.io.stream.StreamInput in) -
Method Summary
Modifier and TypeMethodDescriptionbuilder()getLimit()getUnit()static booleanisDeployRequiredAfterUpdate(MLRateLimiter rateLimiter, MLRateLimiter updateContent) Checks if we need to deploy this update into ML Cache (if model is deployed) after performing this update operation.booleanisEmpty()booleanisValid()static MLRateLimiterparse(org.opensearch.core.xcontent.XContentParser parser) voidvoidorg.opensearch.core.xcontent.XContentBuildertoXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) voidupdate(MLRateLimiter updateContent) static MLRateLimiterupdate(MLRateLimiter rateLimiter, MLRateLimiter updateContent) static booleanupdateValidityPreCheck(MLRateLimiter rateLimiter, MLRateLimiter updateContent) Checks the validity of this incoming update before performing an update operation.voidwriteTo(org.opensearch.core.common.io.stream.StreamOutput out) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.opensearch.core.xcontent.ToXContentObject
isFragment
-
Field Details
-
LIMIT_FIELD
- See Also:
-
UNIT_FIELD
- See Also:
-
-
Constructor Details
-
MLRateLimiter
-
MLRateLimiter
- Throws:
IOException
-
-
Method Details
-
parse
public static MLRateLimiter parse(org.opensearch.core.xcontent.XContentParser parser) throws IOException - Throws:
IOException
-
writeTo
- Specified by:
writeToin interfaceorg.opensearch.core.common.io.stream.Writeable- Throws:
IOException
-
toXContent
public org.opensearch.core.xcontent.XContentBuilder toXContent(org.opensearch.core.xcontent.XContentBuilder builder, org.opensearch.core.xcontent.ToXContent.Params params) throws IOException - Specified by:
toXContentin interfaceorg.opensearch.core.xcontent.ToXContent- Throws:
IOException
-
update
-
update
-
updateValidityPreCheck
public static boolean updateValidityPreCheck(MLRateLimiter rateLimiter, MLRateLimiter updateContent) Checks the validity of this incoming update before performing an update operation. A valid update indicates the corresponding index will be updated with the current MLRateLimiter config and the update content- Parameters:
rateLimiter- The existing rate limiter.updateContent- The update content.- Returns:
- true if the update is valid, false otherwise.
-
isDeployRequiredAfterUpdate
public static boolean isDeployRequiredAfterUpdate(MLRateLimiter rateLimiter, MLRateLimiter updateContent) Checks if we need to deploy this update into ML Cache (if model is deployed) after performing this update operation.- Parameters:
rateLimiter- The existing rate limiter.updateContent- The update content.- Returns:
- true if the update is valid, false otherwise.
-
isValid
public boolean isValid() -
isEmpty
public boolean isEmpty() -
builder
-
toBuilder
-
setLimit
-
setUnit
-
getLimit
-
getUnit
-