Created
May 1, 2021 19:27
-
-
Save samueleresca/20dbee03b347035bda18d383e180a668 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Original code available at: https://github.com/mwhittaker/quoracle/blob/d83a811a905a51fc13ebc00ddac036d559463380/quoracle/quorum_system.py#L509 | |
""" | |
def latency() -> pulp.LpAffineExpression: | |
reads = fr * sum( | |
v * self._read_quorum_latency(quorum).total_seconds() | |
for (rq, v) in zip(read_quorums, read_quorum_vars) | |
for quorum in [{self.node(x) for x in rq}] | |
) | |
writes = (1 - fr) * sum( | |
v * self._write_quorum_latency(quorum).total_seconds() | |
for (wq, v) in zip(write_quorums, write_quorum_vars) | |
for quorum in [{self.node(x) for x in wq}] | |
) | |
return reads + writes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment