From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: tarantool-patches@dev.tarantool.org, alexander.turenko@tarantool.org Subject: [Tarantool-patches] [PATCH 2/4] feedback: move feedback code to the single file Date: Sun, 12 Apr 2020 22:13:28 +0200 [thread overview] Message-ID: <6c0531bc990b086f36b0c211fccd01d96d7b27fb.1586722379.git.v.shpilevoy@tarantool.org> (raw) In-Reply-To: <cover.1586722379.git.v.shpilevoy@tarantool.org> Feedback daemon's code was located in two files: box/lua/feedback_daemon.lua and box/lua/schema.lua. That makes it harder to eliminate the daemon at cmake configuration time. Now all its code is in one place, in feedback_daemon.lua. Disable of the daemon's code now is a matter of excluding the Lua file from source code. Part of #3308 --- src/box/lua/feedback_daemon.lua | 16 ++++++++++++++++ src/box/lua/schema.lua | 17 ----------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/box/lua/feedback_daemon.lua b/src/box/lua/feedback_daemon.lua index ad71a3fe2..95130d696 100644 --- a/src/box/lua/feedback_daemon.lua +++ b/src/box/lua/feedback_daemon.lua @@ -4,6 +4,7 @@ local log = require('log') local json = require('json') local fiber = require('fiber') local http = require('http.client') +local fio = require('fio') local PREFIX = "feedback_daemon" @@ -131,6 +132,21 @@ setmetatable(daemon, { } }) +box.feedback = {} +box.feedback.save = function(file_name) + if type(file_name) ~= "string" then + error("Usage: box.feedback.save(path)") + end + local feedback = json.encode(daemon.generate_feedback()) + local fh, err = fio.open(file_name, {'O_CREAT', 'O_RDWR', 'O_TRUNC'}, + tonumber('0777', 8)) + if not fh then + error(err) + end + fh:write(feedback) + fh:close() +end + if box.internal == nil then box.internal = { [PREFIX] = daemon } else diff --git a/src/box/lua/schema.lua b/src/box/lua/schema.lua index 85fcca562..10584494b 100644 --- a/src/box/lua/schema.lua +++ b/src/box/lua/schema.lua @@ -5,8 +5,6 @@ local msgpack = require('msgpack') local msgpackffi = require('msgpackffi') local fun = require('fun') local log = require('log') -local fio = require('fio') -local json = require('json') local buffer = require('buffer') local session = box.session local internal = require('box.internal') @@ -2711,19 +2709,4 @@ end setmetatable(box.space, { __serialize = box_space_mt }) -box.feedback = {} -box.feedback.save = function(file_name) - if type(file_name) ~= "string" then - error("Usage: box.feedback.save(path)") - end - local feedback = json.encode(box.internal.feedback_daemon.generate_feedback()) - local fh, err = fio.open(file_name, {'O_CREAT', 'O_RDWR', 'O_TRUNC'}, - tonumber('0777', 8)) - if not fh then - error(err) - end - fh:write(feedback) - fh:close() -end - box.NULL = msgpack.NULL -- 2.21.1 (Apple Git-122.3)
next prev parent reply other threads:[~2020-04-12 20:13 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-12 20:13 [Tarantool-patches] [PATCH 0/4] CMake option to remove feedback daemon Vladislav Shpilevoy 2020-04-12 20:13 ` [Tarantool-patches] [PATCH 1/4] box: improve built-in module load panic message Vladislav Shpilevoy 2020-04-12 20:13 ` Vladislav Shpilevoy [this message] 2020-04-12 20:13 ` [Tarantool-patches] [PATCH 3/4] box: yield after initial box_cfg() is finished Vladislav Shpilevoy 2020-04-12 20:13 ` [Tarantool-patches] [PATCH 4/4] feedback: add cmake option to disable the daemon Vladislav Shpilevoy 2020-04-15 17:28 ` Serge Petrenko 2020-04-15 20:04 ` Vladislav Shpilevoy 2020-04-12 20:19 ` [Tarantool-patches] [PATCH 0/4] CMake option to remove feedback daemon Vladislav Shpilevoy 2020-04-17 7:04 ` Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=6c0531bc990b086f36b0c211fccd01d96d7b27fb.1586722379.git.v.shpilevoy@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 2/4] feedback: move feedback code to the single file' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox