mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-09-01 00:59:24 +00:00
and run raft behave tests with encryption enabled. Using the new `pysyncobj` release allowed us to get rid of a lot of hacks with accessing private properties and methods of the parent class and reduce the size of the `raft.py`. Close https://github.com/zalando/patroni/issues/1746
30 lines
686 B
Python
30 lines
686 B
Python
import logging
|
|
|
|
from .daemon import AbstractPatroniDaemon, abstract_main
|
|
from .dcs.raft import KVStoreTTL
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
class RaftController(AbstractPatroniDaemon):
|
|
|
|
def __init__(self, config):
|
|
super(RaftController, self).__init__(config)
|
|
|
|
config = self.config.get('raft')
|
|
assert 'self_addr' in config
|
|
self._raft = KVStoreTTL(None, None, None, **config)
|
|
|
|
def _run_cycle(self):
|
|
try:
|
|
self._raft.doTick(self._raft.conf.autoTickPeriod)
|
|
except Exception:
|
|
logger.exception('doTick')
|
|
|
|
def _shutdown(self):
|
|
self._raft.destroy()
|
|
|
|
|
|
def main():
|
|
abstract_main(RaftController)
|