bandwidth

package
v0.0.0-...-446c760 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2024 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BucketBandwidthReport

type BucketBandwidthReport struct {
	BucketStats map[BucketOptions]Details `json:"bucketStats,omitempty"`
}

BucketBandwidthReport captures the details for all buckets.

func (*BucketBandwidthReport) DecodeMsg

func (z *BucketBandwidthReport) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (BucketBandwidthReport) EncodeMsg

func (z BucketBandwidthReport) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (BucketBandwidthReport) MarshalMsg

func (z BucketBandwidthReport) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (BucketBandwidthReport) Msgsize

func (z BucketBandwidthReport) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*BucketBandwidthReport) UnmarshalMsg

func (z *BucketBandwidthReport) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type BucketOptions

type BucketOptions struct {
	Name           string
	ReplicationARN string // This is optional, and not mandatory.
}

BucketOptions represents the bucket and optionally its replication target pair.

type Details

type Details struct {
	LimitInBytesPerSecond            int64   `json:"limitInBits"`
	CurrentBandwidthInBytesPerSecond float64 `json:"currentBandwidth"`
}

Details for the measured bandwidth

func (*Details) DecodeMsg

func (z *Details) DecodeMsg(dc *msgp.Reader) (err error)

DecodeMsg implements msgp.Decodable

func (Details) EncodeMsg

func (z Details) EncodeMsg(en *msgp.Writer) (err error)

EncodeMsg implements msgp.Encodable

func (Details) MarshalMsg

func (z Details) MarshalMsg(b []byte) (o []byte, err error)

MarshalMsg implements msgp.Marshaler

func (Details) Msgsize

func (z Details) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Details) UnmarshalMsg

func (z *Details) UnmarshalMsg(bts []byte) (o []byte, err error)

UnmarshalMsg implements msgp.Unmarshaler

type Monitor

type Monitor struct {
	NodeCount uint64
	// contains filtered or unexported fields
}

Monitor holds the state of the global bucket monitor

func NewMonitor

func NewMonitor(ctx context.Context, numNodes uint64) *Monitor

NewMonitor returns a monitor with defaults.

func (*Monitor) DeleteBucket

func (m *Monitor) DeleteBucket(bucket string)

DeleteBucket deletes monitoring the 'bucket'

func (*Monitor) DeleteBucketThrottle

func (m *Monitor) DeleteBucketThrottle(bucket, arn string)

DeleteBucketThrottle deletes monitoring for a bucket's target

func (*Monitor) GetReport

func (m *Monitor) GetReport(selectBucket SelectionFunction) *BucketBandwidthReport

GetReport gets the report for all bucket bandwidth details.

func (*Monitor) IsThrottled

func (m *Monitor) IsThrottled(bucket, arn string) bool

IsThrottled returns true if a bucket has bandwidth throttling enabled.

func (*Monitor) SetBandwidthLimit

func (m *Monitor) SetBandwidthLimit(bucket, arn string, limit int64)

SetBandwidthLimit sets the bandwidth limit for a bucket

type MonitorReaderOptions

type MonitorReaderOptions struct {
	BucketOptions
	HeaderSize int
}

MonitorReaderOptions provides configurable options for monitor reader implementation.

type MonitoredReader

type MonitoredReader struct {
	// contains filtered or unexported fields
}

MonitoredReader represents a throttled reader subject to bandwidth monitoring

func NewMonitoredReader

func NewMonitoredReader(ctx context.Context, m *Monitor, r io.Reader, opts *MonitorReaderOptions) *MonitoredReader

NewMonitoredReader returns reference to a monitored reader that throttles reads to configured bandwidth for the bucket.

func (*MonitoredReader) Read

func (r *MonitoredReader) Read(buf []byte) (n int, err error)

Read implements a throttled read

type SelectionFunction

type SelectionFunction func(bucket string) bool

SelectionFunction for buckets

func SelectBuckets

func SelectBuckets(buckets ...string) SelectionFunction

SelectBuckets will select all the buckets passed in.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL