def load(self, slot: Slot): if self.cp.earlier(slot): raise SlotTooOld(slot, None, None) r = self.inst.get(slot) exists = True if r is None: exists = False r = InstanceStoreState(slot.ballot_initial(), State(Stage.Prepared, None, -1, [])) return LoadResult(exists, r)
def leader_client_request(q: Quorum, slot: Slot, cmd: Command): inst = yield Store( slot, InstanceStoreState( slot.ballot_initial(q.epoch), State( Stage.PreAccepted, cmd, 0, [] ) ) ) yield from leader_pre_accept(q, slot, inst, True)