Package org.opends.server.api
Record Class ResourceLimits
java.lang.Object
java.lang.Record
org.opends.server.api.ResourceLimits
- Record Components:
sizeLimit
- The maximum number of entries that should be returnedtimeLimitSec
- The maximum length of time in seconds that should be allowed for a searchidleTimeLimitSec
- The idle time limit for the connection in secondslookThroughLimit
- The maximum number of records that the directory server should "look through" in the course of processing a search request. It is an approximation of the computational cost of processing a search request.maxCandidateSetSize
- The maximum number of candidate entry IDs the server may retrieve from an index during a search
public record ResourceLimits(int sizeLimit, int timeLimitSec, int idleTimeLimitSec, int lookThroughLimit, int maxCandidateSetSize)
extends Record
All resource limits for a user.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final ResourceLimits
AResourceLimits
that is used when no other resource limits are provided to AuthenticationInfo objects.static final ResourceLimits
AResourceLimits
with every value set to unlimited. -
Constructor Summary
ConstructorsConstructorDescriptionResourceLimits
(int sizeLimit, int timeLimitSec, int idleTimeLimitSec, int lookThroughLimit, int maxCandidateSetSize) Creates an instance of aResourceLimits
record class. -
Method Summary
Modifier and TypeMethodDescriptionapplyRequestLimits
(SearchRequest request) Merges this ResourceLimits with the provided limits.applyUserLimits
(Entry user) Return a ResourceLimits using overrides from a user entry, taking into account the limits from a search request.final boolean
Indicates whether some other object is "equal to" this one.final int
hashCode()
Returns a hash code value for this object.int
Returns the value of theidleTimeLimitSec
record component.boolean
isSizeLimitExceeded
(int numberOfEntries) Check if the number of entries has exceeded the size limit.int
Returns the value of thelookThroughLimit
record component.int
Returns the value of themaxCandidateSetSize
record component.int
Returns the value of thesizeLimit
record component.int
Returns the value of thetimeLimitSec
record component.final String
toString()
Returns a string representation of this record class.withLookThroughLimit
(int newLookThroughLimit) Return a copy of this resource limits with an updated look through limit.withMaxCandidateSetSize
(int newMaxCandidateSetSize) Return a copy of this resource limits with an updated maximum candidate size.
-
Field Details
-
NO_LIMITS
AResourceLimits
with every value set to unlimited. -
MIN_LIMITS
AResourceLimits
that is used when no other resource limits are provided to AuthenticationInfo objects. At a minimum, the default server limits should be provided, but this is not always practical, in particular for unit tests, or when the resource limits on the authentication info object will not be read.This
ResourceLimits
objects has every value set to the lowest possible limits. It acts as a canary / null-object allowing to quickly spot missing resource limits by quickly denying user operations. It is better than usingNO_LIMITS
for such users, limiting as much as possible the damage such "limitless" users can do in the server.
-
-
Constructor Details
-
ResourceLimits
public ResourceLimits(int sizeLimit, int timeLimitSec, int idleTimeLimitSec, int lookThroughLimit, int maxCandidateSetSize) Creates an instance of aResourceLimits
record class.- Parameters:
sizeLimit
- the value for thesizeLimit
record componenttimeLimitSec
- the value for thetimeLimitSec
record componentidleTimeLimitSec
- the value for theidleTimeLimitSec
record componentlookThroughLimit
- the value for thelookThroughLimit
record componentmaxCandidateSetSize
- the value for themaxCandidateSetSize
record component
-
-
Method Details
-
applyUserLimits
Return a ResourceLimits using overrides from a user entry, taking into account the limits from a search request.- Parameters:
user
- The entry containing possible overrides.- Returns:
- the ResourceLimits
-
isSizeLimitExceeded
public boolean isSizeLimitExceeded(int numberOfEntries) Check if the number of entries has exceeded the size limit.- Parameters:
numberOfEntries
- The number of entries that have been returned- Returns:
true
if the size limit has been exceeded,false
otherwise
-
applyRequestLimits
Merges this ResourceLimits with the provided limits.- Parameters:
request
- The search request with size and time limits- Returns:
- the ResourceLimits
-
withMaxCandidateSetSize
Return a copy of this resource limits with an updated maximum candidate size.- Parameters:
newMaxCandidateSetSize
- The new maximum candidate size.- Returns:
- The updated resource limits.
-
withLookThroughLimit
Return a copy of this resource limits with an updated look through limit.- Parameters:
newLookThroughLimit
- The new look through limit.- Returns:
- The updated resource limits.
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
sizeLimit
public int sizeLimit()Returns the value of thesizeLimit
record component.- Returns:
- the value of the
sizeLimit
record component
-
timeLimitSec
public int timeLimitSec()Returns the value of thetimeLimitSec
record component.- Returns:
- the value of the
timeLimitSec
record component
-
idleTimeLimitSec
public int idleTimeLimitSec()Returns the value of theidleTimeLimitSec
record component.- Returns:
- the value of the
idleTimeLimitSec
record component
-
lookThroughLimit
public int lookThroughLimit()Returns the value of thelookThroughLimit
record component.- Returns:
- the value of the
lookThroughLimit
record component
-
maxCandidateSetSize
public int maxCandidateSetSize()Returns the value of themaxCandidateSetSize
record component.- Returns:
- the value of the
maxCandidateSetSize
record component
-