Documentation
¶
Index ¶
- Variables
- type Limit
- type Limiter
- func (l *Limiter) ExecutorCapacity() bitrate.Bitrate
- func (l *Limiter) GetAddrLimit(ID uuid.UUID, addr string) (bitrate.Bitrate, bool, error)
- func (l *Limiter) GetExecLimit(ID uuid.UUID) (bitrate.Bitrate, bool, error)
- func (l *Limiter) GetLimit(ID uuid.UUID, addr string) (Limit, error)
- func (l *Limiter) InsertDebuglet(ID uuid.UUID, minimum, maximum bitrate.Bitrate, addrs []string) error
- func (l *Limiter) RemoveDebuglet(ID uuid.UUID)
- func (l *Limiter) SetAddrCapacity(addr string, c bitrate.Bitrate)
- func (l *Limiter) SetExecutorCapacity(c bitrate.Bitrate)
- func (l *Limiter) Wait(ctx context.Context, direction TransferDirection, ID uuid.UUID, addr string, ...) error
- type TransferDirection
- type UsageLimits
- type UsageTracker
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotRegistered = errors.New("debuglet has not been registered") ErrNotInPolicy = errors.New("address has not been registered/not in policy") )
Functions ¶
This section is empty.
Types ¶
type Limiter ¶
type Limiter struct {
// contains filtered or unexported fields
}
Limiter keeps track of the bandwidth being used by individual debuglets as well as the maximum bandwidth any debuglet is allowed to use on a executor level as well as per destination.
func NewLimiter ¶
func (*Limiter) ExecutorCapacity ¶
func (*Limiter) GetAddrLimit ¶
func (*Limiter) GetExecLimit ¶
func (*Limiter) InsertDebuglet ¶
func (*Limiter) RemoveDebuglet ¶
func (*Limiter) SetExecutorCapacity ¶
type TransferDirection ¶
type TransferDirection = int
const ( TransferIn TransferDirection = iota TransferOut )
type UsageLimits ¶
type UsageTracker ¶
type UsageTracker struct {
// contains filtered or unexported fields
}
UsageTracker tracks the amount of bandwidth that is being used by an individual debuglet. The idea is to set the executor and destination specific limit that is allowed by the debuglet and then UsageTracker.Wait will block the caller for the amount of time to ratelimit the bandwidth usage.
func NewUsageTracker ¶
func NewUsageTracker(l *zap.Logger) *UsageTracker
func (*UsageTracker) Upsert ¶
func (u *UsageTracker) Upsert(destination string, limits UsageLimits)
func (*UsageTracker) Wait ¶
func (u *UsageTracker) Wait(ctx context.Context, dir TransferDirection, destination string, size bitrate.Bitrate) error
Wait uses a token bucket to sleep until either the context finishes or a packet of a given size has enough space
Click to show internal directories.
Click to hide internal directories.