{"id":336179,"date":"2022-07-25T21:00:20","date_gmt":"2022-07-25T21:00:20","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=336179"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=336179","title":{"rendered":"<span>\u042d\u0432\u043e\u043b\u044e\u0446\u0438\u044f \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430 \u043d\u0430 Python. \u0427\u0430\u0441\u0442\u044c 2 \u0438\u0437 2. \u0421\u043b\u043e\u0438 \u043b\u043e\u0433\u0438\u043a\u0438<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/post\/678658\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437<\/a> \u043c\u044b \u043e\u0442\u0434\u0435\u043b\u0438\u043b\u0438 \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u0440\u0430\u0437\u0431\u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u043b\u043e\u044f: Server \u2192 Parser \u2192 Application \u2192 Repository. \u041a\u043b\u0430\u0441\u0441\u044b \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u0432\u0441\u044e \u0440\u0443\u0442\u0438\u043d\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0430 \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u0433\u0438\u043a\u0443.<\/p>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u044f\u0442\u044b\u0439 \u0438 \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u043b\u043e\u0439. \u041e\u043d\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b (\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435), \u043d\u043e \u0438 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u2014 \u044d\u0442\u043e, \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u043e\u0431\u0449\u0438\u0442\u044c, \u0442\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0434\u043d\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441 \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (Repository). \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <code>Application<\/code> \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0435\u043c\u0443 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 <code>Repository<\/code>. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043f\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e. \u0412 \u043e\u0431\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0438\u0436\u043a\u043e\u043c \u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c: <\/p>\n<blockquote>\n<p>&#8230; \u2192 Application \u2192 Controller \u2192 Repository.<\/p>\n<\/blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u0442\u043e \u044d\u0442\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043b\u0430\u0441\u0441. \u0411\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u2014 \u044d\u0442\u043e \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0430 \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u2014 \u044d\u0442\u043e \u043c\u0435\u0448\u0430\u043d\u0438\u043d\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u0431\u044b \u0432 \u043d\u0435\u0439 \u043d\u0435 \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f, \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b. \u041e\u0434\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441. \u041a\u043b\u0430\u0441\u0441\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435 \u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430, \u0431\u0443\u0434\u0443\u0442 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u043b\u043e\u0438, \u043a\u0430\u043a \u0438 \u0432 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435.<\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0436\u0430\u043d\u0440\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0441 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f \u0436\u0430\u043d\u0440\u043e\u0432. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435, \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e, \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u044d\u0442\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0441\u0443\u0433\u0443\u0431\u043e &#171;\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435&#187;. \u041e\u0431\u0449\u0430\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u043a\u0430\u043a \u0438 \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/677854\/\" rel=\"noopener noreferrer nofollow\">\u043a\u043b\u0438\u0435\u043d\u0442\u0435<\/a> (\u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0431\u0435\u0440\u0443\u0442 \u0437\u0430 \u0441\u0432\u043e\u044e \u043e\u0441\u043d\u043e\u0432\u0443 \u0432\u044b\u0448\u0435\u043b\u0435\u0436\u0430\u0449\u0438\u0435):<\/p>\n<ol>\n<li>\n<p>Core Framework<\/p>\n<\/li>\n<li>\n<p>Base Game Frameworks (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0437 Core Framework)<\/p>\n<\/li>\n<li>\n<p>Game Frameworks (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0437 Core \u0438 Base Game Frameworks)<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u0433\u0440\u044b \u2014 \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438\u0437 \u0436\u0430\u043d\u0440\u043e\u0432\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0442\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e main-\u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0432 \u043f\u0430\u0440\u0443 \u0441\u0442\u0440\u043e\u043a \u0438 yml-\u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>\u041e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043b \u0432\u0441\u0435\u0433\u043e \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a, \u043a\u0430\u043a \u0440\u0430\u0437 \u0438 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435:<\/p>\n<ol>\n<li>\n<p><a href=\"#section1\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#section2\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#section3\" rel=\"noopener noreferrer nofollow\">\u0418\u0437\u043c\u0435\u043d\u0438\u0432\u0448\u0430\u044f\u0441\u044f \u0440\u043e\u043b\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#section4\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#section5\" rel=\"noopener noreferrer nofollow\">\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0438 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#section6\" rel=\"noopener noreferrer nofollow\">\u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a DDD-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435<\/a><\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"section1\" id=\"section1\"><\/a><\/p>\n<h2>\u041e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/h2>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u044b \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0442\u0440\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b: get, set, update, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u043e\u0441\u044c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0431\u044b\u043b\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043b\u0438\u0448\u044c \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0438 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0431\u0440\u0430\u0442\u044c \u0435\u0433\u043e \u043e\u0442\u0442\u0443\u0434\u0430.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0442\u0443 \u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0443, \u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043d\u0435 \u0432 \u0411\u0414, \u0430 \u0432 \u0444\u0430\u0439\u043b\u0435:<\/p>\n<pre><code class=\"python\">class MyController:     async def handle_command(self, storage, index, command, result):         key = command.get(\"key\")         key = escape(key)  # Never trust data from users         filename = \"..\/data\/save_\" + key         dirname = os.path.dirname(filename)         if not os.path.exists(dirname):             os.makedirs(dirname)         code = command.get(\"code\")         all_indexes = storage.get(\"indexes\")         if code == \"save\" or code == \"set\":             state = command.get(\"state\")             with open(filename, \"w\") as f:                 json.dump(state, f)                 f.flush()             result.append((all_indexes, [{**command, \"success\": True}]))         elif code == \"load\" or code == \"get\":             if not os.path.exists(filename):                 return {\"success\": False, **command}, None             with open(filename, \"r\") as f:                 state = json.load(f)             result.append(([index], [{**command, \"success\": True, \"state\": state}]))         elif code == \"update\":             index = command.get(\"index\")             value = command.get(\"value\")             if not isinstance(index, int) or not isinstance(value, int):                 result.append(([index], [{**command, \"success\": False}]))                 return             if not os.path.exists(filename):                 state = []             else:                 with open(filename, \"r\") as f:                     state = json.load(f)             if index >= len(state):                 state += [0] * (index - len(state) + 1)             state[index] = value             with open(filename, \"w\") as f:                 json.dump(state, f)                 f.flush()             result.append((all_indexes, [{**command, \"success\": success}]))  def escape(string):     return re.sub(r\"[^A-Za-z]+\", \"\", string)<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u044b \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u2014 \u043c\u0435\u0448\u0430\u043d\u0438\u043d\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u0447\u043b\u0435\u043d\u0438\u043c \u043e\u0442\u0441\u044e\u0434\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043f\u043e \u043d\u0435\u043a\u043e\u0435\u043c\u0443 \u043e\u0431\u0449\u0435\u043c\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0443 \u0438 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441. \u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u0430\u044f \u0438 \u0447\u0438\u0441\u0442\u043e \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438, \u0442\u043e \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0441\u043b\u0443\u0436\u0431\u0430\u043c\u0438 (Service), \u0430 \u043d\u0430\u0448\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u2014 <code>FileService<\/code>.<\/p>\n<pre><code class=\"python\">class StorageService:     def save(self, key, data):         pass      def load(self, key):         return None  class FileService(StorageService):     filename_prefix = \"\"      def __init__(self, filename_prefix=None):         self.filename_prefix = filename_prefix or self.filename_prefix      def save(self, key, data):         key = escape(key)  # Never trust data from users         filename = self.filename_prefix + key         dirname = os.path.dirname(filename)         if dirname and not os.path.exists(dirname):             os.makedirs(dirname)         with open(filename, \"w\") as f:             json.dump(data, f)             f.flush()             print(\"save\", data)      def load(self, key):         key = escape(key)  # Never trust data from users         filename = self.filename_prefix + key         if not os.path.exists(filename):             return None         with open(filename, \"r\") as f:             data = json.load(f)             print(\"load\", data)             return data  class MyController:     # Settings     service_factory = lambda self: FileService(\"..\/data\/save_\")     model_factory = lambda self, *args: MyModel(*args)      def __init__(self):         self.service = self.service_factory()         self.model = self.model_factory(self.service)      async def handle_command(self, storage, index, command, result):         code = command.get(\"code\")         key = command.get(\"key\")         all_indexes = storage.get(\"indexes\")         if code == \"save\" or code == \"set\":             state = command.get(\"state\")             success = self.service.save(key, state)             result.append((all_indexes, [{**command, \"success\": success}]))         elif code == \"load\" or code == \"get\":             state = self.service.load(key)             result.append(([index], [{**command, \"success\": True, \"state\": state}]))         elif code == \"update\":             index = command.get(\"index\")             value = command.get(\"value\")             state = self.service.load(key)             if not isinstance(index, int) or not isinstance(value, int):                 success = False             else:                 if state is None:                     state = []                 if index >= len(state):                     state += [0] * (index - len(state) + 1)                 state[index] = value                 success = True             self.service.save(key, state)             result.append((all_indexes, [{**command, \"success\": success}]))<\/code><\/pre>\n<p>\u0422\u043e\u043b\u044c\u043a\u043e \u0432\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 <code>handle_command()<\/code> \u2014 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0440\u0430\u0437\u0443 \u0441\u0442\u0430\u043b\u043e \u043b\u0435\u0433\u0447\u0435 \u0434\u044b\u0448\u0430\u0442\u044c! \u041d\u043e \u0432\u044b\u0433\u043e\u0434\u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u043e\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0435\u0441\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0441\u043e\u0431\u0440\u0430\u043d \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u0410 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043d\u0430\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u044b\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u043a\u043e\u0434\u0443, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u0438\u043b\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0441 JSON \u043d\u0430 YML, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0442\u043e\u0442 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043d\u043e \u0443\u0436\u0435 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432 \u0444\u0430\u0439\u043b, \u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0435\u0440\u0435\u0437 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441) \u0438\u043b\u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0438\u0445 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0411\u0414). \u0412\u0435\u0434\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e, \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0441\u0432\u043e\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u2014 \u043e\u043d \u043b\u0438\u0448\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b <code>load()<\/code> \u0438 <code>save()<\/code>. \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u043a\u0438 (\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430), \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u043d\u043e <em>\u0432 \u0444\u0430\u0439\u043b<\/em>. \u041d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e <em>\u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c<\/em> \u0434\u0430\u043d\u043d\u044b\u0435. \u0418 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e <em>\u0438\u0437 \u0444\u0430\u0439\u043b\u0430<\/em>. \u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u044b, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u043d\u0443\u0436\u043d\u043e <em>\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c<\/em> \u2014 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043e\u0442\u043a\u0443\u0434\u0430.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0435\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>StorageService<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437-\u0437\u0430 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A3%D1%82%D0%B8%D0%BD%D0%B0%D1%8F_%D1%82%D0%B8%D0%BF%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F\" rel=\"noopener noreferrer nofollow\">&#171;\u0443\u0442\u0438\u043d\u043e\u0439&#187; \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438<\/a> Python \u043d\u043e\u0441\u0438\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443, \u0447\u0435\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u0443. \u0423\u0442\u0438\u043d\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0438 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u043a\u043e\u0434\u0435, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0432 \u042f\u041f \u0441\u043e \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u0431\u044b \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043a\u0430 \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0438\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0443\u0441\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 <code>StorageService<\/code> \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0442\u0438\u043f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0442 \u0437\u0430\u0434\u0430\u0447\u0438, \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0441\u0432\u043e\u0435 \u043e\u0441\u043e\u0431\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p><a class=\"anchor\" name=\"section2\" id=\"section2\"><\/a><\/p>\n<h2>\u041e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u2014 \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0438\u0437 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438.<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u043e\u0434\u0435\u043b\u0438? \u0412\u0441\u044f\u043a\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0442\u0443 \u0438\u043b\u0438 \u0438\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0438\u0437 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u0432\u043e \u0432\u0441\u0435\u0439 \u0435\u0435 \u043f\u043e\u043b\u043d\u043e\u0442\u0435. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0435\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u0440\u0435\u0448\u0438\u0442\u044c \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u0443\u044e \u0437\u0430\u0434\u0430\u0447\u0443. \u042d\u0442\u0438 \u0433\u0440\u0430\u043d\u0438 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0444\u043e\u0440\u043c\u0430\u043b\u0438\u0437\u0443\u044e\u0442\u0441\u044f, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0443\u044e\u0442\u0441\u044f, \u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043d\u0430 \u0438\u0445 \u043e\u0441\u043d\u043e\u0432\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c. \u041c\u043e\u0434\u0435\u043b\u044c, \u0432 \u0443\u0437\u043a\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 \u2014 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u0445\u043e\u0434\u044f\u0442 \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0438, \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u044d\u0442\u0438\u0445 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412 \u0448\u0438\u0440\u043e\u043a\u043e\u043c \u0441\u043c\u044b\u0441\u043b\u0435 \u043c\u043e\u0434\u0435\u043b\u044c \u2014 \u044d\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u0432\u0441\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435.<\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0441\u0430\u043c\u043e \u043d\u0430\u043b\u0438\u0447\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0435\u0449\u0435 \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043f\u0435\u0440\u0435\u0434 \u043d\u0430\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u044c. \u041e\u0431\u044a\u0435\u043a\u0442 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 (<code>storage<\/code>) \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u0440\u0430\u043d\u0438\u0442 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435, \u0438 \u043e\u043d \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u044b\u0445 \u043e\u0431\u043b\u0430\u0441\u0442\u0435\u0439. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435 \u043d\u0435 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u0445\u043e\u0442\u044f \u0434\u0430\u043d\u043d\u044b\u0435 \u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f \u043a \u043c\u043e\u0434\u0435\u043b\u0438, \u0438 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0432 \u043d\u0435\u043c.<\/p>\n<p>\u0414\u0430\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u2014 \u044d\u0442\u043e \u043e\u0431\u044b\u0447\u043d\u044b\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u044b (\u0441\u043b\u043e\u0432\u0430\u0440\u0438 \u0438 \u0441\u043f\u0438\u0441\u043a\u0438), \u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043e\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u043e\u0441\u0442\u044c \u043e\u043d\u0438 \u043e\u0431\u0440\u0435\u0442\u0430\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0441\u0442\u0430\u043d\u043e\u0432\u044f\u0442\u0441\u044f \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u043e\u0434\u0435\u043b\u0438. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0432 \u044d\u0442\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445 \u0432\u043e\u043f\u043b\u043e\u0449\u0435\u043d\u044b \u043e\u0431\u0430 \u0430\u0441\u043f\u0435\u043a\u0442\u0430 \u043c\u043e\u0434\u0435\u043b\u0438: \u0438 \u0434\u0430\u043d\u043d\u044b\u0435 (\u0442\u043e\u0447\u043d\u0435\u0435, \u0438\u0445 \u0444\u043e\u0440\u043c\u0430\u0442: \u0438\u043c\u0435\u043d\u0430 \u0438 \u0442\u0438\u043f\u044b), \u0438 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445. \u0412\u043e\u0442 \u043f\u043e\u0447\u0435\u043c\u0443 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 (Model) \u043c\u044b \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u0430 \u043d\u0435 \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u0445 \u0445\u0440\u0430\u043d\u044f\u0442.<\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0435 \u043c\u043d\u043e\u0433\u043e \u2014 \u0445\u0432\u0430\u0442\u0438\u043b\u043e \u043b\u0438\u0448\u044c \u043d\u0430 \u043e\u0434\u0438\u043d \u043c\u0435\u0442\u043e\u0434. \u041d\u043e \u0434\u043b\u044f \u0438\u043b\u043b\u044e\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0430 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0438 \u044d\u0442\u043e\u0433\u043e:<\/p>\n<pre><code class=\"python\">class MyModel:     def update(self, state, index, value):         if not isinstance(index, int) or not isinstance(value, int):             return False         if state is None:             state = []         if index >= len(state):             state += [0] * (index - len(state) + 1)         state[index] = value         return True  class MyController:     # Settings     service_factory = lambda self: FileService(\"..\/data\/save_\")     model_factory = lambda self, *args: MyModel(*args)      def __init__(self):         self.service = self.service_factory()         self.model = self.model_factory(self.service)      async def handle_command(self, storage, index, command, result):         code = command.get(\"code\")         key = command.get(\"key\")         if code == \"save\" or code == \"set\":             state = command.get(\"state\")             success = self.service.save(key, state)             result.append((all_indexes, [{**command, \"success\": success}]))         elif code == \"load\" or code == \"get\":             state = self.service.load(key)             result.append(([index], [{**command, \"success\": True, \"state\": state}]))         elif code == \"update\":             index = command.get(\"index\")             value = command.get(\"value\")             state = self.service.load(key)             success = self.model.update(state, index, value)             self.service.save(key, state)             result.append((all_indexes, [{**command, \"success\": success}]))<\/code><\/pre>\n<p>\u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u0438 \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u043f\u0440\u0435\u0438\u043c\u0443\u0449\u0435\u0441\u0442\u0432\u0430, \u0447\u0442\u043e \u043c\u044b \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u043b\u0438 \u0438 \u0440\u0430\u043d\u044c\u0448\u0435:<\/p>\n<ul>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0438 \u0442\u043e\u0433\u043e \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441\u0430 \u0438 \u0442\u0435\u043c \u043c\u0435\u043d\u044f\u0442\u044c \u0434\u0435\u0442\u0430\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430, \u043d\u0435 \u043c\u0435\u043d\u044f\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u043a\u043e\u0434\u0430 (\u043f\u0430\u0442\u0442\u0435\u0440\u043d <a href=\"https:\/\/en.wikipedia.org\/wiki\/Strategy_pattern\" rel=\"noopener noreferrer nofollow\">\u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u044f<\/a>),<\/p>\n<\/li>\n<li>\n<p>\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0439 \u043a\u043e\u0434, \u043f\u0435\u0440\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0435 \u0447\u0430\u0441\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 (\u043f\u0430\u0442\u0442\u0435\u0440\u043d <a href=\"https:\/\/en.wikipedia.org\/wiki\/Template_method_pattern\" rel=\"noopener noreferrer nofollow\">\u0448\u0430\u0431\u043b\u043e\u043d\u043d\u044b\u0439 \u043c\u0435\u0442\u043e\u0434<\/a>).<\/p>\n<\/li>\n<\/ul>\n<p><a class=\"anchor\" name=\"section3\" id=\"section3\"><\/a><\/p>\n<h2>\u0418\u0437\u043c\u0435\u043d\u0438\u0432\u0448\u0430\u044f\u0441\u044f \u0440\u043e\u043b\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430<\/h2>\n<p>\u0415\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435 \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0432\u0448\u0438\u0439\u0441\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u0447\u0442\u043e \u0432 \u043d\u0435\u043c \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u043b\u043e\u0433\u0438\u043a\u0438 \u0432 \u0447\u0438\u0441\u0442\u043e\u043c \u0432\u0438\u0434\u0435 \u2014 \u043e\u0434\u043d\u0438 \u0432\u044b\u0437\u043e\u0432\u044b \u043c\u0435\u0442\u043e\u0434\u043e\u0432. \u0412\u0441\u0435 \u0441\u0432\u043e\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0434\u0435\u043b\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043b \u0434\u0432\u0443\u043c \u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f\u043c \u043a\u043b\u0430\u0441\u0441\u043e\u0432: \u043c\u043e\u0434\u0435\u043b\u044f\u043c \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c. \u0421\u0435\u0431\u0435 \u0436\u0435 \u043e\u043d \u043e\u0441\u0442\u0430\u0432\u0438\u043b \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0430 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c (storage), \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438 (model) \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 (service). \u0414\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0430 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434 (command).<\/p>\n<p>\u0412\u0441\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u044b \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0448\u0430\u0431\u043b\u043e\u043d\u0443. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0441\u043c\u043e\u0442\u0440\u0438\u0442 \u043d\u0430 \u0438\u043c\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442 \u043a \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u043c\u0443 \u0431\u043b\u043e\u043a\u0443 \u043a\u043e\u0434\u0430 \u0434\u043b\u044f \u0435\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438. \u0414\u0430\u043b\u0435\u0435 \u0438\u0437 \u043e\u0431\u044a\u0435\u043a\u0442\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043e\u0441\u0442\u0430\u044e\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435, \u0430 \u0438\u0437 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0431\u0435\u0440\u0443\u0442\u0441\u044f \u043d\u0443\u0436\u043d\u044b\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u0417\u0430\u0442\u0435\u043c \u0432\u0441\u0435 \u0432\u043c\u0435\u0441\u0442\u0435 \u043e\u043d\u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u044e\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u0434\u0435\u043b\u044f\u043c \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0441 \u0442\u0435\u043c\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430\u043c\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0438\u043c \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b. \u0412\u0441\u0451 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442\u0441\u044f \u0432 \u043c\u043e\u0434\u0435\u043b\u044c \u0438\u043b\u0438 \u0441\u0435\u0440\u0432\u0438\u0441, \u0447\u0442\u043e\u0431\u044b \u043e\u043d\u0438 \u0441\u0430\u043c\u0438 \u0432\u044b\u0431\u0440\u0430\u043b\u0438, \u0447\u0442\u043e \u0438\u043c \u043d\u0443\u0436\u043d\u043e. \u042d\u0442\u043e \u043d\u0435 \u0438\u0445 \u0434\u0435\u043b\u043e \u2014 \u043d\u0438 \u043c\u043e\u0434\u0435\u043b\u044c, \u043d\u0438 \u0441\u0435\u0440\u0432\u0438\u0441 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0437\u043d\u0430\u0442\u044c \u043e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f. \u041e\u0431 \u044d\u0442\u043e\u043c \u043f\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043e\u043b\u0436\u0435\u043d \u0437\u043d\u0430\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u043e\u0440\u0434\u0438\u043d\u0430\u0446\u0438\u0435\u0439 \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b \u043c\u043e\u0434\u0435\u043b\u0435\u0439 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043d\u043e \u0438 \u0432\u0441\u0435\u0439 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u043e\u0439 \u0438 \u043f\u043e\u0434\u0431\u043e\u0440\u043e\u043c \u0434\u0430\u043d\u043d\u044b\u0445 \u0434\u043b\u044f \u043d\u0438\u0445.<\/p>\n<p><a class=\"anchor\" name=\"section4\" id=\"section4\"><\/a><\/p>\n<h2>\u041e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/h2>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u043e\u043d \u0435\u0449\u0435 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0437\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u0432 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043a\u0443 \u043e\u0442\u0432\u0435\u0442\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c. \u0422\u0435\u043c \u0441\u0430\u043c\u044b\u043c \u043d\u0430 \u0435\u0433\u043e \u0434\u043e\u043b\u044e \u0432\u044b\u043f\u0430\u0434\u0430\u0435\u0442 \u0432\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u043c\u0438. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u2014 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439, \u043a\u0442\u043e \u0437\u043d\u0430\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 \u043a\u043e\u043c\u0430\u043d\u0434.<\/p>\n<p>\u0421\u0435\u0440\u0432\u0435\u0440 \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u043e\u043a\u043e\u043c \u0431\u0430\u0439\u0442\u043e\u0432, \u043f\u0430\u0440\u0441\u0435\u0440 \u2014 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442 \u0435\u0433\u043e \u0432 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0442\u043d\u044b\u0435 JSON-\u043e\u0431\u044a\u0435\u043a\u0442\u044b \u0438 \u043e\u0431\u0440\u0430\u0442\u043d\u043e, Application \u0437\u043d\u0430\u0435\u0442 \u0440\u043e\u0432\u043d\u043e \u0441\u0442\u043e\u043b\u044c\u043a\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440. \u041d\u043e \u0442\u0438\u043f \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u0443\u044e \u043e\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442, \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u044d\u0442\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0438 \u0438\u0445 \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2014 \u0432\u0441\u0435 \u044d\u0442\u043e \u0438\u0437\u0432\u0435\u0441\u0442\u043d\u043e \u043b\u0438\u0448\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443. \u041c\u043e\u0434\u0435\u043b\u0438 \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442 \u0438\u0445 \u0443\u0436\u0435 \u0432 \u0432\u0438\u0434\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 \u0441\u0432\u043e\u0438\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u2014 \u043e\u043d\u0438 \u0442\u043e\u0436\u0435 \u043d\u0435 \u0437\u043d\u0430\u044e\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445.<\/p>\n<p>\u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0435\u0449\u0435 \u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0422\u043e \u0435\u0441\u0442\u044c \u0442\u043e\u0442 \u0444\u043e\u0440\u043c\u0430\u0442 \u043a\u043e\u043c\u0430\u043d\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0441\u0435\u0440\u0432\u0435\u0440\u043e\u043c \u0438 \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u0430\u0440\u0441\u0435\u0440. \u041a\u043b\u0438\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 XML, JSON \u0438\u043b\u0438 YML, \u043d\u043e \u043f\u0430\u0440\u0441\u0435\u0440 \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u043f\u0438\u0442\u043e\u043d\u043e\u0432\u0441\u043a\u0438\u0435 \u043e\u0431\u044a\u0435\u043a\u0442\u044b: <code>dict<\/code> \u0438 <code>list<\/code>, \u043a\u0430\u043a \u043f\u043e\u0441\u043b\u0435 \u043e\u0431\u044b\u043a\u043d\u043e\u0432\u0435\u043d\u043d\u043e\u0433\u043e JSON. \u041a\u043b\u0438\u0435\u043d\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0430\u0437\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u0430 \u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432, \u0440\u0430\u0437\u043d\u044b\u0435 \u043a\u043e\u0434\u044b \u043a\u043e\u043c\u0430\u043d\u0434, \u043d\u043e \u043f\u0430\u0440\u0441\u0435\u0440 \u0434\u043e\u043b\u0436\u0435\u043d \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c \u0442\u0435 \u0438\u043c\u0435\u043d\u0430, \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u043a\u043e\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u044b \u0443 \u043d\u0430\u0441 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043d\u0438\u043c\u0430\u044e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b. \u042d\u0442\u043e \u0442\u043e, \u0447\u0442\u043e \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u043e\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0418 \u043e\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0438\u0433\u0434\u0435 \u0431\u043e\u043b\u044c\u0448\u0435, \u043a\u0440\u043e\u043c\u0435 \u043a\u0430\u043a \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445.<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442 \u0441\u0440\u0430\u0437\u0443 \u0434\u0432\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438: \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0430. \u0410 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0441\u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043b\u043e\u0441\u044c \u0442\u0430\u043a\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e: \u0435\u0441\u043b\u0438 \u0432 \u043a\u043b\u0430\u0441\u0441\u0435 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0434\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430, \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u0438\u0437 \u043d\u0438\u0445 \u0434\u0432\u0430 \u043a\u043b\u0430\u0441\u0441\u0430. \u0418\u043b\u0438, \u0434\u0440\u0443\u0433\u0438\u043c\u0438 \u0441\u043b\u043e\u0432\u0430\u043c\u0438: <s>ein Reich \u2014 ein F\u00fc&#8230;<\/s> \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441 \u2014 \u043e\u0434\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f, \u043e\u0434\u043d\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435.<\/p>\n<p>\u0423\u0441\u0442\u0440\u0430\u043d\u0438\u043c \u044d\u0442\u043e\u0442 \u043d\u0435\u0434\u043e\u0441\u0442\u0430\u0442\u043e\u043a. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e:<\/p>\n<ol>\n<li>\n<p>\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0442\u0432\u0435\u0447\u0430\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0437\u0430 \u0440\u0430\u0437\u0431\u043e\u0440 \u043a\u043e\u043c\u0430\u043d\u0434, \u0438<\/p>\n<\/li>\n<li>\n<p>\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0441 \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438, \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438 \u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0438 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044c\u043d\u043e\u0433\u043e.<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u0438 \u044d\u0442\u043e\u043c \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u2014 \u0435\u0433\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439:<\/p>\n<pre><code class=\"python\">class MyProtocolController:     async def handle_command(self, storage, index, command, result):         code = command.get(\"code\")         key = command.get(\"key\")         all_indexes = storage.get(\"indexes\")         if code == \"save\" or code == \"set\":             state = command.get(\"state\")             success = self.save(key, state)             result.append((all_indexes, [{**command, \"success\": success}]))         elif code == \"load\" or code == \"get\":             state = self.load(key)             result.append(([index], [{**command, \"success\": True, \"state\": state}]))         elif code == \"update\":             index = command.get(\"index\")             value = command.get(\"value\")             self.update(key, index, value, all_indexes, command, result)      def save(self, key, state):         pass      def load(self, key):         pass      def update(self, key, index, value, all_indexes, command, result):         pass  class MyController(MyProtocolController):     # Settings     service_factory = lambda self: FileService(\"..\/data\/save_\")     model_factory = lambda self, *args: MyModel(*args)      def __init__(self):         self.service = self.service_factory()         self.model = self.model_factory(self.service)      def save(self, key, state):         success = self.service.save(key, state)         return success      def load(self, key):         state = self.service.load(key)         return state      def update(self, key, index, value, all_indexes, command, result):         state = await self.service.load(key)         success = self.model.update(state, index, value)         if success:             success = self.service.save(key, state)         result.append((all_indexes, [{**command, \"success\": success}]))<\/code><\/pre>\n<p>\u0412 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445 \u0434\u043e\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e\u0431\u044b \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f \u043e \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445 \u043f\u0440\u043e\u043d\u0438\u043a\u0430\u043b\u0430 \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430. \u042d\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u043d\u0443\u0436\u043d\u043e \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0435\u0441\u043b\u0438 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u0432\u0435\u0442\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434, \u043a\u0430\u0436\u0434\u0443\u044e \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043d\u0443\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u044b\u043b\u0430\u0442\u044c \u043e\u0441\u043e\u0431\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0430\u0442\u0443. \u0418 \u0445\u043e\u0442\u044c \u0443 \u043d\u0430\u0441 \u043f\u043e\u043a\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0434\u0430\u043b\u0435\u043a\u043e \u043d\u0435 \u0442\u0430\u043a\u043e\u0439, \u043d\u043e \u043c\u044b \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u043e\u0434\u043d\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0432 \u044d\u0442\u043e\u043c \u043a\u043b\u044e\u0447\u0435 (<code>update()<\/code>).<\/p>\n<p>\u0417\u0430\u043c\u0435\u0442\u0438\u043c, \u0447\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u0437\u043d\u0430\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u043d\u0430 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430 (\u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0441\u0435\u0442\u0435\u0432\u043e\u0439 \u043a\u0430\u0440\u0442\u0435, \u0436\u0435\u0441\u0442\u043a\u0438\u043c \u0434\u0438\u0441\u043a\u0430\u043c \u0438 \u0442.\u0434.). \u0427\u0442\u043e\u0431\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u043d\u0435 \u043e\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b\u043e\u0441\u044c, \u0432\u0441\u0435 \u043c\u0435\u0442\u043e\u0434\u044b \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c <a href=\"https:\/\/habr.com\/ru\/post\/676144\/\" rel=\"noopener noreferrer nofollow\">\u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u043c\u0438<\/a>. \u041f\u0440\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u0434 \u0432\u0441\u0435\u043c\u0438 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u0441\u043b\u043e\u0432\u0430 <code>async<\/code>, \u0430 \u043f\u0435\u0440\u0435\u0434 \u043a\u0430\u0436\u0434\u044b\u043c \u0432\u044b\u0437\u043e\u0432\u043e\u043c \u2014 <code>await<\/code> \u043e\u0441\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0440\u0430\u0431\u043e\u0442\u044b.<\/p>\n<p><a class=\"anchor\" name=\"section5\" id=\"section5\"><\/a><\/p>\n<h2>\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0438 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/h2>\n<p>\u0416\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u0439 \u0446\u0438\u043a\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u043e\u0441\u0442\u043e\u0439: \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0442\u0441\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043e\u043d\u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f, \u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0442\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u043d\u0430\u0437\u0430\u0434. \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043d\u0435 \u0431\u044b\u043b\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0430, \u0442\u043e \u043d\u0435\u0447\u0435\u0433\u043e \u0438 \u043e\u0442\u0441\u044b\u043b\u0430\u0442\u044c. \u042f\u0441\u043d\u043e, \u0447\u0442\u043e \u0434\u043b\u044f \u0441\u0435\u0440\u044c\u0435\u0437\u043d\u044b\u0445 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u044d\u0442\u043e\u0433\u043e \u043c\u0430\u043b\u043e. \u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0433\u0440\u0435 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0439 \u0446\u0438\u043a\u043b \u0440\u0430\u0431\u043e\u0442\u044b \u0438\u043b\u0438 \u0445\u043e\u0442\u044f \u0431\u044b \u0442\u0430\u0439\u043c\u0435\u0440, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0438\u0433\u0440\u0430 \u0441\u0430\u043c\u0430 \u043c\u043e\u0433\u043b\u0430 \u0431\u044b \u0432 \u043d\u0443\u0436\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043f\u043e\u0441\u044b\u043b\u0430\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u044b. \u041f\u043e \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0447\u0438\u043d\u0443, \u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e \u0437\u0430\u043f\u0440\u043e\u0441\u0443 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f, \u043a\u0430\u043a \u0441\u0435\u0439\u0447\u0430\u0441. \u0414\u043e\u043b\u0436\u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044e \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043d\u0438\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u043e\u0431\u044b\u0442\u0438\u044f.<\/p>\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u0432\u0441\u0435 \u0441\u043e\u0431\u044b\u0442\u0438\u044f \u0443 \u043d\u0430\u0441 \u2014 \u044d\u0442\u043e \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0442\u043e \u0438 \u0434\u043b\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0433\u043e \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043d\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430 \u043e\u0442\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043e\u0442 \u043e\u0431\u0449\u0435\u0439 \u043a\u0430\u043d\u0432\u044b. \u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043e\u0447\u0435\u043d\u044c \u0434\u0430\u0436\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0442. \u0410 \u0440\u0430\u0437 \u043e\u043d\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0442\u043e\u0441\u043b\u0430\u043d\u044b \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c, \u0442\u043e \u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u044b \u0438\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u044b. \u0412\u043c\u0435\u0441\u0442\u043e \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u0432 \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <code>None<\/code>. \u041f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0441 \u0438\u043d\u0434\u0435\u043a\u0441\u043e\u043c <code>None<\/code> \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c <strong>\u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u043c\u0438<\/strong>. \u0410 \u0442\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0442\u0441\u044b\u043b\u0430\u044e\u0442\u0441\u044f \u043a\u043b\u0438\u0435\u043d\u0442\u0430\u043c \u0438\u043b\u0438 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u043e\u0442 \u043d\u0438\u0445, \u0442\u043e \u0435\u0441\u0442\u044c \u0430\u0441\u0441\u043e\u0446\u0438\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u0438\u043d\u0434\u0435\u043a\u0441\u0430\u043c\u0438 \u0441\u043e\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0439 \u2014 <strong>\u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438<\/strong>.<\/p>\n<p>\u0411\u044b\u0432\u0430\u044e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u043d\u0435 \u0441\u0440\u0430\u0437\u0443, \u0430 \u0447\u0435\u0440\u0435\u0437 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432 \u043f\u043e\u043b\u0435 <code>after_ms<\/code>. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0430 \u0445\u043e\u0434\u0430 \u043a \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0438\u0433\u0440\u043e\u043a\u0443 \u043c\u043e\u0436\u043d\u043e \u0432 \u043e\u0431\u044a\u0435\u043a\u0442\u0435 \u0438\u0433\u0440\u044b \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0440\u0435\u043c\u044f \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0445\u043e\u0434\u0430 \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <code>\"try_end_turn\"<\/code> c \u043f\u043e\u043b\u0435\u043c <code>after_ms<\/code>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0447\u0435\u0440\u0435\u0437 \u0437\u0430\u0434\u0430\u043d\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0432\u0430\u043b \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0441\u0440\u0430\u0432\u043d\u0438\u0442 \u0441 \u0442\u0435\u043a\u0443\u0449\u0438\u043c. (\u041c\u044b \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u0440\u0430\u0437\u0443 <code>\"end_turn\"<\/code> \u2014 \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043f\u043e\u043a\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u043e\u0436\u0438\u0434\u0430\u0442\u044c \u0441\u0432\u043e\u0435\u0433\u043e \u0447\u0430\u0441\u0430, \u0445\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0441\u043c\u0435\u043d\u0438\u0442\u044c\u0441\u044f, \u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u043d\u0435 \u0442\u043e\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e.) \u0415\u0441\u043b\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0430, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438, \u0442\u043e \u043d\u0430 \u044d\u0442\u043e\u0442 \u0441\u043b\u0443\u0447\u0430\u0439 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e \u043f\u043e\u043b\u0435 <code>period_ms<\/code>. \u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0435, \u0430 \u0430\u0431\u0441\u043e\u043b\u044e\u0442\u043d\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u2014 \u043f\u043e\u043b\u0435 <code>at_ms<\/code>. <\/p>\n<p>\u0422\u0430\u043a\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u0431\u0443\u0434\u0435\u043c \u043d\u0430\u0437\u044b\u0432\u0430\u0442\u044c <strong>\u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u043c\u0438<\/strong>:<\/p>\n<pre><code class=\"python\">class SocketApplication:     @property     def time_ms(self):         # Current app time         return int(time.time() - self.storage.get(\"start_app_time_ms\") * 1000)      def __init__(self, default_controller, controller_by_key=None, storage=None) -> None:         super().__init__()         self.default_controller = default_controller         self.controller_by_key = controller_by_key or {}         self.storage = storage if storage else Repository()  # App state         self.storage.get(\"start_app_time_ms\", time.time())         self.command_queue = self.storage.get(\"command_queue\", [])     # ...     async def handle_commands(self, index, commands):         result = []         # Handle         for command in commands:             key = escape(command.get(\"key\"))             controller = self.controller_by_key.get(key, self.default_controller)             if controller:                 await controller.handle_command(self.storage, index, command, result)         # Handle internal or enqueue if deferred         for indexes, commands in result:             if indexes is None:                 result += self.handle_internal(commands)         return result      def handle_internal(self, commands):         # Enqueue commands with time         handle_now_list = []         for command in commands:             # Push each to self.command_queue or handle_now_list             ...         # Handle other         result = await self.handle_commands(None, commands)         for indexes, c in result:             if indexes is None:                 result += self.handle_internal(c)         return result      def handle_deferred(self):         commands = []         periodical_commands = []         # Find commands which time has come         for command in self.command_queue.copy():             self.command_queue.remove(command)             at_ms = command.get(\"at_ms\")             if at_ms is None or at_ms &lt; 0:                 # Note: All commands in queue should have at_ms.                 # If not, it's same as being marked deleted.                 continue             elif at_ms > self.time_ms:                 # No more commands to handle                 break             else:                 # Handle                 commands.append(command)                 # Check periodical                 period_ms = command.get(\"period_ms\")                 if period_ms is not None and period_ms > 0:                     # command[\"at_ms\"] = None  # Ok, but slower than following                     command[\"at_ms\"] = self.time_ms + period_ms                     periodical_commands.append(command)         # Handle         result = self.handle_commands(None, commands)         # Enqueue periodical back         result += self.handle_internal(periodical_commands)         return result<\/code><\/pre>\n<p>\u0412 \u043a\u043e\u043c\u0430\u043d\u0434\u0430\u0445 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0442\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434\u044b \u0441 \u043c\u043e\u043c\u0435\u043d\u0442\u0430 \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430. \u0427\u0442\u043e\u0431\u044b \u0438\u0433\u0440\u0443 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u043f\u0435\u0440\u0435\u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0438 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0441 \u0442\u043e\u0433\u043e \u0436\u0435 \u043c\u0435\u0441\u0442\u0430, \u043e\u0447\u0435\u0440\u0435\u0434\u044c \u043a\u043e\u043c\u0430\u043d\u0434 \u0438 \u043d\u0430\u0447\u0430\u043b\u043e \u043e\u0442\u0441\u0447\u0435\u0442\u0430 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u0442\u0441\u044f \u0432 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435. \u0414\u043b\u044f \u043f\u043e\u0440\u044f\u0434\u043a\u0430 \u0442\u0443\u0442 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0435\u0449\u0435 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u044f \u0432\u0440\u0435\u043c\u0435\u043d\u0438, \u043a\u043e\u0433\u0434\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e (pause), \u043d\u043e \u044d\u0442\u043e \u043d\u0435\u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043e\u0434\u0443\u043c\u0430\u0442\u044c \u0438 \u0441\u0430\u043c\u0438\u043c;).<\/p>\n<p>\u041f\u043e\u043b\u044f <code>period_ms<\/code> \u0438 <code>after_ms<\/code> \u0432 \u043a\u043e\u043d\u0435\u0447\u043d\u043e\u043c \u0441\u0447\u0435\u0442\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442\u0441\u044f \u0432 <code>at_ms<\/code>, \u043f\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u0432\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u0441\u043e\u0440\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u0438 <code>command_queue<\/code>. \u041e\u0447\u0435\u0440\u0435\u0434\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0437\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0443 (<code>handle_deferred()<\/code>), \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u043e\u0442\u0441\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439. \u0418\u043d\u0430\u0447\u0435 \u043d\u0430\u043c \u043f\u0440\u0438\u0434\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0435\u0431\u0438\u0440\u0430\u0442\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0432\u0441\u0435 \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b \u043e\u0447\u0435\u0440\u0435\u0434\u0438.<\/p>\n<pre><code class=\"python\">class SocketServer:     # ...     async def main(self):         print(f\"Start server: {self.host}:{self.port}\")         server = await asyncio.start_server(self.handle_connection, self.host, self.port)         async with server:             self.is_running = True             while self.is_running:                 result = self.application.handle_deferred()                 self.send(result)                 await asyncio.sleep(.1)<\/code><\/pre>\n<p><a class=\"anchor\" name=\"section6\" id=\"section6\"><\/a><\/p>\n<h2>\u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a DDD-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435<\/h2>\n<p>\u0412\u043e\u0442 \u0442\u0430\u043a, \u043f\u043e\u0447\u0442\u0438 \u0447\u0442\u043e \u0432 <a href=\"https:\/\/www.youtube.com\/watch?v=rkQ3-T82pkU\" rel=\"noopener noreferrer nofollow\">DDD-\u0441\u0442\u0438\u043b\u0435<\/a> \u043c\u044b \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043b\u043e\u0433\u0438\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0412 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0438\u043b\u0438:<\/p>\n<ol>\n<li>\n<p>\u0447\u0442\u043e \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430\u0445,<\/p>\n<\/li>\n<li>\n<p>\u043b\u043e\u0433\u0438\u043a\u0430 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u043e\u0440\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044f\u043c,<\/p>\n<\/li>\n<li>\n<p>\u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u043e \u0440\u0430\u0431\u043e\u0442\u0435 \u0441 \u0432\u043d\u0435\u0448\u043d\u0438\u043c\u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c\u0438 \u2014 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c,<\/p>\n<\/li>\n<li>\n<p>\u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440-\u0448\u0430\u0431\u043b\u043e\u043d \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430,<\/p>\n<\/li>\n<li>\n<p>\u043a\u043e\u043d\u0435\u0447\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430 \u043d\u0430\u0441\u043b\u0435\u0434\u0443\u0435\u0442\u0441\u044f \u043e\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044c\u043d\u043e\u0433\u043e \u0438 \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u0432\u0430\u0435\u0442 \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c, \u043c\u043e\u0434\u0435\u043b\u044c\u044e \u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u0430\u043c\u0438, \u0442.\u0435. \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0430 \u043c\u0435\u0436\u0434\u0443 \u0432\u0441\u0435\u043c\u0438 \u044d\u0442\u0438\u043c\u0438 \u043a\u043e\u043c\u043f\u043e\u043d\u0435\u043d\u0442\u0430\u043c\u0438.<\/p>\n<\/li>\n<\/ol>\n<p>\u0420\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0432\u0435\u0441\u0442\u0438 \u0432 DDD-\u0441\u0442\u0438\u043b\u0435. \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u043d\u0438\u043a\u0430\u0435\u043c \u0432 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u044f\u0437\u044b\u043a \u044d\u0442\u043e\u0439 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438. \u042f\u0437\u044b\u043a (\u0438\u043c\u0435\u0435\u0442\u0441\u044f \u0432 \u0432\u0438\u0434\u0443 \u043f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u0442\u0435\u0440\u043c\u0438\u043d\u043e\u043b\u043e\u0433\u0438\u044f) \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u0442\u044c \u043e\u0431\u0449\u0438\u043c \u0434\u043b\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u043e\u0432 \u0438 \u0434\u043b\u044f \u0442\u0435\u0445, \u043a\u0442\u043e \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0432 \u044d\u0442\u043e\u0439 \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u0438. \u0412 \u043a\u043e\u0434\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432\u0441\u0435 \u0442\u0435 \u0436\u0435 \u0442\u0435\u0440\u043c\u0438\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0437\u0430\u043a\u0430\u0437\u0447\u0438\u043a\u0438.<\/p>\n<p>\u0412\u043d\u0438\u043a\u043d\u0443\u0432 \u0432 \u043f\u0440\u0435\u0434\u043c\u0435\u0442, \u043c\u044b \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0435\u0433\u043e \u043c\u043e\u0434\u0435\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e. \u0411\u0435\u0440\u0435\u043c \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u0438 \u043e\u0442\u0434\u0435\u043b\u044f\u0435\u043c \u0435\u0433\u043e \u043e\u0442 \u0432\u0441\u0435\u0433\u043e \u0432\u0442\u043e\u0440\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e\u0433\u043e \u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0433\u043e. \u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435 \u2014 \u044d\u0442\u043e \u0442\u043e, \u0431\u0435\u0437 \u0447\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u0435\u043c, \u0447\u0435\u043c \u043e\u043d \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043e\u043c.<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u0432 \u0432 \u0433\u043e\u043b\u043e\u0432\u0435 \u0431\u043e\u043b\u0435\u0435-\u043c\u0435\u043d\u0435\u0435 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043a\u0430\u0440\u0442\u0438\u043d\u0443 \u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0435 \u2014 \u043c\u043e\u0434\u0435\u043b\u044c \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0430, \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e. \u041d\u0430\u0447\u0438\u043d\u0430\u0435\u043c \u0441 \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c, \u043a\u0430\u043a\u0438\u0435 \u0442\u0438\u043f\u044b \u043e\u0431\u044a\u0435\u043a\u0442\u043e\u0432 \u043c\u044b \u0431\u0443\u0434\u0435\u043c \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u043a\u0430\u043a \u043e\u043d\u0438 \u0434\u0440\u0443\u0433 \u0441 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u043e\u043e\u0442\u043d\u043e\u0441\u044f\u0442\u0441\u044f, \u043a\u0430\u043a\u0443\u044e \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0443 \u0438 \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044e \u043e\u043d\u0438 \u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442, \u0438\u0437 \u043a\u0430\u043a\u0438\u0445 \u0441\u0432\u043e\u0439\u0441\u0442\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u0442: \u0438\u043c\u0435\u043d\u0430, \u0442\u0438\u043f\u044b.<\/p>\n<p>\u0414\u0430\u043b\u0435\u0435, \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u043a\u043b\u0430\u0441\u0441\u0430\u043c \u043c\u043e\u0434\u0435\u043b\u0435\u0439. \u0414\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u044f \u0438 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438, \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430\u0448\u0438\u043c \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u0435\u043c \u043e \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u0435, \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043c\u0435\u0442\u043e\u0434. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043a\u043b\u0430\u0441\u0441\u044b \u043f\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<p>\u041f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0435\u043c \u043a \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u043d\u0435 \u043e\u043f\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u2014 \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0435\u0440\u0435\u0437 \u043c\u043e\u0434\u0435\u043b\u0438. \u0422\u0430\u043a\u0436\u0435, \u0434\u043b\u044f \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043a \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u0441\u0435\u0440\u0432\u0438\u0441\u044b.<\/p>\n<p>\u0422\u0430\u043a, \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u043f\u043e\u0434\u043d\u0438\u043c\u0430\u044f\u0441\u044c \u0432\u0441\u0435 \u0432\u044b\u0448\u0435 \u0438 \u0432\u044b\u0448\u0435, \u0434\u043e\u0445\u043e\u0434\u0438\u043c \u0434\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u0432 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u044c\u043d\u043e\u043c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0435. \u042d\u0442\u043e\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0438 \u0443\u0445\u043e\u0434\u0438\u0442 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u043c \u043a\u043b\u0438\u0435\u043d\u0442\u0430. \u0418\u043b\u0438 \u043d\u0430\u043e\u0431\u043e\u0440\u043e\u0442, \u043a\u043b\u0438\u0435\u043d\u0442\u0449\u0438\u043a\u0438 \u0434\u0430\u044e\u0442 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b, \u0430 \u043c\u044b \u043f\u043e\u0434 \u043d\u0435\u0433\u043e \u043f\u0438\u0448\u0435\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f, \u043f\u0440\u043e\u0445\u043e\u0434\u044f \u0432\u0441\u0435 \u0432\u044b\u0448\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0435 \u044d\u0442\u0430\u043f\u044b, \u043d\u043e \u0443\u0436\u0435 \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u043f\u043e\u0440\u044f\u0434\u043a\u0435. \u0425\u043e\u0442\u044f \u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0432\u044b \u0431\u0443\u0434\u0435\u0442\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0430 \u0438 \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u2014 \u043e\u0442 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043a \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0441\u043e\u0432\u0435\u0440\u0448\u0435\u043d\u0441\u0442\u0432\u043e\u0432\u0430\u0442\u044c \u0443\u0436\u0435 \u0441\u0434\u0435\u043b\u0430\u043d\u043d\u044b\u0435 \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e \u0438 \u043d\u0430 \u043a\u043b\u0438\u0435\u043d\u0442\u0435, \u0438 \u043d\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u0435.<\/p>\n<p>\u0412\u0441\u0435\u0433\u043e \u0443 \u043d\u0430\u0441 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0438\u0437 \u0432\u043e\u0441\u044c\u043c\u0438 \u043e\u0431\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432, \u0440\u043e\u0432\u043d\u043e \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u0438\u0437 \u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435, \u0430 \u0434\u0440\u0443\u0433\u0430\u044f \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0430 \u2014 \u043a \u043b\u043e\u0433\u0438\u043a\u0435:<\/p>\n<ol>\n<li>\n<p>\u0421\u043b\u043e\u0439 \u0442\u0440\u0430\u043d\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u043a\u0438 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 &#8212; Server.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043b\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0439 &#8212; Parser.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043b\u043e\u0439 \u0434\u0438\u0441\u043f\u0435\u0442\u0447\u0435\u0440\u0430 &#8212; Application.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043b\u043e\u0439 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f &#8212; ProtocolController.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043b\u043e\u0439 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438 &#8212; Controller.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043b\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; Model.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043b\u043e\u0439 \u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044f \u0434\u0430\u043d\u043d\u044b\u0445 &#8212; Repository.<\/p>\n<\/li>\n<li>\n<p>\u0421\u043b\u043e\u0439 \u0434\u043e\u0441\u0442\u0443\u043f\u0430 \u043a \u0432\u043d\u0435\u0448\u043d\u0438\u043c \u0440\u0435\u0441\u0443\u0440\u0441\u0430\u043c &#8212; Service.<\/p>\n<\/li>\n<\/ol>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/8f0\/73c\/68e\/8f073c68e8aa34f4c0216304cffd1715.png\" alt=\"\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\" title=\"\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f\" width=\"786\" height=\"610\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/8f0\/73c\/68e\/8f073c68e8aa34f4c0216304cffd1715.png\"\/><figcaption>\u0424\u0438\u043d\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0445\u0435\u043c\u0430 \u0441\u0435\u0440\u0432\u0435\u0440\u043d\u043e\u0433\u043e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/figcaption><\/figure>\n<p>\u041f\u043e\u0442\u043e\u043a \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438: <\/p>\n<p>Server \u2192 Parser \u2192 Application \u2192 ProtocolController \u2192 Controller \u2192 Service \u2192 Model \u2192 Repository<\/p>\n<p>\u0418\u043c\u0435\u044f \u0442\u0430\u043a\u0443\u044e \u0441\u0445\u0435\u043c\u0443 \u043d\u0430 \u0432\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u0438\u0438, \u043c\u043e\u0436\u043d\u043e \u0441\u043c\u0435\u043b\u043e \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0430\u0442\u044c \u043a \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0438\u0433\u0440 \u043b\u044e\u0431\u043e\u0439 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438. \u0420\u0430\u0437\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043a\u043e\u0434\u0430 \u043d\u0430 \u0441\u043b\u043e\u0438 \u0434\u0430\u0435\u0442 \u043d\u0430\u043c \u0443\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u0441\u0442\u044c, \u0447\u0442\u043e \u043d\u0438\u0447\u0442\u043e \u043e\u0434\u043d\u0430\u0436\u0434\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043d\u0435 \u043f\u0440\u043e\u043f\u0430\u0434\u0435\u0442 \u0434\u0430\u0440\u043e\u043c. \u0412\u0435\u0434\u044c \u0435\u0441\u043b\u0438 \u043c\u044b \u0433\u0434\u0435-\u0442\u043e \u0438 \u043e\u0448\u0438\u0431\u0435\u043c\u0441\u044f \u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u0443\u0434\u0435\u043c \u0432\u0441\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c, \u043a\u043b\u0430\u0441\u0441\u044b \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u043b\u043e\u0435\u0432 \u044d\u0442\u043e \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u0442\u0440\u043e\u043d\u0435\u0442. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043a\u0430\u0436\u0434\u043e\u0435 \u043d\u043e\u0432\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u0431\u043e\u043b\u044c\u0448\u0435 \u0438 \u0431\u043e\u043b\u044c\u0448\u0435 \u043e\u0431\u043e\u0433\u0430\u0449\u0430\u0442\u044c \u043d\u0430\u0448\u0443 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0443, \u0442\u0430\u043a \u0447\u0442\u043e \u0432 \u043e\u0434\u0438\u043d \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043c, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0435\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0431\u0435\u0437 \u0435\u0434\u0438\u043d\u043e\u0433\u043e \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043b\u0430\u0441\u0441\u0430. \u0412\u0441\u0435 \u0431\u0435\u0440\u0435\u0442\u0441\u044f \u0438\u0437 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0438 \u043d\u0430\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043a\u043e\u043d\u0444\u0438\u0433\u0430\u0445 \u043f\u043e\u0434 \u043d\u0430\u0448\u0438 \u043d\u0443\u0436\u0434\u044b. \u0420\u0430\u0437\u0432\u0435 \u044d\u0442\u043e \u043d\u0435 \u043c\u0435\u0447\u0442\u0430 \u0432\u0441\u0435\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0438 \u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u043e\u0432?<\/p>\n<p><a href=\"https:\/\/gitlab.com\/markelov-alex\/hx-py-framework-evolution\/-\/tree\/main\/f_models\/\" rel=\"noopener noreferrer nofollow\">\u0418\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438<\/a><\/p>\n<h3>\u0421\u043e\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u0435<\/h3>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/674754\/\" rel=\"noopener noreferrer nofollow\">\u041f\u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b<\/a><\/p>\n<p><strong>\u041a\u043b\u0438\u0435\u043d\u0442<\/strong><\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/677312\/\" rel=\"noopener noreferrer nofollow\">\u041b\u043e\u0433\u0438\u043a\u0430 \u043e\u0442\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/677386\/\" rel=\"noopener noreferrer nofollow\">\u041c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u044b<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/677854\/\" rel=\"noopener noreferrer nofollow\">\u0421\u043b\u043e\u0438 \u043b\u043e\u0433\u0438\u043a\u0438<\/a><\/p>\n<\/li>\n<\/ol>\n<p><strong>\u0421\u0435\u0440\u0432\u0435\u0440<\/strong><\/p>\n<ol>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/678658\/\" rel=\"noopener noreferrer nofollow\">\u0421\u043b\u043e\u0438 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/678666\/\" rel=\"noopener noreferrer nofollow\">\u0421\u043b\u043e\u0438 \u043b\u043e\u0433\u0438\u043a\u0438<\/a><\/p>\n<\/li>\n<\/ol>\n<p><a href=\"https:\/\/habr.com\/ru\/post\/678658\/\" rel=\"noopener noreferrer nofollow\">&lt; \u041d\u0430\u0437\u0430\u0434<\/a>  |  <a href=\"https:\/\/habr.com\/ru\/post\/674754\/\" rel=\"noopener noreferrer nofollow\">\u041d\u0430\u0447\u0430\u043b\u043e<\/a><\/p>\n<\/p>\n<\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/678666\/\"> https:\/\/habr.com\/ru\/post\/678666\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0412 <a href=\"https:\/\/habr.com\/ru\/post\/678658\/\" rel=\"noopener noreferrer nofollow\">\u043f\u0440\u043e\u0448\u043b\u044b\u0439 \u0440\u0430\u0437<\/a> \u043c\u044b \u043e\u0442\u0434\u0435\u043b\u0438\u043b\u0438 \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0438 \u0440\u0430\u0437\u0431\u0438\u043b\u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u043d\u0430 \u0447\u0435\u0442\u044b\u0440\u0435 \u0441\u043b\u043e\u044f: Server \u2192 Parser \u2192 Application \u2192 Repository. \u041a\u043b\u0430\u0441\u0441\u044b \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0435\u0440\u0435\u0442 \u043d\u0430 \u0441\u0435\u0431\u044f \u0432\u0441\u044e \u0440\u0443\u0442\u0438\u043d\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443, \u0430 \u043d\u0430\u043c \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u043f\u0438\u0441\u0430\u0442\u044c \u043e\u0434\u043d\u0443 \u0442\u043e\u043b\u044c\u043a\u043e \u043b\u043e\u0433\u0438\u043a\u0443.<\/p>\n<p>\u041b\u043e\u0433\u0438\u043a\u0430 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0438\u0437 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u044f\u0442\u044b\u0439 \u0438 \u043f\u043e\u043a\u0430 \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u043b\u043e\u0439. \u041e\u043d\u0438 \u043f\u043e\u043b\u043d\u043e\u0441\u0442\u044c\u044e \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u044b \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b (\u0438\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435), \u043d\u043e \u0438 \u0434\u0440\u0443\u0433 \u043e\u0442 \u0434\u0440\u0443\u0433\u0430. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u2014 \u044d\u0442\u043e, \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u0431\u0430\u0437\u043e\u0432\u044b\u0435 \u0435\u0434\u0438\u043d\u0438\u0446\u044b \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0431\u043e\u0431\u0449\u0438\u0442\u044c, \u0442\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u043e\u0434\u043d\u0438\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0432 \u0434\u0440\u0443\u0433\u0438\u0435 \u0441 \u0441\u043e\u043f\u0443\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u043c \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435\u043c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f (Repository). \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0438 \u0442\u0435\u043a\u0443\u0449\u0435\u0433\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f <code>Application<\/code> \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u0442 \u0435\u043c\u0443 \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 <code>Repository<\/code>. \u041a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443, \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0430 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043e\u0439 \u043f\u043e \u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e. \u0412 \u043e\u0431\u0449\u0435\u0439 \u0441\u0445\u0435\u043c\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u043c\u0435\u0436\u0434\u0443 \u0434\u0432\u0438\u0436\u043a\u043e\u043c \u0438 \u0445\u0440\u0430\u043d\u0438\u043b\u0438\u0449\u0435\u043c: <\/p>\n<blockquote>\n<p>&#8230; \u2192 Application \u2192 Controller \u2192 Repository.<\/p>\n<\/blockquote>\n<p>\u0415\u0441\u043b\u0438 \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u0442\u044c \u0432\u0441\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u0432 \u043e\u0434\u043d\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430, \u0442\u043e \u044d\u0442\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432 \u043e\u043a\u0430\u0436\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043b\u0430\u0441\u0441. \u0411\u043e\u043b\u044c\u0448\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 \u2014 \u044d\u0442\u043e \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0430 \u043c\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430, \u0441\u043e\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u2014 \u044d\u0442\u043e \u043c\u0435\u0448\u0430\u043d\u0438\u043d\u0430. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u0431\u044b \u0432 \u043d\u0435\u0439 \u043d\u0435 \u0437\u0430\u043f\u0443\u0442\u0430\u0442\u044c\u0441\u044f, \u0432\u0441\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0431\u0438\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b. \u041e\u0434\u043d\u0430 \u0437\u0430\u0434\u0430\u0447\u0430 \u2014 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441. \u041a\u043b\u0430\u0441\u0441\u044b, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0449\u0438\u0435 \u0441\u0445\u043e\u0434\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438 \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u044b\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u0442\u044c \u0434\u0440\u0443\u0433 \u0434\u0440\u0443\u0433\u0430, \u0431\u0443\u0434\u0443\u0442 \u0433\u0440\u0443\u043f\u043f\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0432 \u0441\u043b\u043e\u0438, \u043a\u0430\u043a \u0438 \u0432 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435.<\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0443 \u043d\u0430\u0441 \u043f\u043e\u044f\u0432\u044f\u0442\u0441\u044f \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0436\u0430\u043d\u0440\u0430, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0441 \u0431\u0430\u0437\u043e\u0432\u044b\u043c\u0438 \u043a\u043b\u0430\u0441\u0441\u0430\u043c\u0438 \u0434\u043b\u044f \u0433\u0440\u0443\u043f\u043f \u0436\u0430\u043d\u0440\u043e\u0432. \u0412 \u043e\u0442\u043b\u0438\u0447\u0438\u0435, \u043e\u0442 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0433\u043e, \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u044d\u0442\u0438 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0431\u0443\u0434\u0443\u0442 \u0441\u0443\u0433\u0443\u0431\u043e &#171;\u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0438\u0435&#187;. \u041e\u0431\u0449\u0430\u044f \u0438\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a \u0431\u0443\u0434\u0435\u0442 \u0442\u0430\u043a\u0430\u044f \u0436\u0435 \u043a\u0430\u043a \u0438 \u0432 <a href=\"https:\/\/habr.com\/ru\/post\/677854\/\" rel=\"noopener noreferrer nofollow\">\u043a\u043b\u0438\u0435\u043d\u0442\u0435<\/a> (\u043d\u0438\u0436\u0435\u043b\u0435\u0436\u0430\u0449\u0438\u0435 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0431\u0435\u0440\u0443\u0442 \u0437\u0430 \u0441\u0432\u043e\u044e \u043e\u0441\u043d\u043e\u0432\u0443 \u0432\u044b\u0448\u0435\u043b\u0435\u0436\u0430\u0449\u0438\u0435):<\/p>\n<ol>\n<li>\n<p>Core Framework<\/p>\n<\/li>\n<li>\n<p>Base Game Frameworks (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0437 Core Framework)<\/p>\n<\/li>\n<li>\n<p>Game Frameworks (\u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043a\u043b\u0430\u0441\u0441\u044b \u0438\u0437 Core \u0438 Base Game Frameworks)<\/p>\n<\/li>\n<\/ol>\n<p>\u041f\u0440\u0438 \u0442\u0430\u043a\u043e\u0439 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0438\u0433\u0440\u044b \u2014 \u044d\u0442\u043e \u043b\u0438\u0448\u044c \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430 \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0438\u0437 \u0436\u0430\u043d\u0440\u043e\u0432\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438. \u0418\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442 \u0442\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0441\u0442\u043e\u044f\u0442\u044c \u0432\u043e\u043e\u0431\u0449\u0435 \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e main-\u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u0432 \u043f\u0430\u0440\u0443 \u0441\u0442\u0440\u043e\u043a \u0438 yml-\u0444\u0430\u0439\u043b\u0430 \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0430\u0446\u0438\u0438.<\/p>\n<p>\u041e \u0442\u043e\u043c, \u043a\u0430\u043a \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043b\u0430\u0441\u0441\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u0443\u0440\u043e\u0432\u043d\u044f \u043e\u0431\u043e\u0431\u0449\u0435\u043d\u0438\u044f, \u0447\u0442\u043e\u0431\u044b \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 \u0441\u043e\u0441\u0442\u043e\u044f\u043b \u0432\u0441\u0435\u0433\u043e \u0438\u0437 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0442\u0440\u043e\u043a, \u043a\u0430\u043a \u0440\u0430\u0437 \u0438 \u043f\u043e\u0439\u0434\u0435\u0442 \u0440\u0435\u0447\u044c \u0432 \u0434\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435:<\/p>\n<ol>\n<li>\n<p><a href=\"#section1\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#section2\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#section3\" rel=\"noopener noreferrer nofollow\">\u0418\u0437\u043c\u0435\u043d\u0438\u0432\u0448\u0430\u044f\u0441\u044f \u0440\u043e\u043b\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#section4\" rel=\"noopener noreferrer nofollow\">\u041e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0442\u043e\u043a\u043e\u043b\u0430<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#section5\" rel=\"noopener noreferrer nofollow\">\u0412\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0438\u0435 \u0438 \u043e\u0442\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b<\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"#section6\" rel=\"noopener noreferrer nofollow\">\u041f\u0435\u0440\u0435\u0445\u043e\u0434 \u043a DDD-\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0435<\/a><\/p>\n<\/li>\n<\/ol>\n<p><a class=\"anchor\" name=\"section1\" id=\"section1\"><\/a><\/p>\n<h2>\u041e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0435\u0440\u0432\u0438\u0441\u0430<\/h2>\n<p>\u0412 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u043c\u044b \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043b\u0438 \u0442\u0440\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b: get, set, update, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u043b\u0438 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u0421\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u0445\u0440\u0430\u043d\u0438\u043b\u043e\u0441\u044c \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0438 \u0431\u044b\u043b\u043e \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e \u043b\u0438\u0448\u044c \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430. \u0427\u0442\u043e\u0431\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043e\u0431\u0449\u0435\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0430\u043c\u0438, \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u043d\u044b\u043c\u0438 \u043d\u0430 \u0440\u0430\u0437\u043d\u044b\u0445 \u043c\u0430\u0448\u0438\u043d\u0430\u0445, \u043d\u0443\u0436\u043d\u043e \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0435\u0433\u043e \u0432 \u0431\u0430\u0437\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u043d\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c \u0441\u0435\u0440\u0432\u0435\u0440\u0435, \u0438 \u043f\u0440\u0438 \u043a\u0430\u0436\u0434\u043e\u043c \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0438 \u043a \u0434\u0430\u043d\u043d\u044b\u043c \u0431\u0440\u0430\u0442\u044c \u0435\u0433\u043e \u043e\u0442\u0442\u0443\u0434\u0430.<\/p>\n<p>\u0412 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043f\u0440\u0438\u043c\u0435\u0440\u0430 \u0432\u043e\u0437\u044c\u043c\u0435\u043c \u0442\u0443 \u0436\u0435 \u0437\u0430\u0434\u0430\u0447\u0443, \u043d\u043e \u0434\u0430\u043d\u043d\u044b\u0435 \u0431\u0443\u0434\u0435\u043c \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u0442\u043e\u0442\u044b \u043d\u0435 \u0432 \u0411\u0414, \u0430 \u0432 \u0444\u0430\u0439\u043b\u0435:<\/p>\n<pre><code class=\"python\">class MyController:     async def handle_command(self, storage, index, command, result):         key = command.get(\"key\")         key = escape(key)  # Never trust data from users         filename = \"..\/data\/save_\" + key         dirname = os.path.dirname(filename)         if not os.path.exists(dirname):             os.makedirs(dirname)         code = command.get(\"code\")         all_indexes = storage.get(\"indexes\")         if code == \"save\" or code == \"set\":             state = command.get(\"state\")             with open(filename, \"w\") as f:                 json.dump(state, f)                 f.flush()             result.append((all_indexes, [{**command, \"success\": True}]))         elif code == \"load\" or code == \"get\":             if not os.path.exists(filename):                 return {\"success\": False, **command}, None             with open(filename, \"r\") as f:                 state = json.load(f)             result.append(([index], [{**command, \"success\": True, \"state\": state}]))         elif code == \"update\":             index = command.get(\"index\")             value = command.get(\"value\")             if not isinstance(index, int) or not isinstance(value, int):                 result.append(([index], [{**command, \"success\": False}]))                 return             if not os.path.exists(filename):                 state = []             else:                 with open(filename, \"r\") as f:                     state = json.load(f)             if index >= len(state):                 state += [0] * (index - len(state) + 1)             state[index] = value             with open(filename, \"w\") as f:                 json.dump(state, f)                 f.flush()             result.append((all_indexes, [{**command, \"success\": success}]))  def escape(string):     return re.sub(r\"[^A-Za-z]+\", \"\", string)<\/code><\/pre>\n<p>\u041a\u0430\u043a \u043c\u044b \u0438 \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u0440\u0430\u043d\u044c\u0448\u0435 \u2014 \u043c\u0435\u0448\u0430\u043d\u0438\u043d\u0430. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0432\u044b\u0447\u043b\u0435\u043d\u0438\u043c \u043e\u0442\u0441\u044e\u0434\u0430 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0438\u043c\u0435\u0441\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u0442\u044c \u043f\u043e \u043d\u0435\u043a\u043e\u0435\u043c\u0443 \u043e\u0431\u0449\u0435\u043c\u0443 \u043f\u0440\u0438\u0437\u043d\u0430\u043a\u0443 \u0438 \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043a\u043b\u0430\u0441\u0441. \u041f\u0440\u0435\u0436\u0434\u0435 \u0432\u0441\u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0440\u0430\u0431\u043e\u0442\u0443 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u2014 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0441\u043b\u0443\u0436\u0435\u0431\u043d\u0430\u044f \u0438 \u0447\u0438\u0441\u0442\u043e \u0442\u0435\u0445\u043d\u0438\u0447\u0435\u0441\u043a\u0430\u044f, \u0442\u043e \u0435\u0441\u0442\u044c \u043d\u0435 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0430\u044f \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438, \u0442\u043e \u043d\u0430\u0437\u043e\u0432\u0435\u043c \u0434\u0430\u043d\u043d\u044b\u0439 \u0442\u0438\u043f \u043a\u043b\u0430\u0441\u0441\u043e\u0432 \u0441\u043b\u0443\u0436\u0431\u0430\u043c\u0438 (Service), \u0430 \u043d\u0430\u0448\u0443 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e \u0441 \u0444\u0430\u0439\u043b\u0430\u043c\u0438 \u2014 <code>FileService<\/code>.<\/p>\n<pre><code class=\"python\">class StorageService:     def save(self, key, data):         pass      def load(self, key):         return None  class FileService(StorageService):     filename_prefix = \"\"      def __init__(self, filename_prefix=None):         self.filename_prefix = filename_prefix or self.filename_prefix      def save(self, key, data):         key = escape(key)  # Never trust data from users         filename = self.filename_prefix + key         dirname = os.path.dirname(filename)         if dirname and not os.path.exists(dirname):             os.makedirs(dirname)         with open(filename, \"w\") as f:             json.dump(data, f)             f.flush()             print(\"save\", data)      def load(self, key):         key = escape(key)  # Never trust data from users         filename = self.filename_prefix + key         if not os.path.exists(filename):             return None         with open(filename, \"r\") as f:             data = json.load(f)             print(\"load\", data)             return data  class MyController:     # Settings     service_factory = lambda self: FileService(\"..\/data\/save_\")     model_factory = lambda self, *args: MyModel(*args)      def __init__(self):         self.service = self.service_factory()         self.model = self.model_factory(self.service)      async def handle_command(self, storage, index, command, result):         code = command.get(\"code\")         key = command.get(\"key\")         all_indexes = storage.get(\"indexes\")         if code == \"save\" or code == \"set\":             state = command.get(\"state\")             success = self.service.save(key, state)             result.append((all_indexes, [{**command, \"success\": success}]))         elif code == \"load\" or code == \"get\":             state = self.service.load(key)             result.append(([index], [{**command, \"success\": True, \"state\": state}]))         elif code == \"update\":             index = command.get(\"index\")             value = command.get(\"value\")             state = self.service.load(key)             if not isinstance(index, int) or not isinstance(value, int):                 success = False             else:                 if state is None:                     state = []                 if index >= len(state):                     state += [0] * (index - len(state) + 1)                 state[index] = value                 success = True             self.service.save(key, state)             result.append((all_indexes, [{**command, \"success\": success}]))<\/code><\/pre>\n<p>\u0422\u043e\u043b\u044c\u043a\u043e \u0432\u0437\u0433\u043b\u044f\u043d\u0438\u0442\u0435 \u043d\u0430 <code>handle_command()<\/code> \u2014 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0440\u0430\u0437\u0443 \u0441\u0442\u0430\u043b\u043e \u043b\u0435\u0433\u0447\u0435 \u0434\u044b\u0448\u0430\u0442\u044c! \u041d\u043e \u0432\u044b\u0433\u043e\u0434\u0430 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u044d\u0442\u043e\u043c. \u0422\u0435\u043f\u0435\u0440\u044c \u0432\u0435\u0441\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043f\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u0438\u044e \u0438 \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0438 \u0438\u0437 \u0444\u0430\u0439\u043b\u0430 \u0441\u043e\u0431\u0440\u0430\u043d \u0432 \u043e\u0434\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435. \u0410 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0438\u0442, \u0447\u0442\u043e \u043d\u0430\u043c \u0442\u0435\u043f\u0435\u0440\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0440\u044b\u0441\u043a\u0430\u0442\u044c \u043f\u043e \u043a\u043e\u0434\u0443, \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043c\u044f \u0444\u0430\u0439\u043b\u0430 \u0438\u043b\u0438 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0435\u043c\u044b\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0441 JSON \u043d\u0430 YML, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440. \u0414\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043a\u043b\u0430\u0441\u0441.<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e. \u041c\u044b \u043c\u043e\u0436\u0435\u043c \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u043a\u043b\u0430\u0441\u0441\u0435 \u0442\u043e\u0442 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441, \u043d\u043e \u0443\u0436\u0435 \u043d\u0435 \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0432 \u0444\u0430\u0439\u043b, \u0430, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0441\u044b\u043b\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043d\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u043d\u044b\u0439 \u0441\u0435\u0440\u0432\u0435\u0440 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0435\u0440\u0435\u0437 HTTP-\u0437\u0430\u043f\u0440\u043e\u0441) \u0438\u043b\u0438 \u043f\u043e\u043c\u0435\u0449\u0430\u0442\u044c \u0438\u0445 \u0432 \u0431\u0430\u0437\u0443 \u0434\u0430\u043d\u043d\u044b\u0445 (\u0411\u0414). \u0412\u0435\u0434\u044c \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0443 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e, \u043a\u0430\u043a \u0441\u0435\u0440\u0432\u0438\u0441 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442 \u0441\u0432\u043e\u044e \u0437\u0430\u0434\u0430\u0447\u0443 \u2014 \u043e\u043d \u043b\u0438\u0448\u044c \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u043c\u0435\u0442\u043e\u0434\u044b <code>load()<\/code> \u0438 <code>save()<\/code>. \u0421 \u0442\u043e\u0447\u043a\u0438 \u0437\u0440\u0435\u043d\u0438\u044f \u043b\u043e\u0433\u0438\u043a\u0438 (\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u0430), \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043c\u0435\u043d\u043d\u043e <em>\u0432 \u0444\u0430\u0439\u043b<\/em>. \u041d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e <em>\u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c<\/em> \u0434\u0430\u043d\u043d\u044b\u0435. \u0418 \u043d\u0435 \u043d\u0443\u0436\u043d\u043e \u0437\u0430\u0433\u0440\u0443\u0436\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0442\u043e\u043b\u044c\u043a\u043e <em>\u0438\u0437 \u0444\u0430\u0439\u043b\u0430<\/em>. \u0414\u0430\u043d\u043d\u044b\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0443\u0436\u043d\u044b, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0438\u0445 \u043d\u0443\u0436\u043d\u043e <em>\u0437\u0430\u0433\u0440\u0443\u0437\u0438\u0442\u044c<\/em> \u2014 \u0432\u0441\u0435 \u0440\u0430\u0432\u043d\u043e \u043e\u0442\u043a\u0443\u0434\u0430.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0435\u043d \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 <code>StorageService<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437-\u0437\u0430 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%A3%D1%82%D0%B8%D0%BD%D0%B0%D1%8F_%D1%82%D0%B8%D0%BF%D0%B8%D0%B7%D0%B0%D1%86%D0%B8%D1%8F\" rel=\"noopener noreferrer nofollow\">&#171;\u0443\u0442\u0438\u043d\u043e\u0439&#187; \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0438<\/a> Python \u043d\u043e\u0441\u0438\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043d\u0430\u0433\u0440\u0443\u0437\u043a\u0443, \u0447\u0435\u043c \u0440\u0435\u0430\u043b\u044c\u043d\u0443\u044e \u043f\u043e\u043b\u044c\u0437\u0443. \u0423\u0442\u0438\u043d\u0430\u044f \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u044f \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043b\u0430\u0441\u0441\u044b \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u043c\u0435\u0442\u043e\u0434\u043e\u0432 \u0441 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438, \u0438 \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u044b \u0432 \u043a\u043e\u0434\u0435, \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u043a \u0432 \u042f\u041f \u0441\u043e \u0441\u0442\u0440\u043e\u0433\u043e\u0439 \u0442\u0438\u043f\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043e\u043d\u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u0431\u044b \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u043c\u0435\u0442\u044c \u043e\u0431\u0449\u0435\u0433\u043e \u043f\u0440\u0435\u0434\u043a\u0430 \u0441 \u0442\u0430\u043a\u0438\u043c\u0438 \u0436\u0435 \u043c\u0435\u0442\u043e\u0434\u0430\u043c\u0438 \u0438\u043b\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u044b\u0432\u0430\u0442\u044c \u043e\u0434\u0438\u043d \u0438 \u0442\u043e\u0442 \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0443\u0441\u0442\u043e\u0439 \u043a\u043b\u0430\u0441\u0441 <code>StorageService<\/code> \u043f\u0440\u043e\u0441\u0442\u043e \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c, \u0447\u0442\u043e \u0435\u0441\u0442\u044c \u0432\u043e\u0442 \u0442\u0430\u043a\u043e\u0439 \u0442\u0438\u043f \u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432, \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0439 \u0434\u043b\u044f \u0440\u0435\u0448\u0435\u043d\u0438\u044f \u0442\u0430\u043a\u043e\u0439 \u0432\u043e\u0442 \u0437\u0430\u0434\u0430\u0447\u0438, \u0438 \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0441\u0432\u043e\u0435 \u043e\u0441\u043e\u0431\u043e\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438.<\/p>\n<p><a class=\"anchor\" name=\"section2\" id=\"section2\"><\/a><\/p>\n<h2>\u041e\u0442\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u043c\u043e\u0434\u0435\u043b\u0438<\/h2>\n<p>\u0412\u0442\u043e\u0440\u0430\u044f \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0443\u044e\u0442 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u044b \u2014 \u044d\u0442\u043e \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0434\u0430\u043d\u043d\u044b\u0445. \u042d\u0442\u043e\u0442 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0438\u0437 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u043a\u043b\u0430\u0441\u0441\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0430\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u043c\u043e\u0434\u0435\u043b\u044f\u043c\u0438.<\/p>\n<p>\u041f\u043e\u0447\u0435\u043c\u0443 \u043c\u043e\u0434\u0435\u043b\u0438? \u0412\u0441\u044f\u043a\u043e\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u0440\u0430\u0436\u0430\u0435\u0442 \u0442\u0443 \u0438\u043b\u0438 \u0438\u043d\u0443\u044e \u043e\u0431\u043b\u0430\u0441\u0442\u044c \u0434\u0435\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0447\u0435\u043b\u043e\u0432\u0435\u043a\u0430 \u0438\u0437 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u0436\u0438\u0437\u043d\u0438, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u0435\u0434\u043c\u0435\u0442\u043d\u043e\u0439 \u043e\u0431\u043b\u0430\u0441\u0442\u044c\u044e \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041d\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u043d\u0430\u043c \u043d\u0435 \u043d\u0443\u0436\u043d\u0430 \u0432\u043e \u0432\u0441\u0435\u0439 \u0435\u0435 \u043f\u043e\u043b\u043d\u043e\u0442\u0435. \u041d\u0430\u043c \u043d\u0443\u0436\u043d\u044b \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0435\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-336179","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336179","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=336179"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/336179\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=336179"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=336179"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=336179"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}