Mercurial > libervia-backend
comparison sat/core/sat_main.py @ 3537:f9a5b810f14d
core (memory/storage): backend storage is now based on SQLAlchemy
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 03 Jun 2021 15:20:47 +0200 |
parents | 7550ae9cfbac |
children | 60d3861e5996 |
comparison
equal
deleted
inserted
replaced
3536:0985c47ffd96 | 3537:f9a5b810f14d |
---|---|
56 from ordereddict import OrderedDict | 56 from ordereddict import OrderedDict |
57 | 57 |
58 log = getLogger(__name__) | 58 log = getLogger(__name__) |
59 | 59 |
60 class SAT(service.Service): | 60 class SAT(service.Service): |
61 | |
61 def _init(self): | 62 def _init(self): |
62 # we don't use __init__ to avoid doule initialisation with twistd | 63 # we don't use __init__ to avoid doule initialisation with twistd |
63 # this _init is called in startService | 64 # this _init is called in startService |
64 log.info(f"{C.APP_NAME} {self.full_version}") | 65 log.info(f"{C.APP_NAME} {self.full_version}") |
65 self._cb_map = {} # map from callback_id to callbacks | 66 self._cb_map = {} # map from callback_id to callbacks |
173 self.bridge.register_method("namespacesGet", self.getNamespaces) | 174 self.bridge.register_method("namespacesGet", self.getNamespaces) |
174 self.bridge.register_method("imageCheck", self._imageCheck) | 175 self.bridge.register_method("imageCheck", self._imageCheck) |
175 self.bridge.register_method("imageResize", self._imageResize) | 176 self.bridge.register_method("imageResize", self._imageResize) |
176 self.bridge.register_method("imageGeneratePreview", self._imageGeneratePreview) | 177 self.bridge.register_method("imageGeneratePreview", self._imageGeneratePreview) |
177 self.bridge.register_method("imageConvert", self._imageConvert) | 178 self.bridge.register_method("imageConvert", self._imageConvert) |
178 | 179 defer.ensureDeferred(self._postInit()) |
179 self.memory.initialized.addCallback(lambda __: defer.ensureDeferred(self._postMemoryInit())) | |
180 | 180 |
181 @property | 181 @property |
182 def version(self): | 182 def version(self): |
183 """Return the short version of SàT""" | 183 """Return the short version of SàT""" |
184 return C.APP_VERSION | 184 return C.APP_VERSION |
204 | 204 |
205 @property | 205 @property |
206 def bridge_name(self): | 206 def bridge_name(self): |
207 return os.path.splitext(os.path.basename(self.bridge.__file__))[0] | 207 return os.path.splitext(os.path.basename(self.bridge.__file__))[0] |
208 | 208 |
209 async def _postMemoryInit(self): | 209 async def _postInit(self): |
210 """Method called after memory initialization is done""" | 210 await self.memory.initialise() |
211 self.common_cache = cache.Cache(self, None) | 211 self.common_cache = cache.Cache(self, None) |
212 log.info(_("Memory initialised")) | 212 log.info(_("Memory initialised")) |
213 try: | 213 try: |
214 self._import_plugins() | 214 self._import_plugins() |
215 ui_contact_list.ContactList(self) | 215 ui_contact_list.ContactList(self) |