drp

package
v0.0.0-...-cde087c Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

* aml-jens * * (C) 2023 Deutsche Telekom AG * * Deutsche Telekom AG and all other contributors / * copyright owners license this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this * file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License.

Index

Constants

This section is empty.

Variables

View Source
var DEBUG, INFO, WARN, FATAL = logging.GetLogger()

Functions

This section is empty.

Types

type DataRatePattern

type DataRatePattern struct {
	Name string

	Min    float64
	Max    float64
	Avg    float64
	Length int
	Sha256 []byte
	//Description/Comment of DRP
	Description string
	// contains filtered or unexported fields
}

func NewDataRatePattern

func NewDataRatePattern(params struct {
	MinRateKbits float64
	Scale        float64
	Origin       string
}) *DataRatePattern

Create a new DataRatePattern object. Most important members get initialized.

No files are read. - FileProviders read files

NOTE: this function might become internal in the future

func (*DataRatePattern) GetData

func (s *DataRatePattern) GetData() *[]float64

Returns the set data

NOTE: changes to this will not change stats.

func (*DataRatePattern) GetHash

func (s *DataRatePattern) GetHash() []byte

Returns Sha256 hash as a byte array

func (*DataRatePattern) GetHashStr

func (s *DataRatePattern) GetHashStr() string

Returns Sha256 hash as a hey encoded string

func (*DataRatePattern) GetMappingValue

func (s *DataRatePattern) GetMappingValue(name string, fallback string) string

Return KeyValue parameter specified by pattern or fallback

func (*DataRatePattern) GetMinRateKbits

func (s *DataRatePattern) GetMinRateKbits() float64

Returns the set minimum rate.

Note: this is not the minimum of the pattern. It might be higher. Use GetStats() instead!

func (*DataRatePattern) GetOrigin

func (s *DataRatePattern) GetOrigin() string

Returns the origin. (Value set by provider)

func (*DataRatePattern) GetScale

func (s *DataRatePattern) GetScale() float64

Returns the set scale

func (*DataRatePattern) GetStats

func (s *DataRatePattern) GetStats() (min float64, max float64, avg float64)

Returns Minumum, Maximum, Average of the loaded pattern

func (*DataRatePattern) Iterator

Creates / Returns a Iterator.

The Iterator is bound to this object.

func (*DataRatePattern) SampleCount

func (s *DataRatePattern) SampleCount() int

Returns the amount of samples in the pattern

func (*DataRatePattern) Scale

func (s *DataRatePattern) Scale(scale float64) error

Resacle all values. This also re-calculates the hash

func (*DataRatePattern) ScaleByInt

func (s *DataRatePattern) ScaleByInt(scale int) error

Resacle all values. This also re-calculates the hash

func (*DataRatePattern) SetData

func (s *DataRatePattern) SetData(d []float64)

Sets the internal pattern to d

type DataRatePatternFileProvider

type DataRatePatternFileProvider struct {
	Path string
}

func NewDataRatePatternFileProvider

func NewDataRatePatternFileProvider(path string) *DataRatePatternFileProvider

func (*DataRatePatternFileProvider) Provide

func (self *DataRatePatternFileProvider) Provide(scale float64, minrate float64) (DataRatePattern, error)

type DataRatePatternIterator

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

func NewDataRatePatternIterator

func NewDataRatePatternIterator() *DataRatePatternIterator

func (*DataRatePatternIterator) IsLooping

func (s *DataRatePatternIterator) IsLooping() bool

returns if looping is on

func (*DataRatePatternIterator) Next

func (s *DataRatePatternIterator) Next() (float64, error)

Get next Value

func (*DataRatePatternIterator) SetDone

func (s *DataRatePatternIterator) SetDone()

Sets the Iterator to a Doen state. Subsequent calls to Next will raise an IterableStopError

func (*DataRatePatternIterator) SetLooping

func (s *DataRatePatternIterator) SetLooping(endless bool)

Turns on / off looping-mode

func (*DataRatePatternIterator) Value

func (s *DataRatePatternIterator) Value() float64

Retunrs last value

type DataRatePatternProvider

type DataRatePatternProvider interface {
	Provide(scale float64, minrate float64) (DataRatePattern, error)
}

type DrpListT

type DrpListT struct {
	Drps     []DataRatePattern
	Selected int
}

func NewDrpList

func NewDrpList(providers []DataRatePatternProvider, args []struct {
	scale     float64
	minrateKb float64
}, skipOnFaultyDrp bool) (*DrpListT, error)

func NewDrpListFromFolder

func NewDrpListFromFolder(path string) (*DrpListT, error)

Will skip faulty DRPs Does not apply any mirate restricitons

func NewDrpListT

func NewDrpListT() *DrpListT

func (*DrpListT) GetSelected

func (s *DrpListT) GetSelected() *DataRatePattern

Jump to

Keyboard shortcuts

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