latest.ipv8.messaging.interfaces.network_stats

Module Contents

Classes

NetworkStat

Represents an individual network statistic. This is used to compose the overall community statistics.

class latest.ipv8.messaging.interfaces.network_stats.NetworkStat(identifier: int)

Represents an individual network statistic. This is used to compose the overall community statistics.

Includes the following properties for the given statistic:
  • identifier: char

  • num_up: integer

  • num_down: integer

  • bytes_up: integer

  • bytes_down: integer

  • first_measured_up: float

  • first_measured_down: float

  • last_measured_up: float

  • last_measured_down: float

identifier: int

Message identifier.

num_up: int = 0

Number of messages sent.

num_down: int = 0

Number of messages received.

bytes_up: int = 0

Number of bytes sent.

bytes_down: int = 0

Number of bytes received.

first_measured_up: float = 0

Timestamp of the first message sent.

first_measured_down: float = 0

Timestamp of the first message received.

last_measured_up: float = 0

Timestamp of the most recent message sent.

last_measured_down: float = 0

Timestamp of the most recent message received.

add_sent_stat(timestamp: float, num_bytes: int) None

Callback for when a message of a given number of bytes is sent at a given timestamp.

add_received_stat(timestamp: float, num_bytes: int) None

Callback for when a message of a given number of bytes is received at a given timestamp.

to_dict() dict[str, int | float]

Convert this statistic to a plain dictionary.

__str__() str

Create a short string representation of this statistic for debugging.