implement the dirstat extension in exportfs, greatly improving perf for OpenOS clients
This commit is contained in:
parent
638322c157
commit
35f3c6f89e
@ -16,6 +16,14 @@ end
|
||||
function netutil.exportfs(path) -- string -- boolean -- Export the directory *path* over RPC.
|
||||
local path = "/"..table.concat(fs.segments(path),"/")
|
||||
local px = require("unionfs").create(path)
|
||||
function px.dirstat(p)
|
||||
local rt = {}
|
||||
for k,v in ipairs(px.list(p)) do
|
||||
local fp = p.."/"..v
|
||||
rt[v] = {px.isDirectory(fp), px.size(fp), px.lastModified(fp)}
|
||||
end
|
||||
return rt
|
||||
end
|
||||
for k,v in pairs(px) do
|
||||
rpc.register("fs_"..path.."_"..k,v)
|
||||
print("fs_"..path.."_"..k)
|
||||
|
Loading…
Reference in New Issue
Block a user