dimples 1.3.4__tar.gz → 1.4.0__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.
Files changed (177) hide show
  1. dimples-1.4.0/LICENSE +21 -0
  2. dimples-1.4.0/PKG-INFO +69 -0
  3. {dimples-1.3.4 → dimples-1.4.0}/dimples/__init__.py +2 -2
  4. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/checker.py +3 -3
  5. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/packer.py +4 -14
  6. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/terminal.py +14 -5
  7. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/__init__.py +2 -2
  8. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/messenger.py +16 -1
  9. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/packer.py +10 -23
  10. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/processer.py +2 -58
  11. dimples-1.4.0/dimples/common/queue.py +86 -0
  12. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/gatekeeper.py +1 -1
  13. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/session.py +1 -1
  14. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/__init__.py +2 -2
  15. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/account.py +8 -8
  16. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/dos/base.py +48 -23
  17. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/dos/document.py +5 -35
  18. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/dos/group.py +12 -12
  19. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/dos/group_history.py +6 -74
  20. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/dos/group_keys.py +4 -4
  21. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/message.py +5 -5
  22. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/redis/__init__.py +1 -1
  23. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/redis/base.py +12 -1
  24. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/redis/document.py +13 -13
  25. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/redis/group.py +2 -2
  26. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/redis/grp_history.py +2 -2
  27. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/redis/grp_keys.py +2 -2
  28. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/redis/login.py +2 -2
  29. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/redis/message.py +2 -2
  30. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/redis/meta.py +2 -2
  31. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/redis/station.py +2 -2
  32. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/redis/user.py +2 -2
  33. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/session.py +4 -4
  34. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/t_base.py +0 -28
  35. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/t_cipherkey.py +2 -3
  36. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/t_document.py +7 -6
  37. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/t_group.py +5 -4
  38. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/t_group_history.py +16 -15
  39. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/t_group_keys.py +5 -4
  40. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/t_login.py +5 -4
  41. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/t_message.py +4 -3
  42. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/t_meta.py +5 -4
  43. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/t_private.py +4 -3
  44. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/t_station.py +5 -4
  45. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/t_user.py +5 -4
  46. {dimples-1.3.4 → dimples-1.4.0}/dimples/edge/shared.py +48 -61
  47. {dimples-1.3.4 → dimples-1.4.0}/dimples/edge/start.py +5 -3
  48. {dimples-1.3.4 → dimples-1.4.0}/dimples/register/shared.py +6 -34
  49. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/__init__.py +0 -5
  50. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/checker.py +3 -3
  51. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/messenger.py +3 -6
  52. dimples-1.4.0/dimples/server/packer.py +74 -0
  53. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/processor.py +90 -55
  54. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/push.py +4 -4
  55. {dimples-1.3.4 → dimples-1.4.0}/dimples/station/shared.py +45 -59
  56. {dimples-1.3.4 → dimples-1.4.0}/dimples/station/start.py +2 -1
  57. {dimples-1.3.4 → dimples-1.4.0}/dimples/utils/__init__.py +5 -0
  58. dimples-1.4.0/dimples/utils/config.py +395 -0
  59. dimples-1.4.0/dimples/utils/http.py +203 -0
  60. dimples-1.4.0/dimples.egg-info/PKG-INFO +69 -0
  61. {dimples-1.3.4 → dimples-1.4.0}/dimples.egg-info/SOURCES.txt +3 -0
  62. {dimples-1.3.4 → dimples-1.4.0}/dimples.egg-info/entry_points.txt +0 -1
  63. {dimples-1.3.4 → dimples-1.4.0}/dimples.egg-info/requires.txt +2 -1
  64. {dimples-1.3.4 → dimples-1.4.0}/setup.py +4 -2
  65. dimples-1.3.4/PKG-INFO +0 -69
  66. dimples-1.3.4/dimples/server/packer.py +0 -247
  67. dimples-1.3.4/dimples/utils/config.py +0 -226
  68. dimples-1.3.4/dimples.egg-info/PKG-INFO +0 -69
  69. {dimples-1.3.4 → dimples-1.4.0}/README.md +0 -0
  70. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/__init__.py +0 -0
  71. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/checkpoint.py +0 -0
  72. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/__init__.py +0 -0
  73. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/commands.py +0 -0
  74. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/creator.py +0 -0
  75. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/customized.py +0 -0
  76. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/group.py +0 -0
  77. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/grp_expel.py +0 -0
  78. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/grp_invite.py +0 -0
  79. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/grp_join.py +0 -0
  80. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/grp_query.py +0 -0
  81. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/grp_quit.py +0 -0
  82. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/grp_reset.py +0 -0
  83. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/grp_resign.py +0 -0
  84. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/cpu/handshake.py +0 -0
  85. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/facebook.py +0 -0
  86. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/messenger.py +0 -0
  87. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/network/__init__.py +0 -0
  88. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/network/session.py +0 -0
  89. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/network/state.py +0 -0
  90. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/network/transition.py +0 -0
  91. {dimples-1.3.4 → dimples-1.4.0}/dimples/client/processor.py +0 -0
  92. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/anonymous.py +0 -0
  93. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/ans.py +0 -0
  94. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/archivist.py +0 -0
  95. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/checker.py +0 -0
  96. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/compat/__init__.py +0 -0
  97. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/compat/address.py +0 -0
  98. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/compat/compatible.py +0 -0
  99. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/compat/entity.py +0 -0
  100. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/compat/loader.py +0 -0
  101. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/compat/meta.py +0 -0
  102. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/compat/network.py +0 -0
  103. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/dbi/__init__.py +0 -0
  104. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/dbi/account.py +0 -0
  105. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/dbi/message.py +0 -0
  106. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/dbi/session.py +0 -0
  107. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/facebook.py +0 -0
  108. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/protocol/__init__.py +0 -0
  109. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/protocol/ans.py +0 -0
  110. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/protocol/block.py +0 -0
  111. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/protocol/customized.py +0 -0
  112. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/protocol/group.py +0 -0
  113. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/protocol/handshake.py +0 -0
  114. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/protocol/login.py +0 -0
  115. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/protocol/mute.py +0 -0
  116. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/protocol/password.py +0 -0
  117. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/protocol/report.py +0 -0
  118. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/protocol/utils.py +0 -0
  119. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/protocol/version.py +0 -0
  120. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/register.py +0 -0
  121. {dimples-1.3.4 → dimples-1.4.0}/dimples/common/session.py +0 -0
  122. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/__init__.py +0 -0
  123. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/flexible.py +0 -0
  124. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/gate.py +0 -0
  125. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/mars.py +0 -0
  126. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/mtp.py +0 -0
  127. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/protocol/__init__.py +0 -0
  128. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/protocol/mars.py +0 -0
  129. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/protocol/ws.py +0 -0
  130. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/queue.py +0 -0
  131. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/seeker.py +0 -0
  132. {dimples-1.3.4 → dimples-1.4.0}/dimples/conn/ws.py +0 -0
  133. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/dos/__init__.py +0 -0
  134. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/dos/login.py +0 -0
  135. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/dos/meta.py +0 -0
  136. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/dos/private.py +0 -0
  137. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/dos/station.py +0 -0
  138. {dimples-1.3.4 → dimples-1.4.0}/dimples/database/dos/user.py +0 -0
  139. {dimples-1.3.4 → dimples-1.4.0}/dimples/edge/__init__.py +0 -0
  140. {dimples-1.3.4 → dimples-1.4.0}/dimples/edge/messenger.py +0 -0
  141. {dimples-1.3.4 → dimples-1.4.0}/dimples/edge/octopus.py +0 -0
  142. {dimples-1.3.4 → dimples-1.4.0}/dimples/emitter.py +0 -0
  143. {dimples-1.3.4 → dimples-1.4.0}/dimples/group/__init__.py +0 -0
  144. {dimples-1.3.4 → dimples-1.4.0}/dimples/group/admin.py +0 -0
  145. {dimples-1.3.4 → dimples-1.4.0}/dimples/group/builder.py +0 -0
  146. {dimples-1.3.4 → dimples-1.4.0}/dimples/group/delegate.py +0 -0
  147. {dimples-1.3.4 → dimples-1.4.0}/dimples/group/emitter.py +0 -0
  148. {dimples-1.3.4 → dimples-1.4.0}/dimples/group/helper.py +0 -0
  149. {dimples-1.3.4 → dimples-1.4.0}/dimples/group/manager.py +0 -0
  150. {dimples-1.3.4 → dimples-1.4.0}/dimples/group/packer.py +0 -0
  151. {dimples-1.3.4 → dimples-1.4.0}/dimples/group/shared.py +0 -0
  152. {dimples-1.3.4 → dimples-1.4.0}/dimples/register/__init__.py +0 -0
  153. {dimples-1.3.4 → dimples-1.4.0}/dimples/register/base.py +0 -0
  154. {dimples-1.3.4 → dimples-1.4.0}/dimples/register/ext.py +0 -0
  155. {dimples-1.3.4 → dimples-1.4.0}/dimples/register/run.py +0 -0
  156. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/cpu/__init__.py +0 -0
  157. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/cpu/ans.py +0 -0
  158. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/cpu/creator.py +0 -0
  159. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/cpu/document.py +0 -0
  160. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/cpu/handshake.py +0 -0
  161. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/cpu/login.py +0 -0
  162. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/cpu/report.py +0 -0
  163. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/deliver.py +0 -0
  164. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/dis_roamer.py +0 -0
  165. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/dispatcher.py +0 -0
  166. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/facebook.py +0 -0
  167. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/session.py +0 -0
  168. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/session_center.py +0 -0
  169. {dimples-1.3.4 → dimples-1.4.0}/dimples/server/trace.py +0 -0
  170. {dimples-1.3.4 → dimples-1.4.0}/dimples/station/__init__.py +0 -0
  171. {dimples-1.3.4 → dimples-1.4.0}/dimples/station/handler.py +0 -0
  172. {dimples-1.3.4 → dimples-1.4.0}/dimples/utils/cache.py +0 -0
  173. {dimples-1.3.4 → dimples-1.4.0}/dimples/utils/checker.py +0 -0
  174. {dimples-1.3.4 → dimples-1.4.0}/dimples/utils/log.py +0 -0
  175. {dimples-1.3.4 → dimples-1.4.0}/dimples.egg-info/dependency_links.txt +0 -0
  176. {dimples-1.3.4 → dimples-1.4.0}/dimples.egg-info/top_level.txt +0 -0
  177. {dimples-1.3.4 → dimples-1.4.0}/setup.cfg +0 -0
dimples-1.4.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2022 Albert Moky
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
dimples-1.4.0/PKG-INFO ADDED
@@ -0,0 +1,69 @@
1
+ Metadata-Version: 2.1
2
+ Name: dimples
3
+ Version: 1.4.0
4
+ Summary: DIMP Library for Edges and Stations
5
+ Home-page: https://github.com/dimchat/demo-py
6
+ Author: Albert Moky
7
+ Author-email: albert.moky@gmail.com
8
+ License: MIT
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Operating System :: OS Independent
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+
15
+ # DIMP Library for Edges and Stations (Python version)
16
+
17
+ [![License](https://img.shields.io/github/license/dimchat/demo-py)](https://github.com/dimchat/demo-py/blob/master/LICENSE)
18
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/dimchat/demo-py/pulls)
19
+ [![Platform](https://img.shields.io/badge/Platform-Python%203-brightgreen.svg)](https://github.com/dimchat/demo-py/wiki)
20
+ [![Issues](https://img.shields.io/github/issues/dimchat/demo-py)](https://github.com/dimchat/demo-py/issues)
21
+ [![Repo Size](https://img.shields.io/github/repo-size/dimchat/demo-py)](https://github.com/dimchat/demo-py/archive/refs/heads/main.zip)
22
+ [![Tags](https://img.shields.io/github/tag/dimchat/demo-py)](https://github.com/dimchat/demo-py/tags)
23
+ [![Version](https://img.shields.io/pypi/v/dimples)](https://pypi.org/project/dimples)
24
+
25
+ [![Watchers](https://img.shields.io/github/watchers/dimchat/demo-py)](https://github.com/dimchat/demo-py/watchers)
26
+ [![Forks](https://img.shields.io/github/forks/dimchat/demo-py)](https://github.com/dimchat/demo-py/forks)
27
+ [![Stars](https://img.shields.io/github/stars/dimchat/demo-py)](https://github.com/dimchat/demo-py/stargazers)
28
+ [![Followers](https://img.shields.io/github/followers/dimchat)](https://github.com/orgs/dimchat/followers)
29
+
30
+ ## Dependencies
31
+
32
+ * setup.py
33
+
34
+ ```
35
+ install_requires=[
36
+ # 'pycryptodome', # 3.14.1
37
+ # 'base58', # 1.0.3
38
+ # 'ecdsa', # 0.16.1
39
+ 'dimplugins>=2.2.2',
40
+
41
+ 'dimsdk>=2.2.2',
42
+ # 'dimp>=2.2.2',
43
+ # 'dkd>=2.2.2',
44
+ # 'mkm>=2.2.2',
45
+
46
+ 'startrek>=2.2.2',
47
+ 'tcp>=2.2.2',
48
+ 'udp>=2.2.2',
49
+
50
+ 'aiou>=0.3.0',
51
+ ]
52
+ ```
53
+
54
+ * Latest Versions
55
+
56
+ | Name | Version | Description |
57
+ |------|---------|-------------|
58
+ | [Ming Ke Ming (名可名)](https://github.com/dimchat/mkm-py) | [![Version](https://img.shields.io/pypi/v/mkm)](https://pypi.org/project/mkm) | Decentralized User Identity Authentication |
59
+ | [Dao Ke Dao (道可道)](https://github.com/dimchat/dkd-py) | [![Version](https://img.shields.io/pypi/v/dkd)](https://pypi.org/project/dkd) | Universal Message Module |
60
+ | [DIMP (去中心化通讯协议)](https://github.com/dimchat/core-py) | [![Version](https://img.shields.io/pypi/v/dimp)](https://pypi.org/project/dimp) | Decentralized Instant Messaging Protocol |
61
+ | [DIM SDK](https://github.com/dimchat/sdk-py) | [![Version](https://img.shields.io/pypi/v/dimsdk)](https://pypi.org/project/dimsdk) | Software Development Kit |
62
+ | [DIM Plugins](https://github.com/dimchat/sdk-dart) | [![Version](https://img.shields.io/pypi/v/dimplugins)](https://pypi.org/project/dimplugins) | Cryptography & Account Plugins |
63
+
64
+ Talk is cheap, [read my codes](https://github.com/dimchat/demo-py).
65
+
66
+ ----
67
+
68
+ Copyright © 2018-2025 Albert Moky
69
+ [![Followers](https://img.shields.io/github/followers/moky)](https://github.com/moky?tab=followers)
@@ -374,7 +374,7 @@ __all__ = [
374
374
  'CommonMessenger',
375
375
  'CommonMessagePacker',
376
376
  'CommonMessageProcessor',
377
- 'Vestibule',
377
+ 'SuspendedMessageQueue',
378
378
 
379
379
  'Transmitter',
380
380
  'Session',
@@ -470,7 +470,7 @@ __all__ = [
470
470
  # Table
471
471
  #
472
472
 
473
- 'DbInfo', 'DbTask',
473
+ 'DbTask',
474
474
 
475
475
  'PrivateKeyTable', 'MetaTable', 'DocumentTable',
476
476
  'UserTable', 'GroupTable', 'GroupHistoryTable',
@@ -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.info(msg='meta query not expired yet: %s' % identifier)
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.info(msg='document query not expired yet: %s' % identifier)
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.info('members query not expired yet: %s' % group)
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:
@@ -27,7 +27,7 @@
27
27
  Common extensions for MessagePacker
28
28
  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
29
29
  """
30
- from typing import Optional, List, Dict
30
+ from typing import Optional, List
31
31
 
32
32
  from dimsdk import ID
33
33
  from dimsdk import ContentType, TextContent, FileContent
@@ -48,16 +48,6 @@ class ClientMessagePacker(CommonMessagePacker):
48
48
  assert isinstance(barrack, CommonFacebook), 'barrack error: %s' % barrack
49
49
  return barrack
50
50
 
51
- # Override
52
- def suspend_reliable_message(self, msg: ReliableMessage, error: Dict):
53
- # TODO:
54
- self.warning(msg='TODO: suspend reliable message: %s => %s' % (msg.sender, msg.receiver))
55
-
56
- # Override
57
- def suspend_instant_message(self, msg: InstantMessage, error: Dict):
58
- # TODO:
59
- self.warning(msg='TODO: suspend instant message: %s => %s' % (msg.sender, msg.receiver))
60
-
61
51
  # protected
62
52
  async def _get_members(self, group: ID) -> List[ID]:
63
53
  """ for checking whether group's ready """
@@ -83,7 +73,7 @@ class ClientMessagePacker(CommonMessagePacker):
83
73
  'message': 'group not ready',
84
74
  'group': str(receiver),
85
75
  }
86
- self.suspend_instant_message(msg=msg, error=error)
76
+ self.messenger.suspend_instant_message(msg=msg, error=error)
87
77
  return False
88
78
  #
89
79
  # check group members' visa key
@@ -102,7 +92,7 @@ class ClientMessagePacker(CommonMessagePacker):
102
92
  'group': str(receiver),
103
93
  'members': ID.revert(array=waiting),
104
94
  }
105
- self.suspend_instant_message(msg=msg, error=error)
95
+ self.messenger.suspend_instant_message(msg=msg, error=error)
106
96
  # perhaps some members have already disappeared,
107
97
  # although the packer will query document when the member's visa key is not found,
108
98
  # but the station will never respond with the right document,
@@ -139,7 +129,7 @@ class ClientMessagePacker(CommonMessagePacker):
139
129
  'message': 'group not ready',
140
130
  'group': str(receiver),
141
131
  }
142
- self.suspend_reliable_message(msg=msg, error=error) # msg['error'] = error
132
+ self.messenger.suspend_reliable_message(msg=msg, error=error) # msg['error'] = error
143
133
  return False
144
134
 
145
135
  # Override
@@ -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
- station = session.station
244
- self.info(msg='enter state: %s, %s => %s' % (state, session.identifier, station.identifier))
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
- self.info(msg='server state changed: %s -> %s, %s' % (state, current, self.session.station))
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
@@ -42,7 +42,7 @@ from .facebook import CommonFacebook
42
42
  from .messenger import CommonMessenger
43
43
  from .packer import CommonMessagePacker
44
44
  from .processer import CommonMessageProcessor
45
- from .processer import Vestibule
45
+ from .queue import SuspendedMessageQueue
46
46
  from .session import Transmitter, Session
47
47
 
48
48
 
@@ -100,7 +100,7 @@ __all__ = [
100
100
  'CommonMessenger',
101
101
  'CommonMessagePacker',
102
102
  'CommonMessageProcessor',
103
- 'Vestibule',
103
+ 'SuspendedMessageQueue',
104
104
 
105
105
  'Transmitter',
106
106
  'Session',
@@ -36,7 +36,7 @@
36
36
  """
37
37
 
38
38
  from abc import ABC
39
- from typing import Optional, Union, Tuple
39
+ from typing import Optional, Union, Tuple, List, Dict
40
40
 
41
41
  from dimsdk import SymmetricKey
42
42
  from dimsdk import ID
@@ -53,6 +53,8 @@ from .dbi import MessageDBI
53
53
  from .facebook import CommonFacebook
54
54
  from .session import Transmitter, Session
55
55
 
56
+ from .queue import SuspendedMessageQueue
57
+
56
58
  from .compat import Compatible
57
59
 
58
60
 
@@ -65,6 +67,7 @@ class CommonMessenger(Messenger, Transmitter, Logging, ABC):
65
67
  self.__database = database
66
68
  self.__packer: Optional[Packer] = None
67
69
  self.__processor: Optional[Processor] = None
70
+ self.__queue = SuspendedMessageQueue()
68
71
 
69
72
  @property # Override
70
73
  def packer(self) -> Packer:
@@ -102,6 +105,18 @@ class CommonMessenger(Messenger, Transmitter, Logging, ABC):
102
105
  def session(self) -> Session:
103
106
  return self.__session
104
107
 
108
+ def suspend_reliable_message(self, msg: ReliableMessage, error: Dict):
109
+ self.__queue.suspend_reliable_message(msg=msg, error=error)
110
+
111
+ def suspend_instant_message(self, msg: InstantMessage, error: Dict):
112
+ self.__queue.suspend_instant_message(msg=msg, error=error)
113
+
114
+ def resume_reliable_messages(self) -> List[ReliableMessage]:
115
+ return self.__queue.resume_reliable_messages()
116
+
117
+ def resume_instant_messages(self) -> List[InstantMessage]:
118
+ return self.__queue.resume_instant_messages()
119
+
105
120
  # Override
106
121
  async def encrypt_key(self, data: bytes, receiver: ID, msg: InstantMessage) -> Optional[bytes]:
107
122
  try:
@@ -23,8 +23,8 @@
23
23
  # SOFTWARE.
24
24
  # ==============================================================================
25
25
 
26
- from abc import ABC, abstractmethod
27
- from typing import Optional, Dict
26
+ from abc import ABC
27
+ from typing import Optional
28
28
 
29
29
  from dimsdk import EncryptKey
30
30
  from dimsdk import ID
@@ -34,30 +34,17 @@ from dimsdk import MessageUtils
34
34
 
35
35
  from ..utils import Logging
36
36
 
37
+ from .messenger import CommonMessenger
37
38
  from .compat import Compatible
38
39
 
39
40
 
40
41
  class CommonMessagePacker(MessagePacker, Logging, ABC):
41
42
 
42
- @abstractmethod # protected
43
- def suspend_reliable_message(self, msg: ReliableMessage, error: Dict):
44
- """
45
- Add income message in a queue for waiting sender's visa
46
-
47
- :param msg: incoming message
48
- :param error: error info
49
- """
50
- raise NotImplemented
51
-
52
- @abstractmethod # protected
53
- def suspend_instant_message(self, msg: InstantMessage, error: Dict):
54
- """
55
- Add outgo message in a queue for waiting receiver's visa
56
-
57
- :param msg: outgo message
58
- :param error: error info
59
- """
60
- raise NotImplemented
43
+ @property
44
+ def messenger(self) -> Optional[CommonMessenger]:
45
+ transceiver = super().messenger
46
+ assert isinstance(transceiver, CommonMessenger), 'transceiver error: %s' % transceiver
47
+ return transceiver
61
48
 
62
49
  #
63
50
  # Checking
@@ -90,7 +77,7 @@ class CommonMessagePacker(MessagePacker, Logging, ABC):
90
77
  'message': 'verify key not found',
91
78
  'user': str(sender),
92
79
  }
93
- self.suspend_reliable_message(msg=msg, error=error) # msg['error'] = error
80
+ self.messenger.suspend_reliable_message(msg=msg, error=error) # msg['error'] = error
94
81
  return False
95
82
 
96
83
  # protected
@@ -115,7 +102,7 @@ class CommonMessagePacker(MessagePacker, Logging, ABC):
115
102
  'message': 'encrypt key not found',
116
103
  'user': str(receiver),
117
104
  }
118
- self.suspend_instant_message(msg=msg, error=error) # msg['error'] = error
105
+ self.messenger.suspend_instant_message(msg=msg, error=error) # msg['error'] = error
119
106
  return False
120
107
 
121
108
  #
@@ -23,13 +23,12 @@
23
23
  # SOFTWARE.
24
24
  # ==============================================================================
25
25
 
26
- import threading
27
26
  from abc import ABC, abstractmethod
28
- from typing import List, Dict
27
+ from typing import List
29
28
 
30
29
  from dimsdk import DateTime
31
30
  from dimsdk import Content
32
- from dimsdk import InstantMessage, ReliableMessage
31
+ from dimsdk import ReliableMessage
33
32
  from dimsdk import MessageProcessor
34
33
  from dimsdk import Facebook, Messenger
35
34
  from dimsdk import ContentProcessorCreator
@@ -83,58 +82,3 @@ class CommonMessageProcessor(MessageProcessor, Logging, ABC):
83
82
  # to make sure the user info synchronized
84
83
  await self._check_visa_time(content=content, r_msg=r_msg)
85
84
  return responses
86
-
87
-
88
- class Vestibule(Logging):
89
- """
90
- Message Waiting List
91
- ~~~~~~~~~~~~~~~~~~~~
92
- """
93
-
94
- def __init__(self, capacity: int = 32):
95
- super().__init__()
96
- self.__capacity = capacity
97
- # suspended messages
98
- self.__suspend_lock = threading.Lock()
99
- self.__incoming_messages: List[ReliableMessage] = []
100
- self.__outgoing_messages: List[InstantMessage] = []
101
-
102
- def suspend_reliable_message(self, msg: ReliableMessage, error: Dict):
103
- """
104
- Add income message in a queue for waiting sender's visa
105
-
106
- :param msg: incoming message
107
- :param error: error info
108
- """
109
- self.warning(msg='suspend message: %s -> %s, %s' % (msg.sender, msg.receiver, error))
110
- msg['error'] = error
111
- with self.__suspend_lock:
112
- if len(self.__incoming_messages) > self.__capacity:
113
- self.__incoming_messages.pop(0)
114
- self.__incoming_messages.append(msg)
115
-
116
- def suspend_instant_message(self, msg: InstantMessage, error: Dict):
117
- """
118
- Add outgo message in a queue for waiting receiver's visa
119
-
120
- :param msg: outgo message
121
- :param error: error info
122
- """
123
- self.warning(msg='suspend message: %s -> %s, %s' % (msg.sender, msg.receiver, error))
124
- msg['error'] = error
125
- with self.__suspend_lock:
126
- if len(self.__outgoing_messages) > self.__capacity:
127
- self.__outgoing_messages.pop(0)
128
- self.__outgoing_messages.append(msg)
129
-
130
- def resume_reliable_messages(self) -> List[ReliableMessage]:
131
- with self.__suspend_lock:
132
- messages = self.__incoming_messages
133
- self.__incoming_messages = []
134
- return messages
135
-
136
- def resume_instant_messages(self) -> List[InstantMessage]:
137
- with self.__suspend_lock:
138
- messages = self.__outgoing_messages
139
- self.__outgoing_messages = []
140
- return messages
@@ -0,0 +1,86 @@
1
+ # -*- coding: utf-8 -*-
2
+ # ==============================================================================
3
+ # MIT License
4
+ #
5
+ # Copyright (c) 2023 Albert Moky
6
+ #
7
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ # of this software and associated documentation files (the "Software"), to deal
9
+ # in the Software without restriction, including without limitation the rights
10
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ # copies of the Software, and to permit persons to whom the Software is
12
+ # furnished to do so, subject to the following conditions:
13
+ #
14
+ # The above copyright notice and this permission notice shall be included in all
15
+ # copies or substantial portions of the Software.
16
+ #
17
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ # SOFTWARE.
24
+ # ==============================================================================
25
+
26
+ import threading
27
+ from typing import List, Dict
28
+
29
+ from dimsdk import InstantMessage, ReliableMessage
30
+
31
+ from ..utils import Logging
32
+
33
+
34
+ class SuspendedMessageQueue(Logging):
35
+ """
36
+ Message Waiting List
37
+ ~~~~~~~~~~~~~~~~~~~~
38
+ """
39
+
40
+ def __init__(self, capacity: int = 32):
41
+ super().__init__()
42
+ self.__capacity = capacity
43
+ # suspended messages
44
+ self.__suspend_lock = threading.Lock()
45
+ self.__incoming_messages: List[ReliableMessage] = []
46
+ self.__outgoing_messages: List[InstantMessage] = []
47
+
48
+ def suspend_reliable_message(self, msg: ReliableMessage, error: Dict):
49
+ """
50
+ Add income message in a queue for waiting sender's visa
51
+
52
+ :param msg: incoming message
53
+ :param error: error info
54
+ """
55
+ self.warning(msg='suspend message: %s -> %s, %s' % (msg.sender, msg.receiver, error))
56
+ msg['error'] = error
57
+ with self.__suspend_lock:
58
+ if len(self.__incoming_messages) > self.__capacity:
59
+ self.__incoming_messages.pop(0)
60
+ self.__incoming_messages.append(msg)
61
+
62
+ def suspend_instant_message(self, msg: InstantMessage, error: Dict):
63
+ """
64
+ Add outgo message in a queue for waiting receiver's visa
65
+
66
+ :param msg: outgo message
67
+ :param error: error info
68
+ """
69
+ self.warning(msg='suspend message: %s -> %s, %s' % (msg.sender, msg.receiver, error))
70
+ msg['error'] = error
71
+ with self.__suspend_lock:
72
+ if len(self.__outgoing_messages) > self.__capacity:
73
+ self.__outgoing_messages.pop(0)
74
+ self.__outgoing_messages.append(msg)
75
+
76
+ def resume_reliable_messages(self) -> List[ReliableMessage]:
77
+ with self.__suspend_lock:
78
+ messages = self.__incoming_messages
79
+ self.__incoming_messages = []
80
+ return messages
81
+
82
+ def resume_instant_messages(self) -> List[InstantMessage]:
83
+ with self.__suspend_lock:
84
+ messages = self.__outgoing_messages
85
+ self.__outgoing_messages = []
86
+ return messages
@@ -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:
@@ -58,7 +58,7 @@ class BaseSession(GateKeeper, Session, ABC):
58
58
  return '<%s id="%s" remote="%s" key="%s" />' % (cname, self.identifier, self.remote_address, self.session_key)
59
59
 
60
60
  # Override
61
- def __repr__(self):
61
+ def __repr__(self) -> str:
62
62
  cname = self.__class__.__name__
63
63
  return '<%s id="%s" remote="%s" key="%s" />' % (cname, self.identifier, self.remote_address, self.session_key)
64
64
 
@@ -34,7 +34,7 @@ from ..common.dbi import *
34
34
  from .dos import *
35
35
  from .redis import *
36
36
 
37
- from .t_base import DbInfo, DbTask
37
+ from .t_base import DbTask
38
38
 
39
39
  from .t_private import PrivateKeyTable
40
40
  from .t_meta import MetaTable
@@ -100,7 +100,7 @@ __all__ = [
100
100
  # Table
101
101
  #
102
102
 
103
- 'DbInfo', 'DbTask',
103
+ 'DbTask',
104
104
 
105
105
  'PrivateKeyTable', 'MetaTable', 'DocumentTable',
106
106
  'UserTable', 'GroupTable', 'GroupHistoryTable',
@@ -31,9 +31,9 @@ from dimsdk import ID, Meta, Document, Bulletin
31
31
  from dimsdk import ReliableMessage
32
32
  from dimsdk import MetaUtils
33
33
 
34
+ from ..utils import Config
34
35
  from ..common import AccountDBI
35
36
 
36
- from .t_base import DbInfo
37
37
  from .t_private import PrivateKeyTable
38
38
  from .t_meta import MetaTable
39
39
  from .t_document import DocumentTable
@@ -48,14 +48,14 @@ class AccountDatabase(AccountDBI):
48
48
  ~~~~~~~~~~~~~~~~~~~~~~~
49
49
  """
50
50
 
51
- def __init__(self, info: DbInfo):
51
+ def __init__(self, config: Config):
52
52
  super().__init__()
53
- self._private_table = PrivateKeyTable(info=info)
54
- self._meta_table = MetaTable(info=info)
55
- self._doc_table = DocumentTable(info=info)
56
- self._user_table = UserTable(info=info)
57
- self._group_table = GroupTable(info=info)
58
- self._history_table = GroupHistoryTable(info=info)
53
+ self._private_table = PrivateKeyTable(config=config)
54
+ self._meta_table = MetaTable(config=config)
55
+ self._doc_table = DocumentTable(config=config)
56
+ self._user_table = UserTable(config=config)
57
+ self._group_table = GroupTable(config=config)
58
+ self._history_table = GroupHistoryTable(config=config)
59
59
 
60
60
  def show_info(self):
61
61
  self._private_table.show_info()