Skip to content
Snippets Groups Projects
Commit 5b4f5855 authored by WinJ's avatar WinJ
Browse files

base timer classes

parent dcfd2278
No related branches found
No related tags found
No related merge requests found
from assignment2.message import P1A, P2A
from assignment2.paxos import BallotNumber
class Timer:
def __init__(self) -> None:
pass
def __str__(self) -> str:
return f"timer: {self.__class__.__name__}"
class P2ATimer(Timer):
P2A_RETRY_MILLIS = 100
def __init__(self, p2a: P2A) -> None:
super().__init__()
self.p2a: P2A = p2a
class HeartBeatTimer(Timer):
HEARTBEAT_RETRY_MILLIS = 20
def __init__(self) -> None:
super().__init__()
class HeartBeatCheckTimer(Timer):
HEARTBEAT_CHECK_RETRY_MILLIS = 100
def __init__(self, ballot: BallotNumber) -> None:
super().__init__()
self.ballot: BallotNumber = ballot
class LeaderElectionTimer(Timer):
LEADER_ELECTION_TIMER = 50
def __init__(self, p1a: P1A) -> None:
super().__init__()
self.p1a: P1A = p1a
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment