dimples 1.3.3__tar.gz → 1.3.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dimples-1.3.3 → dimples-1.3.5}/PKG-INFO +1 -1
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/checker.py +3 -3
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/terminal.py +14 -5
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/compat/__init__.py +2 -8
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/compat/compatible.py +40 -15
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/messenger.py +5 -5
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/packer.py +3 -23
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/gatekeeper.py +1 -1
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/protocol/ws.py +2 -2
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/dos/document.py +4 -34
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/dos/group_history.py +2 -70
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/dos/meta.py +8 -1
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/redis/document.py +11 -11
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/redis/meta.py +11 -2
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/t_document.py +2 -2
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/t_group_history.py +11 -11
- {dimples-1.3.3 → dimples-1.3.5}/dimples/edge/start.py +3 -2
- {dimples-1.3.3 → dimples-1.3.5}/dimples/group/manager.py +3 -4
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/session.py +1 -1
- {dimples-1.3.3 → dimples-1.3.5}/dimples.egg-info/PKG-INFO +1 -1
- {dimples-1.3.3 → dimples-1.3.5}/dimples.egg-info/requires.txt +1 -1
- {dimples-1.3.3 → dimples-1.3.5}/setup.py +2 -2
- {dimples-1.3.3 → dimples-1.3.5}/README.md +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/checkpoint.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/commands.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/creator.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/customized.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/group.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/grp_expel.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/grp_invite.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/grp_join.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/grp_query.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/grp_quit.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/grp_reset.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/grp_resign.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/cpu/handshake.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/facebook.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/messenger.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/network/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/network/session.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/network/state.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/network/transition.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/packer.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/client/processor.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/anonymous.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/ans.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/archivist.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/checker.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/compat/address.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/compat/entity.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/compat/loader.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/compat/meta.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/compat/network.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/dbi/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/dbi/account.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/dbi/message.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/dbi/session.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/facebook.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/processer.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/protocol/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/protocol/ans.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/protocol/block.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/protocol/customized.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/protocol/group.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/protocol/handshake.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/protocol/login.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/protocol/mute.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/protocol/password.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/protocol/report.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/protocol/utils.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/protocol/version.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/register.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/common/session.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/flexible.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/gate.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/mars.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/mtp.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/protocol/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/protocol/mars.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/queue.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/seeker.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/session.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/conn/ws.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/account.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/dos/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/dos/base.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/dos/group.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/dos/group_keys.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/dos/login.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/dos/private.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/dos/station.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/dos/user.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/message.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/redis/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/redis/base.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/redis/group.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/redis/grp_history.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/redis/grp_keys.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/redis/login.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/redis/message.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/redis/station.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/redis/user.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/session.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/t_base.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/t_cipherkey.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/t_group.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/t_group_keys.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/t_login.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/t_message.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/t_meta.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/t_private.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/t_station.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/database/t_user.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/edge/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/edge/messenger.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/edge/octopus.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/edge/shared.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/emitter.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/group/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/group/admin.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/group/builder.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/group/delegate.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/group/emitter.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/group/helper.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/group/packer.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/group/shared.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/register/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/register/base.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/register/ext.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/register/run.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/register/shared.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/checker.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/cpu/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/cpu/ans.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/cpu/creator.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/cpu/document.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/cpu/handshake.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/cpu/login.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/cpu/report.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/deliver.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/dis_roamer.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/dispatcher.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/facebook.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/messenger.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/packer.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/processor.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/push.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/session_center.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/server/trace.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/station/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/station/handler.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/station/shared.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/station/start.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/utils/__init__.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/utils/cache.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/utils/checker.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/utils/config.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples/utils/log.py +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples.egg-info/SOURCES.txt +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples.egg-info/dependency_links.txt +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples.egg-info/entry_points.txt +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/dimples.egg-info/top_level.txt +0 -0
- {dimples-1.3.3 → dimples-1.3.5}/setup.cfg +0 -0
|
@@ -71,7 +71,7 @@ class ClientChecker(EntityChecker, Logging):
|
|
|
71
71
|
return False
|
|
72
72
|
elif not self.is_meta_query_expired(identifier=identifier):
|
|
73
73
|
# query not expired yet
|
|
74
|
-
self.
|
|
74
|
+
self.debug(msg='meta query not expired yet: %s' % identifier)
|
|
75
75
|
return False
|
|
76
76
|
self.info(msg='querying meta for: %s' % identifier)
|
|
77
77
|
content = MetaCommand.query(identifier=identifier)
|
|
@@ -86,7 +86,7 @@ class ClientChecker(EntityChecker, Logging):
|
|
|
86
86
|
return False
|
|
87
87
|
elif not self.is_document_query_expired(identifier=identifier):
|
|
88
88
|
# query not expired yet
|
|
89
|
-
self.
|
|
89
|
+
self.debug(msg='document query not expired yet: %s' % identifier)
|
|
90
90
|
return False
|
|
91
91
|
last_time = self.get_last_document_time(identifier=identifier, documents=documents)
|
|
92
92
|
self.info(msg='querying document for: %s, last time: %s' % (identifier, last_time))
|
|
@@ -103,7 +103,7 @@ class ClientChecker(EntityChecker, Logging):
|
|
|
103
103
|
return False
|
|
104
104
|
elif not self.is_members_query_expired(identifier=group):
|
|
105
105
|
# query not expired yet
|
|
106
|
-
self.
|
|
106
|
+
self.debug('members query not expired yet: %s' % group)
|
|
107
107
|
return False
|
|
108
108
|
user = await facebook.current_user
|
|
109
109
|
if user is None:
|
|
@@ -240,14 +240,25 @@ class Terminal(Runner, DeviceMixin, Logging, StateDelegate, ABC):
|
|
|
240
240
|
async def enter_state(self, state: SessionState, ctx: StateMachine, now: float):
|
|
241
241
|
# called before state changed
|
|
242
242
|
session = self.session
|
|
243
|
-
|
|
244
|
-
|
|
243
|
+
if session is None:
|
|
244
|
+
sess_id = None
|
|
245
|
+
srv_id = None
|
|
246
|
+
else:
|
|
247
|
+
sess_id = session.identifier
|
|
248
|
+
station = session.station
|
|
249
|
+
if station is None:
|
|
250
|
+
srv_id = None
|
|
251
|
+
else:
|
|
252
|
+
srv_id = station.identifier
|
|
253
|
+
self.info(msg='enter state: %s, %s => %s' % (state, sess_id, srv_id))
|
|
245
254
|
|
|
246
255
|
# Override
|
|
247
256
|
async def exit_state(self, state: SessionState, ctx: StateMachine, now: float):
|
|
248
257
|
# called after state changed
|
|
249
258
|
current = ctx.current_state
|
|
250
|
-
|
|
259
|
+
session = self.session
|
|
260
|
+
remote = None if session is None else session.remote_address
|
|
261
|
+
self.info(msg='server state changed: %s -> %s, %s' % (state, current, remote))
|
|
251
262
|
index = current.index if isinstance(current, SessionState) else -1
|
|
252
263
|
if index == -1 or index == StateOrder.ERROR:
|
|
253
264
|
self.__last_time = 0
|
|
@@ -259,8 +270,6 @@ class Terminal(Runner, DeviceMixin, Logging, StateDelegate, ABC):
|
|
|
259
270
|
self.warning(msg='current user not set')
|
|
260
271
|
return
|
|
261
272
|
self.info(msg='connect for user: %s' % user)
|
|
262
|
-
session = self.session
|
|
263
|
-
remote = None if session is None else session.remote_address
|
|
264
273
|
if remote is None:
|
|
265
274
|
self.warning(msg='failed to get remote address: %s' % session)
|
|
266
275
|
return
|
|
@@ -41,10 +41,7 @@ from .meta import CompatibleMetaFactory
|
|
|
41
41
|
from .loader import CommonLoader
|
|
42
42
|
from .loader import CommonPluginLoader
|
|
43
43
|
|
|
44
|
-
from .compatible import
|
|
45
|
-
from .compatible import fix_file_content
|
|
46
|
-
from .compatible import fix_cmd, fix_command
|
|
47
|
-
from .compatible import fix_receipt_command, fix_document_command, fix_report_command
|
|
44
|
+
from .compatible import Compatible
|
|
48
45
|
|
|
49
46
|
|
|
50
47
|
__all__ = [
|
|
@@ -62,9 +59,6 @@ __all__ = [
|
|
|
62
59
|
'CommonLoader',
|
|
63
60
|
'CommonPluginLoader',
|
|
64
61
|
|
|
65
|
-
'
|
|
66
|
-
'fix_file_content',
|
|
67
|
-
'fix_cmd', 'fix_command',
|
|
68
|
-
'fix_receipt_command', 'fix_document_command', 'fix_report_command',
|
|
62
|
+
'Compatible',
|
|
69
63
|
|
|
70
64
|
]
|
|
@@ -41,15 +41,32 @@ from ..protocol import MetaType
|
|
|
41
41
|
#
|
|
42
42
|
# Compatible with old versions
|
|
43
43
|
#
|
|
44
|
+
class Compatible:
|
|
44
45
|
|
|
46
|
+
@classmethod
|
|
47
|
+
def fix_meta_attachment(cls, msg: ReliableMessage):
|
|
48
|
+
return _fix_meta_attachment(msg=msg)
|
|
45
49
|
|
|
46
|
-
|
|
50
|
+
@classmethod
|
|
51
|
+
def fix_meta_version(cls, meta: dict):
|
|
52
|
+
return _fix_meta_version(meta=meta)
|
|
53
|
+
|
|
54
|
+
@classmethod
|
|
55
|
+
def fix_file_content(cls, content: FileContent):
|
|
56
|
+
return _fix_file_content(content=content)
|
|
57
|
+
|
|
58
|
+
@classmethod
|
|
59
|
+
def fix_command(cls, content: Command) -> Command:
|
|
60
|
+
return _fix_command(content=content)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def _fix_meta_attachment(msg: ReliableMessage):
|
|
47
64
|
meta = msg.get('meta')
|
|
48
65
|
if meta is not None:
|
|
49
|
-
|
|
66
|
+
return _fix_meta_version(meta=meta)
|
|
50
67
|
|
|
51
68
|
|
|
52
|
-
def
|
|
69
|
+
def _fix_meta_version(meta: dict):
|
|
53
70
|
version = meta.get('type')
|
|
54
71
|
if version is None:
|
|
55
72
|
version = meta.get('version') # compatible with MKM 0.9.*
|
|
@@ -65,7 +82,7 @@ def fix_meta_version(meta: dict):
|
|
|
65
82
|
return meta
|
|
66
83
|
|
|
67
84
|
|
|
68
|
-
def
|
|
85
|
+
def _fix_file_content(content: FileContent):
|
|
69
86
|
pwd = content.get('key')
|
|
70
87
|
if pwd is not None:
|
|
71
88
|
# Tarsier version > 1.3.7
|
|
@@ -80,21 +97,29 @@ def fix_file_content(content: FileContent):
|
|
|
80
97
|
return content
|
|
81
98
|
|
|
82
99
|
|
|
83
|
-
def
|
|
100
|
+
def _fix_command(content: Command) -> Command:
|
|
84
101
|
# 1. fix 'cmd'
|
|
85
|
-
content =
|
|
102
|
+
content = _fix_cmd(content=content)
|
|
86
103
|
# 2. fix other commands
|
|
87
104
|
if isinstance(content, ReceiptCommand):
|
|
88
|
-
|
|
105
|
+
# receipt
|
|
106
|
+
_fix_receipt_command(content=content)
|
|
107
|
+
elif isinstance(content, ReportCommand):
|
|
108
|
+
# report
|
|
109
|
+
_fix_report_command(content=content)
|
|
110
|
+
elif isinstance(content, DocumentCommand):
|
|
111
|
+
# document
|
|
112
|
+
_fix_document_command(content=content)
|
|
89
113
|
elif isinstance(content, MetaCommand):
|
|
114
|
+
# meta
|
|
90
115
|
meta = content.get('meta')
|
|
91
116
|
if meta is not None:
|
|
92
|
-
|
|
117
|
+
_fix_meta_version(meta=meta)
|
|
93
118
|
# OK
|
|
94
119
|
return content
|
|
95
120
|
|
|
96
121
|
|
|
97
|
-
def
|
|
122
|
+
def _fix_cmd(content: Command):
|
|
98
123
|
cmd = content.get('cmd')
|
|
99
124
|
if cmd is None:
|
|
100
125
|
cmd = content.get('command')
|
|
@@ -105,7 +130,7 @@ def fix_cmd(content: Command):
|
|
|
105
130
|
return content
|
|
106
131
|
|
|
107
132
|
|
|
108
|
-
def
|
|
133
|
+
def _copy_receipt_values(content: ReceiptCommand, env: dict):
|
|
109
134
|
for key in ['sender', 'receiver', 'sn', 'signature']:
|
|
110
135
|
value = env.get(key)
|
|
111
136
|
if value is not None:
|
|
@@ -113,14 +138,14 @@ def copy_receipt_values(content: ReceiptCommand, env: dict):
|
|
|
113
138
|
|
|
114
139
|
|
|
115
140
|
# TODO: remove after all server/client upgraded
|
|
116
|
-
def
|
|
141
|
+
def _fix_receipt_command(content: ReceiptCommand):
|
|
117
142
|
origin = content.get('origin')
|
|
118
143
|
if origin is not None:
|
|
119
144
|
# (v2.0)
|
|
120
145
|
# compatible with v1.0
|
|
121
146
|
content['envelope'] = origin
|
|
122
147
|
# compatible with older version
|
|
123
|
-
|
|
148
|
+
_copy_receipt_values(content=content, env=origin)
|
|
124
149
|
return content
|
|
125
150
|
# check for old version
|
|
126
151
|
env = content.get('envelope')
|
|
@@ -129,7 +154,7 @@ def fix_receipt_command(content: ReceiptCommand):
|
|
|
129
154
|
# compatible with v2.0
|
|
130
155
|
content['origin'] = env
|
|
131
156
|
# compatible with older version
|
|
132
|
-
|
|
157
|
+
_copy_receipt_values(content=content, env=env)
|
|
133
158
|
return content
|
|
134
159
|
# check for older version
|
|
135
160
|
if 'sender' in content: # and 'receiver' in content:
|
|
@@ -147,7 +172,7 @@ def fix_receipt_command(content: ReceiptCommand):
|
|
|
147
172
|
|
|
148
173
|
|
|
149
174
|
# TODO: remove after all server/client upgraded
|
|
150
|
-
def
|
|
175
|
+
def _fix_document_command(content: DocumentCommand):
|
|
151
176
|
info = content.get('document')
|
|
152
177
|
if info is not None:
|
|
153
178
|
# (v2.0)
|
|
@@ -186,7 +211,7 @@ def fix_document_command(content: DocumentCommand):
|
|
|
186
211
|
return content
|
|
187
212
|
|
|
188
213
|
|
|
189
|
-
def
|
|
214
|
+
def _fix_report_command(content: ReportCommand):
|
|
190
215
|
# check state for oldest version
|
|
191
216
|
state = content.get('state')
|
|
192
217
|
if state == 'background':
|
|
@@ -53,7 +53,7 @@ from .dbi import MessageDBI
|
|
|
53
53
|
from .facebook import CommonFacebook
|
|
54
54
|
from .session import Transmitter, Session
|
|
55
55
|
|
|
56
|
-
from .compat import
|
|
56
|
+
from .compat import Compatible
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
class CommonMessenger(Messenger, Transmitter, Logging, ABC):
|
|
@@ -136,18 +136,18 @@ class CommonMessenger(Messenger, Transmitter, Logging, ABC):
|
|
|
136
136
|
# Override
|
|
137
137
|
async def serialize_content(self, content: Content, key: SymmetricKey, msg: InstantMessage) -> bytes:
|
|
138
138
|
if isinstance(content, Command):
|
|
139
|
-
content = fix_command(content=content)
|
|
139
|
+
content = Compatible.fix_command(content=content)
|
|
140
140
|
elif isinstance(content, FileContent):
|
|
141
|
-
content = fix_file_content(content=content)
|
|
141
|
+
content = Compatible.fix_file_content(content=content)
|
|
142
142
|
return await super().serialize_content(content=content, key=key, msg=msg)
|
|
143
143
|
|
|
144
144
|
# Override
|
|
145
145
|
async def deserialize_content(self, data: bytes, key: SymmetricKey, msg: SecureMessage) -> Optional[Content]:
|
|
146
146
|
content = await super().deserialize_content(data=data, key=key, msg=msg)
|
|
147
147
|
if isinstance(content, Command):
|
|
148
|
-
content = fix_command(content=content)
|
|
148
|
+
content = Compatible.fix_command(content=content)
|
|
149
149
|
elif isinstance(content, FileContent):
|
|
150
|
-
content = fix_file_content(content=content)
|
|
150
|
+
content = Compatible.fix_file_content(content=content)
|
|
151
151
|
return content
|
|
152
152
|
|
|
153
153
|
#
|
|
@@ -28,16 +28,13 @@ from typing import Optional, Dict
|
|
|
28
28
|
|
|
29
29
|
from dimsdk import EncryptKey
|
|
30
30
|
from dimsdk import ID
|
|
31
|
-
from dimsdk import ReceiptCommand, DocumentCommand
|
|
32
31
|
from dimsdk import InstantMessage, SecureMessage, ReliableMessage
|
|
33
32
|
from dimsdk import MessagePacker
|
|
34
33
|
from dimsdk import MessageUtils
|
|
35
34
|
|
|
36
35
|
from ..utils import Logging
|
|
37
36
|
|
|
38
|
-
from .compat import
|
|
39
|
-
from .compat import fix_receipt_command
|
|
40
|
-
from .compat import fix_document_command
|
|
37
|
+
from .compat import Compatible
|
|
41
38
|
|
|
42
39
|
|
|
43
40
|
class CommonMessagePacker(MessagePacker, Logging, ABC):
|
|
@@ -135,25 +132,8 @@ class CommonMessagePacker(MessagePacker, Logging, ABC):
|
|
|
135
132
|
else:
|
|
136
133
|
self.warning(msg='receiver not ready: %s' % msg.receiver)
|
|
137
134
|
return None
|
|
138
|
-
content = msg.content
|
|
139
|
-
if isinstance(content, ReceiptCommand):
|
|
140
|
-
# compatible with v1.0
|
|
141
|
-
fix_receipt_command(content=content)
|
|
142
135
|
return await super().encrypt_message(msg=msg)
|
|
143
136
|
|
|
144
|
-
# Override
|
|
145
|
-
async def decrypt_message(self, msg: SecureMessage) -> Optional[InstantMessage]:
|
|
146
|
-
i_msg = await super().decrypt_message(msg=msg)
|
|
147
|
-
if i_msg is not None:
|
|
148
|
-
content = i_msg.content
|
|
149
|
-
if isinstance(content, ReceiptCommand):
|
|
150
|
-
# compatible with v1.0
|
|
151
|
-
fix_receipt_command(content=content)
|
|
152
|
-
elif isinstance(content, DocumentCommand):
|
|
153
|
-
# compatible with v1.0
|
|
154
|
-
fix_document_command(content=content)
|
|
155
|
-
return i_msg
|
|
156
|
-
|
|
157
137
|
# Override
|
|
158
138
|
async def verify_message(self, msg: ReliableMessage) -> Optional[SecureMessage]:
|
|
159
139
|
# 1. check receiver/group with local user
|
|
@@ -183,10 +163,10 @@ class CommonMessagePacker(MessagePacker, Logging, ABC):
|
|
|
183
163
|
# return None
|
|
184
164
|
msg = await super().deserialize_message(data=data)
|
|
185
165
|
if msg is not None:
|
|
186
|
-
fix_meta_attachment(msg=msg)
|
|
166
|
+
Compatible.fix_meta_attachment(msg=msg)
|
|
187
167
|
return msg
|
|
188
168
|
|
|
189
169
|
# Override
|
|
190
170
|
async def serialize_message(self, msg: ReliableMessage) -> bytes:
|
|
191
|
-
fix_meta_attachment(msg=msg)
|
|
171
|
+
Compatible.fix_meta_attachment(msg=msg)
|
|
192
172
|
return await super().serialize_message(msg=msg)
|
|
@@ -130,7 +130,7 @@ def reset_send_buffer_size(conn: Connection = None, sock: socket.socket = None)
|
|
|
130
130
|
return False
|
|
131
131
|
channel = conn.channel
|
|
132
132
|
if not isinstance(channel, BaseChannel):
|
|
133
|
-
print('[SOCKET] channel error: %s, %s' % (channel, conn))
|
|
133
|
+
print('[SOCKET] channel error: %s, %s' % (channel, conn.remote_address))
|
|
134
134
|
return False
|
|
135
135
|
sock = channel.sock
|
|
136
136
|
if sock is None:
|
|
@@ -172,7 +172,7 @@ class WebSocket:
|
|
|
172
172
|
mask = None
|
|
173
173
|
# 4. get payload
|
|
174
174
|
if stream_len < pos + msg_len:
|
|
175
|
-
Log.info(msg='incomplete ws package for payload: %d, msg len: %d' % (stream_len, msg_len))
|
|
175
|
+
# Log.info(msg='incomplete ws package for payload: %d, msg len: %d' % (stream_len, msg_len))
|
|
176
176
|
return None, stream
|
|
177
177
|
payload = stream[pos:pos+msg_len]
|
|
178
178
|
pos += msg_len
|
|
@@ -212,7 +212,7 @@ class WebSocket:
|
|
|
212
212
|
# cut the received package(s) and return the remaining
|
|
213
213
|
stream = stream[pos:]
|
|
214
214
|
break
|
|
215
|
-
Log.info(msg='received ws payload len: %d, left: %d' % (len(data), len(stream)))
|
|
215
|
+
# Log.info(msg='received ws payload len: %d, left: %d' % (len(data), len(stream)))
|
|
216
216
|
return data, stream
|
|
217
217
|
|
|
218
218
|
@classmethod
|
|
@@ -26,15 +26,14 @@
|
|
|
26
26
|
from typing import Optional, List
|
|
27
27
|
|
|
28
28
|
from dimsdk import TransportableData
|
|
29
|
-
from dimsdk import ID, Document
|
|
29
|
+
from dimsdk import ID, Document
|
|
30
30
|
|
|
31
31
|
from ...utils import template_replace
|
|
32
|
-
from ...common import DocumentDBI
|
|
33
32
|
|
|
34
33
|
from .base import Storage
|
|
35
34
|
|
|
36
35
|
|
|
37
|
-
class DocumentStorage(Storage
|
|
36
|
+
class DocumentStorage(Storage):
|
|
38
37
|
"""
|
|
39
38
|
Document for Entities (User/Group)
|
|
40
39
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -72,40 +71,11 @@ class DocumentStorage(Storage, DocumentDBI):
|
|
|
72
71
|
documents = []
|
|
73
72
|
for info in array:
|
|
74
73
|
doc = parse_document(dictionary=info, identifier=identifier)
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
if doc is not None:
|
|
75
|
+
documents.append(doc)
|
|
77
76
|
self.info(msg='Loaded %d documents from: %s' % (len(documents), path))
|
|
78
77
|
return documents
|
|
79
78
|
|
|
80
|
-
#
|
|
81
|
-
# Document DBI
|
|
82
|
-
#
|
|
83
|
-
|
|
84
|
-
# Override
|
|
85
|
-
async def save_document(self, document: Document) -> bool:
|
|
86
|
-
""" save document into file """
|
|
87
|
-
identifier = document.identifier
|
|
88
|
-
doc_type = document.type
|
|
89
|
-
# check old documents
|
|
90
|
-
all_documents = await self.get_documents(identifier=identifier)
|
|
91
|
-
old = DocumentUtils.last_document(all_documents, doc_type)
|
|
92
|
-
if old is None and doc_type == Document.VISA:
|
|
93
|
-
old = DocumentUtils.last_document(all_documents, 'profile')
|
|
94
|
-
if old is not None:
|
|
95
|
-
if DocumentUtils.is_expired(document, old):
|
|
96
|
-
self.warning(msg='drop expired document: %s' % identifier)
|
|
97
|
-
return False
|
|
98
|
-
all_documents.remove(old)
|
|
99
|
-
# append it
|
|
100
|
-
all_documents.append(document)
|
|
101
|
-
return await self.save_documents(documents=all_documents, identifier=identifier)
|
|
102
|
-
|
|
103
|
-
# Override
|
|
104
|
-
async def get_documents(self, identifier: ID) -> List[Document]:
|
|
105
|
-
""" load documents from file """
|
|
106
|
-
docs = await self.load_documents(identifier=identifier)
|
|
107
|
-
return [] if docs is None else docs
|
|
108
|
-
|
|
109
79
|
|
|
110
80
|
def parse_document(dictionary: dict, identifier: ID = None, doc_type: str = '*') -> Optional[Document]:
|
|
111
81
|
# check document ID
|
|
@@ -23,20 +23,18 @@
|
|
|
23
23
|
# SOFTWARE.
|
|
24
24
|
# ==============================================================================
|
|
25
25
|
|
|
26
|
-
from typing import
|
|
26
|
+
from typing import Tuple, List
|
|
27
27
|
|
|
28
28
|
from dimsdk import ID
|
|
29
29
|
from dimsdk import ReliableMessage
|
|
30
30
|
from dimsdk import Command, GroupCommand
|
|
31
|
-
from dimsdk import ResetCommand, ResignCommand
|
|
32
31
|
|
|
33
32
|
from ...utils import template_replace
|
|
34
|
-
from ...common import GroupHistoryDBI
|
|
35
33
|
|
|
36
34
|
from .base import Storage
|
|
37
35
|
|
|
38
36
|
|
|
39
|
-
class GroupHistoryStorage(Storage
|
|
37
|
+
class GroupHistoryStorage(Storage):
|
|
40
38
|
"""
|
|
41
39
|
Group History Command Storage
|
|
42
40
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -89,69 +87,3 @@ class GroupHistoryStorage(Storage, GroupHistoryDBI):
|
|
|
89
87
|
path = self.__history_path(group=group)
|
|
90
88
|
self.info(msg='Saving %d group history(ies) into: %s' % (len(histories), path))
|
|
91
89
|
return await self.write_json(container=array, path=path)
|
|
92
|
-
|
|
93
|
-
#
|
|
94
|
-
# Group History DBI
|
|
95
|
-
#
|
|
96
|
-
|
|
97
|
-
# Override
|
|
98
|
-
async def save_group_history(self, group: ID, content: GroupCommand, message: ReliableMessage) -> bool:
|
|
99
|
-
histories = await self.load_group_histories(group=group)
|
|
100
|
-
item = (content, message)
|
|
101
|
-
histories.append(item)
|
|
102
|
-
return await self.save_group_histories(group=group, histories=histories)
|
|
103
|
-
|
|
104
|
-
# Override
|
|
105
|
-
async def get_group_histories(self, group: ID) -> List[Tuple[GroupCommand, ReliableMessage]]:
|
|
106
|
-
return await self.load_group_histories(group=group)
|
|
107
|
-
|
|
108
|
-
# Override
|
|
109
|
-
async def get_reset_command_message(self, group: ID) -> Tuple[Optional[ResetCommand], Optional[ReliableMessage]]:
|
|
110
|
-
histories = await self.load_group_histories(group=group)
|
|
111
|
-
pos = len(histories)
|
|
112
|
-
while pos > 0:
|
|
113
|
-
pos -= 1
|
|
114
|
-
his = histories[pos]
|
|
115
|
-
cmd = his[0]
|
|
116
|
-
msg = his[1]
|
|
117
|
-
if isinstance(cmd, ResetCommand):
|
|
118
|
-
return cmd, msg
|
|
119
|
-
return None, None
|
|
120
|
-
|
|
121
|
-
# Override
|
|
122
|
-
async def clear_group_member_histories(self, group: ID) -> bool:
|
|
123
|
-
histories = await self.load_group_histories(group=group)
|
|
124
|
-
if len(histories) == 0:
|
|
125
|
-
# history empty
|
|
126
|
-
return True
|
|
127
|
-
array = []
|
|
128
|
-
removed = 0
|
|
129
|
-
for his in histories:
|
|
130
|
-
if isinstance(his[0], ResignCommand):
|
|
131
|
-
# keep 'resign' command messages
|
|
132
|
-
array.append(his)
|
|
133
|
-
else:
|
|
134
|
-
# remove other command messages
|
|
135
|
-
removed += 1
|
|
136
|
-
# if nothing changed, return True
|
|
137
|
-
# else, save new histories
|
|
138
|
-
return removed == 0 or await self.save_group_histories(group=group, histories=array)
|
|
139
|
-
|
|
140
|
-
# Override
|
|
141
|
-
async def clear_group_admin_histories(self, group: ID) -> bool:
|
|
142
|
-
histories = await self.load_group_histories(group=group)
|
|
143
|
-
if len(histories) == 0:
|
|
144
|
-
# history empty
|
|
145
|
-
return True
|
|
146
|
-
array = []
|
|
147
|
-
removed = 0
|
|
148
|
-
for his in histories:
|
|
149
|
-
if isinstance(his[0], ResignCommand):
|
|
150
|
-
# remove 'resign' command messages
|
|
151
|
-
removed += 1
|
|
152
|
-
else:
|
|
153
|
-
# keep other command messages
|
|
154
|
-
array.append(his)
|
|
155
|
-
# if nothing changed, return True
|
|
156
|
-
# else, save new histories
|
|
157
|
-
return removed == 0 or await self.save_group_histories(group=group, histories=array)
|
|
@@ -28,12 +28,14 @@ from typing import Optional
|
|
|
28
28
|
from dimsdk import ID, Meta
|
|
29
29
|
|
|
30
30
|
from ...utils import template_replace
|
|
31
|
+
from ...utils import Logging
|
|
32
|
+
from ...common.compat import Compatible
|
|
31
33
|
from ...common import MetaDBI
|
|
32
34
|
|
|
33
35
|
from .base import Storage
|
|
34
36
|
|
|
35
37
|
|
|
36
|
-
class MetaStorage(Storage, MetaDBI):
|
|
38
|
+
class MetaStorage(Storage, Logging, MetaDBI):
|
|
37
39
|
"""
|
|
38
40
|
Meta for Entities (User/Group)
|
|
39
41
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
@@ -69,5 +71,10 @@ class MetaStorage(Storage, MetaDBI):
|
|
|
69
71
|
if info is None:
|
|
70
72
|
# file not found
|
|
71
73
|
self.warning(msg='meta file not found: %s' % path)
|
|
74
|
+
return None
|
|
72
75
|
else:
|
|
76
|
+
Compatible.fix_meta_version(meta=info)
|
|
77
|
+
try:
|
|
73
78
|
return Meta.parse(meta=info)
|
|
79
|
+
except Exception as error:
|
|
80
|
+
self.error(msg='meta error: %s, %s' % (error, info))
|
|
@@ -56,7 +56,17 @@ class DocumentCache(Cache):
|
|
|
56
56
|
def __cache_name(self, identifier: ID) -> str:
|
|
57
57
|
return '%s.%s.%s' % (self.db_name, self.tbl_name, identifier)
|
|
58
58
|
|
|
59
|
-
async def
|
|
59
|
+
async def save_documents(self, documents: List[Document], identifier: ID) -> bool:
|
|
60
|
+
array = []
|
|
61
|
+
for doc in documents:
|
|
62
|
+
assert doc.identifier == identifier, 'document ID not matched: %s, %s' % (identifier, doc)
|
|
63
|
+
array.append(doc.dictionary)
|
|
64
|
+
js = json_encode(obj=array)
|
|
65
|
+
value = utf8_encode(string=js)
|
|
66
|
+
name = self.__cache_name(identifier=identifier)
|
|
67
|
+
return await self.set(name=name, value=value, expires=self.EXPIRES)
|
|
68
|
+
|
|
69
|
+
async def load_documents(self, identifier: ID) -> Optional[List[Document]]:
|
|
60
70
|
name = self.__cache_name(identifier=identifier)
|
|
61
71
|
value = await self.get(name=name)
|
|
62
72
|
if value is None:
|
|
@@ -79,13 +89,3 @@ class DocumentCache(Cache):
|
|
|
79
89
|
else:
|
|
80
90
|
assert info is None, 'document error: %s' % value
|
|
81
91
|
return array
|
|
82
|
-
|
|
83
|
-
async def save_documents(self, documents: List[Document], identifier: ID) -> bool:
|
|
84
|
-
array = []
|
|
85
|
-
for doc in documents:
|
|
86
|
-
assert doc.identifier == identifier, 'document ID not matched: %s, %s' % (identifier, doc)
|
|
87
|
-
array.append(doc.dictionary)
|
|
88
|
-
js = json_encode(obj=array)
|
|
89
|
-
value = utf8_encode(string=js)
|
|
90
|
-
name = self.__cache_name(identifier=identifier)
|
|
91
|
-
return await self.set(name=name, value=value, expires=self.EXPIRES)
|
|
@@ -28,11 +28,13 @@ from typing import Optional
|
|
|
28
28
|
from dimsdk import ID, Meta
|
|
29
29
|
|
|
30
30
|
from ...utils import json_encode, json_decode, utf8_encode, utf8_decode
|
|
31
|
+
from ...utils import Logging
|
|
32
|
+
from ...common.compat import Compatible
|
|
31
33
|
|
|
32
34
|
from .base import Cache
|
|
33
35
|
|
|
34
36
|
|
|
35
|
-
class MetaCache(Cache):
|
|
37
|
+
class MetaCache(Cache, Logging):
|
|
36
38
|
|
|
37
39
|
# meta cached in Redis will be removed after 10 hours, after that
|
|
38
40
|
# it will be reloaded from local storage if it's still need.
|
|
@@ -58,12 +60,19 @@ class MetaCache(Cache):
|
|
|
58
60
|
async def get_meta(self, identifier: ID) -> Optional[Meta]:
|
|
59
61
|
key = self.__cache_name(identifier=identifier)
|
|
60
62
|
value = await self.get(name=key)
|
|
61
|
-
if value is
|
|
63
|
+
if value is None:
|
|
64
|
+
# cache not found
|
|
65
|
+
return None
|
|
66
|
+
else:
|
|
62
67
|
js = utf8_decode(data=value)
|
|
63
68
|
assert js is not None, 'failed to decode string: %s' % value
|
|
64
69
|
info = json_decode(string=js)
|
|
65
70
|
assert info is not None, 'meta error: %s' % value
|
|
71
|
+
Compatible.fix_meta_version(meta=info)
|
|
72
|
+
try:
|
|
66
73
|
return Meta.parse(meta=info)
|
|
74
|
+
except Exception as error:
|
|
75
|
+
self.error(msg='meta error: %s, %s' % (error, info))
|
|
67
76
|
|
|
68
77
|
async def save_meta(self, meta: Meta, identifier: ID) -> bool:
|
|
69
78
|
dictionary = meta.dictionary
|
|
@@ -63,7 +63,7 @@ class DocTask(DbTask):
|
|
|
63
63
|
async def _load_redis_cache(self) -> Optional[List[Document]]:
|
|
64
64
|
# 1. the redis server will return None when cache not found
|
|
65
65
|
# 2. when redis server return an empty array, no need to check local storage again
|
|
66
|
-
return await self._redis.
|
|
66
|
+
return await self._redis.load_documents(identifier=self._identifier)
|
|
67
67
|
|
|
68
68
|
# Override
|
|
69
69
|
async def _save_redis_cache(self, value: List[Document]) -> bool:
|
|
@@ -73,7 +73,7 @@ class DocTask(DbTask):
|
|
|
73
73
|
async def _load_local_storage(self) -> Optional[List[Document]]:
|
|
74
74
|
# 1. the local storage will return an empty array, when no document for this id
|
|
75
75
|
# 2. return empty array as a placeholder for the memory cache
|
|
76
|
-
return await self._dos.
|
|
76
|
+
return await self._dos.load_documents(identifier=self._identifier)
|
|
77
77
|
|
|
78
78
|
# Override
|
|
79
79
|
async def _save_local_storage(self, value: List[Document]) -> bool:
|