From 4b2ef408d703fb3dbeef6e5396e8217bfe4812d3 Mon Sep 17 00:00:00 2001 From: Michael Whittaker Date: Sun, 31 Jan 2021 17:48:36 -0800 Subject: [PATCH] Added a way to make a custom strategy. --- quorums/quorum_system.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/quorums/quorum_system.py b/quorums/quorum_system.py index 9d0600f..70d877d 100644 --- a/quorums/quorum_system.py +++ b/quorums/quorum_system.py @@ -184,6 +184,11 @@ class QuorumSystem(Generic[T]): sigma_w = {frozenset(q): 1 / len(write_quorums) for q in write_quorums} return Strategy(self, sigma_r, sigma_w) + def make_strategy(self, + sigma_r: Dict[FrozenSet[T], float], + sigma_w: Dict[FrozenSet[T], float]) -> 'Strategy[T]': + return Strategy(self, sigma_r=sigma_r, sigma_w=sigma_w) + def strategy(self, optimize: str = LOAD, load_limit: Optional[float] = None,