Documentation ¶
Overview ¶
Package tgproducer implements a traffic generator producer.
Index ¶
- Constants
- Variables
- type Config
- type Counters
- type Pattern
- type PatternCounters
- type Producer
- func (p *Producer) Close() error
- func (p *Producer) ConnectRxQueues(demuxI *iface.InputDemux)
- func (p Producer) Counters() (cnt Counters)
- func (p Producer) Face() iface.Face
- func (p *Producer) Launch()
- func (p Producer) Patterns() []Pattern
- func (p *Producer) Stop() error
- func (p Producer) Workers() []ealthread.ThreadWithRole
- type Reply
- type ReplyKind
Constants ¶
View Source
const ( // MaxPatterns is maximum number of traffic patterns. MaxPatterns = 128 // MaxReplies is maximum number of replies per pattern. MaxReplies = 8 // MaxSumWeight is maximum sum of weights among replies. MaxSumWeight = 256 )
Variables ¶
View Source
var ( ErrNoPattern = errors.New("no pattern specified") ErrTooManyPatterns = fmt.Errorf("cannot add more than %d patterns", MaxPatterns) ErrPrefixTooLong = fmt.Errorf("prefix cannot exceed %d octets", ndni.NameMaxLength) ErrTooManyReplies = fmt.Errorf("cannot add more than %d replies", MaxReplies) ErrTooManyWeights = fmt.Errorf("sum of weight cannot exceed %d", MaxSumWeight) )
Error conditions.
View Source
var ( GqlReplyInput *graphql.InputObject GqlPatternInput *graphql.InputObject GqlConfigInput *graphql.InputObject GqlPatternCountersType *graphql.Object GqlCountersType *graphql.Object GqlProducerType *gqlserver.NodeType[*Producer] )
GraphQL types.
View Source
var GqlRetrieveByFaceID func(id iface.ID) *Producer
GqlRetrieveByFaceID returns *Producer associated with a face. It is assigned during package tg initialization.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { NThreads int `json:"nThreads,omitempty"` // number of threads, minimum/default is 1 RxQueue iface.PktQueueConfig `json:"rxQueue,omitempty"` Patterns []Pattern `json:"patterns"` // contains filtered or unexported fields }
Config describes producer configuration.
type Counters ¶
type Counters struct { PerPattern []PatternCounters `json:"perPattern"` NInterests uint64 `json:"nInterests"` NNoMatch uint64 `json:"nNoMatch"` NAllocError uint64 `json:"nAllocError"` }
Counters contains producer counters.
type Pattern ¶
type Pattern struct { Prefix ndn.Name `json:"prefix"` Replies []Reply `json:"replies"` // if empty, reply with Data FreshnessPeriod=1 }
Pattern configures how the producer replies to Interests under a name prefix.
type PatternCounters ¶
type PatternCounters struct { NInterests uint64 `json:"nInterests"` PerReply []uint64 `json:"perReply"` }
PatternCounters contains per-pattern counters.
func (PatternCounters) String ¶
func (cnt PatternCounters) String() string
type Producer ¶
type Producer struct {
// contains filtered or unexported fields
}
Producer represents a traffic generator producer instance.
func (*Producer) ConnectRxQueues ¶
func (p *Producer) ConnectRxQueues(demuxI *iface.InputDemux)
ConnectRxQueues connects Interest InputDemux to RxQueues.
func (Producer) Workers ¶
func (p Producer) Workers() []ealthread.ThreadWithRole
Workers returns worker threads.
type Reply ¶
type Reply struct { Weight int `json:"weight,omitempty"` // weight of random choice, minimum/default is 1 ndni.DataGenConfig Nack uint8 `json:"nack,omitempty"` // if not NackNone, reply with Nack instead of Data Timeout bool `json:"timeout,omitempty"` // if true, drop the Interest instead of sending Data }
Reply configures how the producer replies to the Interest.
Click to show internal directories.
Click to hide internal directories.