models

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	ID       string
	Hostname string
	IP       string
	Port     int
	Capacity ProcessCapacity
	Tags     []string
}

Node represents a node in the cluster

func (*Node) Address

func (n *Node) Address() string

Address returns the network address of the node

func (*Node) HasTag

func (n *Node) HasTag(tag string) bool

HasTag checks if a node has a specific tag

func (*Node) String

func (n *Node) String() string

String returns a string representation of the node

type NodePair

type NodePair struct {
	Source      *Node
	Destination *Node
}

NodePair represents a source-destination pair

func (NodePair) Equals

func (p NodePair) Equals(other NodePair) bool

Equals checks if two node pairs are equal

func (NodePair) Key

func (p NodePair) Key() string

Key returns a unique string key for the node pair (for use in maps)

func (NodePair) String

func (p NodePair) String() string

String returns a string representation of the node pair

type NodeRegistry

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

NodeRegistry manages a collection of nodes

func NewNodeRegistry

func NewNodeRegistry() *NodeRegistry

NewNodeRegistry creates a new node registry

func (*NodeRegistry) AddNode

func (r *NodeRegistry) AddNode(node *Node) error

AddNode adds a node to the registry

func (*NodeRegistry) Count

func (r *NodeRegistry) Count() int

Count returns the number of registered nodes

func (*NodeRegistry) GetAllNodes

func (r *NodeRegistry) GetAllNodes() []*Node

GetAllNodes returns all registered nodes

func (*NodeRegistry) GetNode

func (r *NodeRegistry) GetNode(id string) (*Node, error)

GetNode retrieves a node by ID

func (*NodeRegistry) GetNodesByTag

func (r *NodeRegistry) GetNodesByTag(tag string) []*Node

GetNodesByTag returns all nodes with a specific tag

type ProcessCapacity

type ProcessCapacity struct {
	MaxProcesses       int
	AvailableProcesses int
	CPUCores           int
	AvailableMemory    int64
	NetworkInterfaces  []string
}

ProcessCapacity represents a node's ability to run processes

type ProfileRegistry

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

ProfileRegistry manages test profiles

func NewProfileRegistry

func NewProfileRegistry() *ProfileRegistry

NewProfileRegistry creates a new profile registry

func (*ProfileRegistry) AddProfile

func (r *ProfileRegistry) AddProfile(profile *TestProfile) error

AddProfile adds a profile to the registry

func (*ProfileRegistry) GetAllProfiles

func (r *ProfileRegistry) GetAllProfiles() map[string]*TestProfile

GetAllProfiles returns all registered profiles

func (*ProfileRegistry) GetProfile

func (r *ProfileRegistry) GetProfile(name string) (*TestProfile, error)

GetProfile retrieves a profile by name

type Protocol added in v0.1.5

type Protocol string

Protocol represents the transport protocol for iperf3 tests

const (
	// ProtocolTCP represents TCP protocol
	ProtocolTCP Protocol = "tcp"
	// ProtocolUDP represents UDP protocol
	ProtocolUDP Protocol = "udp"
)

type TestAssignment

type TestAssignment struct {
	ID          string
	Source      *Node
	Destination *Node
	Profile     *TestProfile
}

TestAssignment represents a test to be executed

func (*TestAssignment) String

func (a *TestAssignment) String() string

String returns a string representation of the test assignment

type TestMatrix

type TestMatrix struct {
	DefaultProfile *TestProfile
	NodePairs      map[NodePair]*TestProfile
	Nodes          *NodeRegistry
}

TestMatrix contains the full test topology and profile assignments

func NewTestMatrix

func NewTestMatrix(defaultProfile *TestProfile, nodes *NodeRegistry) *TestMatrix

NewTestMatrix creates a new test matrix

func (*TestMatrix) CountTests

func (m *TestMatrix) CountTests() int

CountTests returns the total number of tests in the matrix

func (*TestMatrix) GenerateFullMesh

func (m *TestMatrix) GenerateFullMesh() []*TestAssignment

GenerateFullMesh creates test assignments for a full mesh topology

func (*TestMatrix) GetPairProfile

func (m *TestMatrix) GetPairProfile(source, destination *Node) *TestProfile

GetPairProfile gets the profile for a node pair, returns default if not set

func (*TestMatrix) GroupAssignmentsByDestination

func (m *TestMatrix) GroupAssignmentsByDestination() map[string][]*TestAssignment

GroupAssignmentsByDestination groups test assignments by destination node

func (*TestMatrix) GroupAssignmentsBySource

func (m *TestMatrix) GroupAssignmentsBySource() map[string][]*TestAssignment

GroupAssignmentsBySource groups test assignments by source node

func (*TestMatrix) SetPairProfile

func (m *TestMatrix) SetPairProfile(source, destination *Node, profile *TestProfile)

SetPairProfile sets a specific profile for a node pair

type TestProfile

type TestProfile struct {
	Name              string
	Duration          int
	Protocol          Protocol // TCP or UDP (default: TCP)
	Bandwidth         string
	WindowSize        string
	Parallel          int
	Bidirectional     bool
	Reverse           bool
	BufferLength      int
	CongestionControl string // TCP only
	MSS               int    // TCP only
	NoDelay           bool   // TCP only
	TOS               int
	ZeroCopy          bool
	OmitSeconds       int
	ExtraFlags        map[string]string
}

TestProfile contains all iperf3 parameters for a test

func (*TestProfile) Clone

func (p *TestProfile) Clone() *TestProfile

Clone creates a deep copy of the test profile

func (*TestProfile) String

func (p *TestProfile) String() string

String returns a string representation of the profile

func (*TestProfile) ToCommandArgs

func (p *TestProfile) ToCommandArgs() []string

ToCommandArgs converts the profile to iperf3 command line arguments

func (*TestProfile) Validate

func (p *TestProfile) Validate() error

Validate checks if the profile is valid

Jump to

Keyboard shortcuts

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