summaryrefslogtreecommitdiff
path: root/xmake/modules/private/service/remote_cache/server_session.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-06-19 22:48:46 +0800
committerruki <[email protected]>2022-06-19 22:48:46 +0800
commit01eeb3325c51d18f79b61303fb4d17af011b7dd0 (patch)
tree5cfd2d47d5d5ae62a3b7ffa0a9898b1684fd4864 /xmake/modules/private/service/remote_cache/server_session.lua
parenteb965315b1030cc2de426909500d34f99d281943 (diff)
cache outdata/errdata for remote cache
Diffstat (limited to 'xmake/modules/private/service/remote_cache/server_session.lua')
-rw-r--r--xmake/modules/private/service/remote_cache/server_session.lua8
1 files changed, 8 insertions, 0 deletions
diff --git a/xmake/modules/private/service/remote_cache/server_session.lua b/xmake/modules/private/service/remote_cache/server_session.lua
index 38d86e55e..6ab5d9a06 100644
--- a/xmake/modules/private/service/remote_cache/server_session.lua
+++ b/xmake/modules/private/service/remote_cache/server_session.lua
@@ -81,11 +81,15 @@ function server_session:pull(respmsg)
local stream = self:stream()
local cachekey = body.filename
local cachefile = path.join(self:cachedir(), cachekey:sub(1, 2), cachekey)
+ local cacheinfofile = cachefile .. ".txt"
vprint("pull cachefile(%s) ..", cachekey)
-- send cache file
if os.isfile(cachefile) then
body.exists = true
+ if os.isfile(cacheinfofile) then
+ body.extrainfo = io.load(cacheinfofile)
+ end
if not stream:send_file(cachefile, {compress = os.filesize(cachefile) > 4096}) then
raise("send %s failed!", cachefile)
end
@@ -103,10 +107,14 @@ function server_session:push(respmsg)
local stream = self:stream()
local cachekey = body.filename
local cachefile = path.join(self:cachedir(), cachekey:sub(1, 2), cachekey)
+ local cacheinfofile = cachefile .. ".txt"
vprint("push cachefile(%s) ..", cachekey)
if not stream:recv_file(cachefile) then
raise("recv %s failed!", cachefile)
end
+ if body.extrainfo then
+ io.save(cacheinfofile, body.extrainfo)
+ end
end
-- get file info