Class McpTokenBucketConfig
java.lang.Object
com.soklet.McpTokenBucketConfig
Immutable finite configuration for Soklet's built-in in-memory token-bucket
rate limiter. Capacity, refill quantity, and refill interval must all be
explicitly configured. This type has no unlimited or disabled form.
- Author:
- Mark Allen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classSingle-threaded builder for immutable token-bucket configurations. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the maximum number of tokens held by one bucket.Returns the refill interval.Returns the number of tokens replenished during one refill interval.inthashCode()withCapacity(@NonNull Long capacity) Vends a builder primed with the bucket's maximum token capacity.
-
Method Details
-
withCapacity
Vends a builder primed with the bucket's maximum token capacity.- Parameters:
capacity- positive maximum number of tokens- Returns:
- token-bucket configuration builder
- Throws:
NullPointerException- ifcapacityis null
-
getCapacity
Returns the maximum number of tokens held by one bucket.- Returns:
- positive token capacity
-
getRefillTokens
Returns the number of tokens replenished during one refill interval.- Returns:
- positive refill quantity
-
getRefillInterval
Returns the refill interval.- Returns:
- positive refill interval
-
equals
-
hashCode
-