1 ##############################################################################
2 # Copyright (c) 2016 Juan Qiu and others
3 # juan_ qiu@tongji.edu.cn
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
11 LOG = logging.getLogger(__name__)
14 class ActionRollbacker(object):
16 Abstract the rollback functions of attacker, operation
17 and mybe others in future
24 class AttackerRollbacker(ActionRollbacker):
26 def __init__(self, attacker):
27 self.underlyingAttacker = attacker
31 "\033[93m recovering attacker %s \033[0m",
32 self.underlyingAttacker.key)
33 self.underlyingAttacker.recover()
36 class OperationRollbacker(ActionRollbacker):
38 def __init__(self, operation):
39 self.underlyingOperation = operation
43 "\033[93m rollback operation %s \033[0m",
44 self.underlyingOperation.key)
45 self.underlyingOperation.rollback()