Added capacity.
This commit is contained in:
parent
5ac22c8df6
commit
21deb75622
2 changed files with 13 additions and 0 deletions
|
@ -117,6 +117,13 @@ class QuorumSystem(Generic[T]):
|
|||
sigma = self.strategy(read_fraction, write_fraction, f)
|
||||
return sigma.load(read_fraction, write_fraction)
|
||||
|
||||
def capacity(self,
|
||||
read_fraction: Optional[Distribution] = None,
|
||||
write_fraction: Optional[Distribution] = None,
|
||||
f: int = 0) \
|
||||
-> float:
|
||||
return 1 / self.load(read_fraction, write_fraction, f)
|
||||
|
||||
def _load_optimal_strategy(self,
|
||||
read_quorums: List[Set[T]],
|
||||
write_quorums: List[Set[T]],
|
||||
|
|
|
@ -16,6 +16,12 @@ class Strategy(Generic[T]):
|
|||
-> float:
|
||||
raise NotImplementedError
|
||||
|
||||
def capacity(self,
|
||||
read_fraction: Optional[Distribution] = None,
|
||||
write_fraction: Optional[Distribution] = None) \
|
||||
-> float:
|
||||
return 1 / self.load(read_fraction, write_fraction)
|
||||
|
||||
def get_read_quorum(self) -> Set[T]:
|
||||
raise NotImplementedError
|
||||
|
||||
|
|
Loading…
Reference in a new issue