linearizability

package
v0.0.0-...-1e06781 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrGrantDenied = errors.New("server denied us grant")

ErrGrantDenied is used when GM denied us new grant (server is drained), hence we can't proceed with the test

Functions

func ProcessMonitoringResults

func ProcessMonitoringResults(prefix string, results map[string]TestResult) map[string]int

ProcessMonitoringResults returns map of metrics based on TestResults

Types

type PTP4lTestConfig

type PTP4lTestConfig struct {
	Timeout   time.Duration
	Server    string
	Interface string
}

PTP4lTestConfig is a configuration for Tester

func (*PTP4lTestConfig) Target

func (p *PTP4lTestConfig) Target(server string)

Target sets the server to test

type PTP4lTestResult

type PTP4lTestResult struct {
	Server      string
	RXTimestamp time.Time
	TXTimestamp time.Time
	Error       error
}

PTP4lTestResult is what we get after the test run

func (PTP4lTestResult) Delta

func (tr PTP4lTestResult) Delta() time.Duration

Delta is a difference between receiver's RX timestamp and our TX timestamp

func (PTP4lTestResult) Err

func (tr PTP4lTestResult) Err() error

Err returns an error value of the PTP4lTestResult

func (PTP4lTestResult) Explain

func (tr PTP4lTestResult) Explain() string

Explain provides plain text explanation of linearizability test result

func (PTP4lTestResult) Good

func (tr PTP4lTestResult) Good() (bool, error)

Good check if the test passed

func (PTP4lTestResult) Target

func (tr PTP4lTestResult) Target() string

Target returns value of server

type PTP4lTester

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

PTP4lTester is basically a half of PTP unicast client

func NewPTP4lTester

func NewPTP4lTester(server string, iface string) (*PTP4lTester, error)

NewPTP4lTester initializes a Tester

func (*PTP4lTester) Close

func (lt *PTP4lTester) Close() error

Close the connection

func (*PTP4lTester) RunTest

func (lt *PTP4lTester) RunTest(ctx context.Context) TestResult

RunTest performs one Tester run and will exit on completion. The result of the test will be returned, including any error arising during the test.

type SPTPTestConfig

type SPTPTestConfig struct {
	Server string

	LinearizabilityTestMaxGMOffset time.Duration
	// contains filtered or unexported fields
}

SPTPTestConfig is a configuration for Tester

func (*SPTPTestConfig) Target

func (p *SPTPTestConfig) Target(server string)

Target sets the server to test

type SPTPTestResult

type SPTPTestResult struct {
	Config SPTPTestConfig
	Offset float64
	Error  error
}

SPTPTestResult is what we get after the test run

func (SPTPTestResult) Err

func (tr SPTPTestResult) Err() error

Err returns an error value of the PTP4lTestResult

func (SPTPTestResult) Explain

func (tr SPTPTestResult) Explain() string

Explain provides plain text explanation of linearizability test result

func (SPTPTestResult) Good

func (tr SPTPTestResult) Good() (bool, error)

Good check if the test passed

func (SPTPTestResult) Target

func (tr SPTPTestResult) Target() string

Target returns value of server

type SPTPTester

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

SPTPTester is basically a half of PTP unicast client

func NewSPTPTester

func NewSPTPTester(server string, sptpurl string, linearizabilityTestMaxGMOffset time.Duration) (*SPTPTester, error)

NewSPTPTester initializes a Tester

func (*SPTPTester) Close

func (lt *SPTPTester) Close() error

Close the connection

func (*SPTPTester) RunTest

func (lt *SPTPTester) RunTest(_ context.Context) TestResult

RunTest performs one Tester run and will exit on completion. The result of the test will be returned, including any error arising during the test. Warning: the listener must be started via RunListener before calling this function.

type TestConfig

type TestConfig interface{}

TestConfig is a configuration for Tester

type TestResult

type TestResult interface {
	Target() string
	Good() (bool, error)
	Explain() string
	Err() error
}

TestResult is what we get after the test run

type Tester

type Tester interface {
	RunTest(ctx context.Context) TestResult
}

Tester is basically a half of PTP unicast client

type UDPConn

type UDPConn interface {
	ReadFromUDP(b []byte) (int, *net.UDPAddr, error)
	WriteTo(b []byte, addr net.Addr) (int, error)
	Close() error
}

UDPConn describes what functionality we expect from UDP connection

type UDPConnWithTS

type UDPConnWithTS interface {
	UDPConn
	WriteToWithTS(b []byte, addr net.Addr) (int, time.Time, error)
}

UDPConnWithTS describes what functionality we expect from UDP connection that allows us to read TX timestamps

Jump to

Keyboard shortcuts

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