Class DefaultTokenBucket
- java.lang.Object
-
- org.onosproject.net.behaviour.trafficcontrol.DefaultTokenBucket
-
- All Implemented Interfaces:
TokenBucket,TokenBucketEntry
@Beta public final class DefaultTokenBucket extends java.lang.Object implements TokenBucket, TokenBucketEntry
Default implementation of the token bucket interface.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDefaultTokenBucket.BuilderImplementation of the token bucket builder interface.-
Nested classes/interfaces inherited from interface org.onosproject.net.behaviour.trafficcontrol.TokenBucket
TokenBucket.Action, TokenBucket.Type
-
-
Field Summary
-
Fields inherited from interface org.onosproject.net.behaviour.trafficcontrol.TokenBucket
MAX_DSCP, MIN_DSCP
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description TokenBucket.Actionaction()Action used by this token bucket for the exceeding traffic.static DefaultTokenBucket.Builderbuilder()Returns a new builder reference.longburstSize()Maximum burst size subject to the SLAs specified for this token bucket.shortdscp()Dscp value, it meaning depends on the used marking.booleanequals(java.lang.Object o)inthashCode()longprocessedBytes()Stats which reports how many bytes have been processed so far.longprocessedPackets()Stats which reports how many packets have been processed so far.longrate()Rate of traffic subject to the SLAs specified for this token bucket.voidsetProcessedBytes(long bytes)Updates the number of bytes seen by this token bucket.voidsetProcessedPackets(long packets)Updates the number of packets seen by this token bucket.java.lang.StringtoString()TokenBucket.Typetype()Token bucket type.
-
-
-
Method Detail
-
rate
public long rate()
Description copied from interface:TokenBucketRate of traffic subject to the SLAs specified for this token bucket.- Specified by:
ratein interfaceTokenBucket- Returns:
- the rate value
-
burstSize
public long burstSize()
Description copied from interface:TokenBucketMaximum burst size subject to the SLAs specified for this token bucket.- Specified by:
burstSizein interfaceTokenBucket- Returns:
- the burst size in bytes
-
action
public TokenBucket.Action action()
Description copied from interface:TokenBucketAction used by this token bucket for the exceeding traffic.- Specified by:
actionin interfaceTokenBucket- Returns:
- the type of action
-
dscp
public short dscp()
Description copied from interface:TokenBucketDscp value, it meaning depends on the used marking.- Specified by:
dscpin interfaceTokenBucket- Returns:
- the dscp value for this token bucket
-
type
public TokenBucket.Type type()
Description copied from interface:TokenBucketToken bucket type.- Specified by:
typein interfaceTokenBucket- Returns:
- the token bucket type
-
processedPackets
public long processedPackets()
Description copied from interface:TokenBucketStats which reports how many packets have been processed so far. Availability of this information depends on the technology used for the implementation of the policer.- Specified by:
processedPacketsin interfaceTokenBucket- Returns:
- the processed packets
-
setProcessedPackets
public void setProcessedPackets(long packets)
Description copied from interface:TokenBucketEntryUpdates the number of packets seen by this token bucket.- Specified by:
setProcessedPacketsin interfaceTokenBucketEntry- Parameters:
packets- a packet count.
-
processedBytes
public long processedBytes()
Description copied from interface:TokenBucketStats which reports how many bytes have been processed so far. Availability of this information depends on the technology used for the implementation of the policer.- Specified by:
processedBytesin interfaceTokenBucket- Returns:
- the processed bytes
-
setProcessedBytes
public void setProcessedBytes(long bytes)
Description copied from interface:TokenBucketEntryUpdates the number of bytes seen by this token bucket.- Specified by:
setProcessedBytesin interfaceTokenBucketEntry- Parameters:
bytes- a byte counter.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
builder
public static DefaultTokenBucket.Builder builder()
Returns a new builder reference.- Returns:
- a new builder
-
-