-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
314 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
Архитектура | ||
=========== | ||
|
||
.. contents:: | ||
:local: | ||
|
||
По историческим причинам «Сказка» — монолитный проект с сильной связанностью, это начало усложнять реализацию новых фич. Поэтому сейчас он переписывается на микросервисы. Пока идёт активная фаза рефакторинга, сервисы выделяются логически, но не выносятся из основного репозитория (ложаться в соседние каталоги). Когда крупные изменения закончатся, сервисы будут разнесены в разные репозитории. | ||
|
||
На этой странице описана архитектура игры, какой она должна стать. | ||
|
||
Базовая структура | ||
----------------- | ||
|
||
.. figure:: images/architecture.png | ||
|
||
Стрелками указано использование сервисами друг друга. | ||
|
||
Все сервисы игры можно разделить на две группы: | ||
|
||
- **frontend** — сервисы, с которыми так или иначе взаимодействуют пользователи. | ||
- **backend** — сервисы, не доступные напрямую для пользователей. | ||
|
||
**Frontend** сервисы проверяют права доступа и используют **backend** сервисы для получения данных и инициации изменений. | ||
**Backend** сервисы реализуют специализированные куски логики и не делают неспецифичных проверок (например, не проверяют права доступа). | ||
|
||
**Backend** сервисы недоступны извне, доверяют всем клиентам и не реализуют GUI (предоставляют только API). | ||
|
||
Коммуникация сервисов происходит через передачу сообщений в формате `Protocol Buffers 3 <https://developers.google.com/protocol-buffers/docs/proto3>`_ по протоколу HTTP. | ||
|
||
Сервисы | ||
------- | ||
|
||
Текущий список сервисов. | ||
|
||
- the_tale — сайт игры (сейчас содержит и основную логику); | ||
- tt_diary — хранилище сообщений в дневнике героя; | ||
- tt_market — рынок; | ||
- tt_personal_messages — личные сообщения; | ||
- tt_storage — хранилище предметов игрока (в рамках Сказки, карты судьбы). | ||
|
||
the_tale | ||
~~~~~~~~ | ||
|
||
Вся функциональность игры: как логика, так и инфраструктура (форум, регистрация, лингквистика, etc). | ||
|
||
По мере рефакторинга в этом компоненте останется только сам сайт. | ||
|
||
tt_diary | ||
~~~~~~~~ | ||
|
||
Сервис хранит последние сообщения в дневнике героя и управляет их количеством. | ||
|
||
tt_market | ||
~~~~~~~~~ | ||
|
||
Реализация рынка торговли предметами. | ||
|
||
**Не привязан к логике игры, может быть использован отдельно.** | ||
|
||
Функциональность: | ||
|
||
- выставление предмета на продажу; | ||
- возвращение предмета с продажи; | ||
- покупка предмета; | ||
- получение информации о выставленных предметах; | ||
- получение списка выставленных предметов конкретного типа. | ||
- логирование всех операций. | ||
|
||
tt_personal_messages | ||
~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Личные сообщения игроков. | ||
|
||
**Не привязан к логике игры, может быть использован отдельно.** | ||
|
||
Функциональность: | ||
|
||
- создание сообщений; | ||
- удаление сообщений; | ||
- получение списка сообщений (входящих/исходящих, по фильтру); | ||
- поиск сообщений; | ||
|
||
tt_storage | ||
~~~~~~~~~~ | ||
|
||
Предметы игрока. Используется для хранения карт судьбы. | ||
|
||
**Не привязан к логике игры, может быть использован отдельно.** | ||
|
||
Функциональность: | ||
|
||
- помещение предмета в хранилище; | ||
- удаление предмета из хранилища; | ||
- передача предмета другому игроку; | ||
- перемещение предмета между «карманами» хранилища; | ||
- логирование всех операций. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,216 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:java="http://www.yworks.com/xml/yfiles-common/1.0/java" xmlns:sys="http://www.yworks.com/xml/yfiles-common/markup/primitives/2.0" xmlns:x="http://www.yworks.com/xml/yfiles-common/markup/2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:y="http://www.yworks.com/xml/graphml" xmlns:yed="http://www.yworks.com/xml/yed/3" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://www.yworks.com/xml/schema/graphml/1.1/ygraphml.xsd"> | ||
<!--Created by yEd 3.17.1--> | ||
<key attr.name="Description" attr.type="string" for="graph" id="d0"/> | ||
<key for="port" id="d1" yfiles.type="portgraphics"/> | ||
<key for="port" id="d2" yfiles.type="portgeometry"/> | ||
<key for="port" id="d3" yfiles.type="portuserdata"/> | ||
<key attr.name="url" attr.type="string" for="node" id="d4"/> | ||
<key attr.name="description" attr.type="string" for="node" id="d5"/> | ||
<key for="node" id="d6" yfiles.type="nodegraphics"/> | ||
<key for="graphml" id="d7" yfiles.type="resources"/> | ||
<key attr.name="url" attr.type="string" for="edge" id="d8"/> | ||
<key attr.name="description" attr.type="string" for="edge" id="d9"/> | ||
<key for="edge" id="d10" yfiles.type="edgegraphics"/> | ||
<graph edgedefault="directed" id="G"> | ||
<data key="d0"/> | ||
<node id="n0"> | ||
<data key="d5"/> | ||
<data key="d6"> | ||
<y:ShapeNode> | ||
<y:Geometry height="30.0" width="71.0" x="472.0" y="179.0"/> | ||
<y:Fill color="#FFCC00" transparent="false"/> | ||
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/> | ||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="63.53125" x="3.734375" y="6.015625">game site<y:LabelModel> | ||
<y:SmartNodeLabelModel distance="4.0"/> | ||
</y:LabelModel> | ||
<y:ModelParameter> | ||
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/> | ||
</y:ModelParameter> | ||
</y:NodeLabel> | ||
<y:Shape type="rectangle"/> | ||
</y:ShapeNode> | ||
</data> | ||
</node> | ||
<node id="n1"> | ||
<data key="d5"/> | ||
<data key="d6"> | ||
<y:ShapeNode> | ||
<y:Geometry height="30.0" width="98.0" x="306.75" y="179.0"/> | ||
<y:Fill color="#FFCC00" transparent="false"/> | ||
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/> | ||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="62.904296875" x="17.5478515625" y="6.015625">public API<y:LabelModel> | ||
<y:SmartNodeLabelModel distance="4.0"/> | ||
</y:LabelModel> | ||
<y:ModelParameter> | ||
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/> | ||
</y:ModelParameter> | ||
</y:NodeLabel> | ||
<y:Shape type="rectangle"/> | ||
</y:ShapeNode> | ||
</data> | ||
</node> | ||
<node id="n2"> | ||
<data key="d5"/> | ||
<data key="d6"> | ||
<y:ShapeNode> | ||
<y:Geometry height="30.0" width="71.0" x="168.5" y="179.0"/> | ||
<y:Fill color="#FFCC00" transparent="false"/> | ||
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/> | ||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="67.087890625" x="1.9560546875" y="6.015625">admin site<y:LabelModel> | ||
<y:SmartNodeLabelModel distance="4.0"/> | ||
</y:LabelModel> | ||
<y:ModelParameter> | ||
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/> | ||
</y:ModelParameter> | ||
</y:NodeLabel> | ||
<y:Shape type="rectangle"/> | ||
</y:ShapeNode> | ||
</data> | ||
</node> | ||
<node id="n3" yfiles.foldertype="group"> | ||
<data key="d4"/> | ||
<data key="d5"/> | ||
<data key="d6"> | ||
<y:ProxyAutoBoundsNode> | ||
<y:Realizers active="0"> | ||
<y:GroupNode> | ||
<y:Geometry height="81.4609375" width="374.0" x="168.5" y="264.5390625"/> | ||
<y:Fill color="#F5F5F5" transparent="false"/> | ||
<y:BorderStyle color="#000000" type="dashed" width="1.0"/> | ||
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="374.0" x="0.0" y="0.0">backend services</y:NodeLabel> | ||
<y:Shape type="roundrectangle"/> | ||
<y:State closed="false" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/> | ||
<y:Insets bottom="15" bottomF="15.0" left="15" leftF="15.0" right="15" rightF="15.0" top="15" topF="15.0"/> | ||
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/> | ||
</y:GroupNode> | ||
<y:GroupNode> | ||
<y:Geometry height="50.0" width="50.0" x="0.0" y="60.0"/> | ||
<y:Fill color="#F5F5F5" transparent="false"/> | ||
<y:BorderStyle color="#000000" type="dashed" width="1.0"/> | ||
<y:NodeLabel alignment="right" autoSizePolicy="node_width" backgroundColor="#EBEBEB" borderDistance="0.0" fontFamily="Dialog" fontSize="15" fontStyle="plain" hasLineColor="false" height="21.4609375" horizontalTextPosition="center" iconTextGap="4" modelName="internal" modelPosition="t" textColor="#000000" verticalTextPosition="bottom" visible="true" width="65.201171875" x="-7.6005859375" y="0.0">Folder 1</y:NodeLabel> | ||
<y:Shape type="roundrectangle"/> | ||
<y:State closed="true" closedHeight="50.0" closedWidth="50.0" innerGraphDisplayEnabled="false"/> | ||
<y:Insets bottom="5" bottomF="5.0" left="5" leftF="5.0" right="5" rightF="5.0" top="5" topF="5.0"/> | ||
<y:BorderInsets bottom="0" bottomF="0.0" left="0" leftF="0.0" right="0" rightF="0.0" top="0" topF="0.0"/> | ||
</y:GroupNode> | ||
</y:Realizers> | ||
</y:ProxyAutoBoundsNode> | ||
</data> | ||
<graph edgedefault="directed" id="n3:"> | ||
<node id="n3::n0"> | ||
<data key="d5"/> | ||
<data key="d6"> | ||
<y:ShapeNode> | ||
<y:Geometry height="30.0" width="66.0" x="183.5" y="301.0"/> | ||
<y:Fill color="#FFCC00" transparent="false"/> | ||
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/> | ||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="58.43359375" x="3.783203125" y="6.015625">service 1<y:LabelModel> | ||
<y:SmartNodeLabelModel distance="4.0"/> | ||
</y:LabelModel> | ||
<y:ModelParameter> | ||
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/> | ||
</y:ModelParameter> | ||
</y:NodeLabel> | ||
<y:Shape type="rectangle"/> | ||
</y:ShapeNode> | ||
</data> | ||
</node> | ||
<node id="n3::n1"> | ||
<data key="d5"/> | ||
<data key="d6"> | ||
<y:ShapeNode> | ||
<y:Geometry height="30.0" width="66.0" x="322.5" y="301.0"/> | ||
<y:Fill color="#FFCC00" transparent="false"/> | ||
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/> | ||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="58.43359375" x="3.783203125" y="6.015625">service 2<y:LabelModel> | ||
<y:SmartNodeLabelModel distance="4.0"/> | ||
</y:LabelModel> | ||
<y:ModelParameter> | ||
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/> | ||
</y:ModelParameter> | ||
</y:NodeLabel> | ||
<y:Shape type="rectangle"/> | ||
</y:ShapeNode> | ||
</data> | ||
</node> | ||
<node id="n3::n2"> | ||
<data key="d5"/> | ||
<data key="d6"> | ||
<y:ShapeNode> | ||
<y:Geometry height="30.0" width="66.0" x="461.5" y="301.0"/> | ||
<y:Fill color="#FFCC00" transparent="false"/> | ||
<y:BorderStyle color="#000000" raised="false" type="line" width="1.0"/> | ||
<y:NodeLabel alignment="center" autoSizePolicy="content" fontFamily="Dialog" fontSize="12" fontStyle="plain" hasBackgroundColor="false" hasLineColor="false" height="17.96875" horizontalTextPosition="center" iconTextGap="4" modelName="custom" textColor="#000000" verticalTextPosition="bottom" visible="true" width="59.775390625" x="3.1123046875" y="6.015625">service N<y:LabelModel> | ||
<y:SmartNodeLabelModel distance="4.0"/> | ||
</y:LabelModel> | ||
<y:ModelParameter> | ||
<y:SmartNodeLabelModelParameter labelRatioX="0.0" labelRatioY="0.0" nodeRatioX="0.0" nodeRatioY="0.0" offsetX="0.0" offsetY="0.0" upX="0.0" upY="-1.0"/> | ||
</y:ModelParameter> | ||
</y:NodeLabel> | ||
<y:Shape type="rectangle"/> | ||
</y:ShapeNode> | ||
</data> | ||
</node> | ||
</graph> | ||
</node> | ||
<edge id="e0" source="n0" target="n1"> | ||
<data key="d9"/> | ||
<data key="d10"> | ||
<y:PolyLineEdge> | ||
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> | ||
<y:LineStyle color="#000000" type="line" width="1.0"/> | ||
<y:Arrows source="none" target="standard"/> | ||
<y:BendStyle smoothed="false"/> | ||
</y:PolyLineEdge> | ||
</data> | ||
</edge> | ||
<edge id="e1" source="n2" target="n1"> | ||
<data key="d9"/> | ||
<data key="d10"> | ||
<y:PolyLineEdge> | ||
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="0.0"/> | ||
<y:LineStyle color="#000000" type="line" width="1.0"/> | ||
<y:Arrows source="none" target="standard"/> | ||
<y:BendStyle smoothed="false"/> | ||
</y:PolyLineEdge> | ||
</data> | ||
</edge> | ||
<edge id="e2" source="n1" target="n3"> | ||
<data key="d9"/> | ||
<data key="d10"> | ||
<y:PolyLineEdge> | ||
<y:Path sx="0.0" sy="0.0" tx="0.0" ty="-40.77263259887695"/> | ||
<y:LineStyle color="#000000" type="line" width="1.0"/> | ||
<y:Arrows source="none" target="standard"/> | ||
<y:BendStyle smoothed="false"/> | ||
</y:PolyLineEdge> | ||
</data> | ||
</edge> | ||
<edge id="e3" source="n0" target="n3"> | ||
<data key="d9"/> | ||
<data key="d10"> | ||
<y:PolyLineEdge> | ||
<y:Path sx="0.0" sy="0.0" tx="152.0" ty="-40.73046875"/> | ||
<y:LineStyle color="#000000" type="line" width="1.0"/> | ||
<y:Arrows source="none" target="standard"/> | ||
<y:BendStyle smoothed="false"/> | ||
</y:PolyLineEdge> | ||
</data> | ||
</edge> | ||
<edge id="e4" source="n2" target="n3"> | ||
<data key="d9"/> | ||
<data key="d10"> | ||
<y:PolyLineEdge> | ||
<y:Path sx="0.0" sy="0.0" tx="-151.5" ty="-40.71484375"/> | ||
<y:LineStyle color="#000000" type="line" width="1.0"/> | ||
<y:Arrows source="none" target="standard"/> | ||
<y:BendStyle smoothed="false"/> | ||
</y:PolyLineEdge> | ||
</data> | ||
</edge> | ||
</graph> | ||
<data key="d7"> | ||
<y:Resources/> | ||
</data> | ||
</graphml> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,5 @@ | |
development_process | ||
child_projects | ||
directions_of_development | ||
architecture | ||
guides/index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters