atomic_p2p.peer.entity package

Submodules

atomic_p2p.peer.entity.peer_info module

class atomic_p2p.peer.entity.peer_info.PeerInfo(name, role, host, status=<StatusType.PENDING: 'pending'>, conn=None)

Bases: object

atomic_p2p.peer.entity.peer_status module

class atomic_p2p.peer.entity.peer_status.PeerStatus(status=<StatusType.PENDING: 'pending'>)

Bases: object

Handling status of a PeerInfo This class is responsible to handling all detail when Monitor class is in- teracting with PeerInfo during packet delivering. Including last update time, no response count and etc.

last_update_ts

Last update timestamp.

Type

float

no_response_count

No response count since last check.

Type

int

status

Current peer status.

Type

StatusType

__init__(status=<StatusType.PENDING: 'pending'>)

Init of PeerStatus

Parameters

status (StatusType) – Peer status, default is StatusType.PENDING when init.

Return type

None

toDict()
Return type

Dict[~KT, ~VT]

update(status_type=<StatusType.UPDATED: 'updated'>)
Return type

None

class atomic_p2p.peer.entity.peer_status.StatusType

Bases: enum.Enum

An enumeration.

NO_RESP = 'no_resp'
PENDING = 'pending'
UNKNOWN = 'unknown'
UPDATED = 'updated'

Module contents

class atomic_p2p.peer.entity.PeerInfo(name, role, host, status=<StatusType.PENDING: 'pending'>, conn=None)

Bases: object

class atomic_p2p.peer.entity.StatusType

Bases: enum.Enum

An enumeration.

NO_RESP = 'no_resp'
PENDING = 'pending'
UNKNOWN = 'unknown'
UPDATED = 'updated'
class atomic_p2p.peer.entity.PeerStatus(status=<StatusType.PENDING: 'pending'>)

Bases: object

Handling status of a PeerInfo This class is responsible to handling all detail when Monitor class is in- teracting with PeerInfo during packet delivering. Including last update time, no response count and etc.

last_update_ts

Last update timestamp.

Type

float

no_response_count

No response count since last check.

Type

int

status

Current peer status.

Type

StatusType

__init__(status=<StatusType.PENDING: 'pending'>)

Init of PeerStatus

Parameters

status (StatusType) – Peer status, default is StatusType.PENDING when init.

Return type

None

toDict()
Return type

Dict[~KT, ~VT]

update(status_type=<StatusType.UPDATED: 'updated'>)
Return type

None