networktopology

package
v2.1.45 Latest Latest
Warning

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

Go to latest
Published: May 17, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NetworkTopology added in v2.0.30

type NetworkTopology interface {
	// Started network topology server.
	Serve()

	// Stop network topology server.
	Stop()

	// Has to check if there is a connection between source host and destination host.
	Has(string, string) bool

	// Store stores source host and destination host.
	Store(string, string) error

	// FindProbedHosts finds the most candidate destination host to be probed, randomly find a range of hosts,
	// and then return the host with a smaller probed count.
	FindProbedHosts(string) ([]*resource.Host, error)

	// DeleteHost deletes source host and all destination host connected to source host.
	DeleteHost(string) error

	// Probes loads probes interface by source host id and destination host id.
	Probes(string, string) Probes

	// ProbedCount is the number of times the host has been probed.
	ProbedCount(string) (uint64, error)

	// Neighbours gets the specified number neighbors of source host for aggregation, by regexp scaning cache
	// (if it is not enough for code to work, access redis to get neighbors), then parsing keys and loading host,
	// while updating the cache data.
	Neighbours(*resource.Host, int) ([]*resource.Host, error)

	// Snapshot writes the current network topology to the storage.
	Snapshot() error
}

NetworkTopology is an interface for network topology.

func NewNetworkTopology added in v2.0.30

func NewNetworkTopology(cfg config.NetworkTopologyConfig, rdb redis.UniversalClient, cache cache.Cache, resource resource.Resource, storage storage.Storage) (NetworkTopology, error)

New network topology interface.

type Probe

type Probe struct {
	// Host metadata.
	Host *resource.Host `json:"host"`

	// RTT is the round-trip time sent via this pinger.
	RTT time.Duration `json:"rtt"`

	// CreatedAt is the time to create probe.
	CreatedAt time.Time `json:"createdAt"`
}

Probe is the probe metadata.

type Probes

type Probes interface {
	// Peek returns the oldest probe without removing it.
	Peek() (*Probe, error)

	// Enqueue enqueues probe into the queue.
	Enqueue(*Probe) error

	// Len gets the length of probes.
	Len() (int64, error)

	// CreatedAt is the creation time of probes.
	CreatedAt() (time.Time, error)

	// UpdatedAt is the updated time to store probe.
	UpdatedAt() (time.Time, error)

	// AverageRTT is the moving average round-trip time of probes.
	AverageRTT() (time.Duration, error)
}

Probes is the interface to store probes.

func NewProbes

func NewProbes(cfg config.NetworkTopologyConfig, rdb redis.UniversalClient, cache cache.Cache, srcHostID string, destHostID string) Probes

NewProbes creates a probes interface.

Directories

Path Synopsis
Code generated by MockGen.
Code generated by MockGen.

Jump to

Keyboard shortcuts

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