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 class
DefaultTokenBucket.Builder
Implementation 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.Action
action()
Action used by this token bucket for the exceeding traffic.static DefaultTokenBucket.Builder
builder()
Returns a new builder reference.long
burstSize()
Maximum burst size subject to the SLAs specified for this token bucket.short
dscp()
Dscp value, it meaning depends on the used marking.boolean
equals(java.lang.Object o)
int
hashCode()
long
processedBytes()
Stats which reports how many bytes have been processed so far.long
processedPackets()
Stats which reports how many packets have been processed so far.long
rate()
Rate of traffic subject to the SLAs specified for this token bucket.void
setProcessedBytes(long bytes)
Updates the number of bytes seen by this token bucket.void
setProcessedPackets(long packets)
Updates the number of packets seen by this token bucket.java.lang.String
toString()
TokenBucket.Type
type()
Token bucket type.
-
-
-
Method Detail
-
rate
public long rate()
Description copied from interface:TokenBucket
Rate of traffic subject to the SLAs specified for this token bucket.- Specified by:
rate
in interfaceTokenBucket
- Returns:
- the rate value
-
burstSize
public long burstSize()
Description copied from interface:TokenBucket
Maximum burst size subject to the SLAs specified for this token bucket.- Specified by:
burstSize
in interfaceTokenBucket
- Returns:
- the burst size in bytes
-
action
public TokenBucket.Action action()
Description copied from interface:TokenBucket
Action used by this token bucket for the exceeding traffic.- Specified by:
action
in interfaceTokenBucket
- Returns:
- the type of action
-
dscp
public short dscp()
Description copied from interface:TokenBucket
Dscp value, it meaning depends on the used marking.- Specified by:
dscp
in interfaceTokenBucket
- Returns:
- the dscp value for this token bucket
-
type
public TokenBucket.Type type()
Description copied from interface:TokenBucket
Token bucket type.- Specified by:
type
in interfaceTokenBucket
- Returns:
- the token bucket type
-
processedPackets
public long processedPackets()
Description copied from interface:TokenBucket
Stats 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:
processedPackets
in interfaceTokenBucket
- Returns:
- the processed packets
-
setProcessedPackets
public void setProcessedPackets(long packets)
Description copied from interface:TokenBucketEntry
Updates the number of packets seen by this token bucket.- Specified by:
setProcessedPackets
in interfaceTokenBucketEntry
- Parameters:
packets
- a packet count.
-
processedBytes
public long processedBytes()
Description copied from interface:TokenBucket
Stats 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:
processedBytes
in interfaceTokenBucket
- Returns:
- the processed bytes
-
setProcessedBytes
public void setProcessedBytes(long bytes)
Description copied from interface:TokenBucketEntry
Updates the number of bytes seen by this token bucket.- Specified by:
setProcessedBytes
in interfaceTokenBucketEntry
- Parameters:
bytes
- a byte counter.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
builder
public static DefaultTokenBucket.Builder builder()
Returns a new builder reference.- Returns:
- a new builder
-
-