Skip to content
Snippets Groups Projects
Commit 9b9b538a authored by 最萌小汐's avatar 最萌小汐
Browse files

cleanup

parent 7b619cb4
No related branches found
No related tags found
No related merge requests found
...@@ -245,18 +245,19 @@ local function checkCache(status, uri, expect, mode) ...@@ -245,18 +245,19 @@ local function checkCache(status, uri, expect, mode)
return false return false
end end
local function checkMark(mark, id, field) local function checkSLock(slock, id, field)
if noder.getIDLength(id) > 10 then if noder.getIDLength(id) > 10 then
print(1) print(1)
end end
local cmark = mark[id] local cmark = slock[id]
if not cmark then if not cmark then
cmark = {} cmark = {}
mark[id] = {} slock[id] = {}
end end
if cmark[field or ''] then if cmark[field or ''] then
return false return false
end end
cmark[field or ''] = true
local right = '' local right = ''
while field and field ~= '' do while field and field ~= '' do
local lastID = noder.getLastID(field) local lastID = noder.getLastID(field)
...@@ -269,7 +270,6 @@ local function checkMark(mark, id, field) ...@@ -269,7 +270,6 @@ local function checkMark(mark, id, field)
end end
field = field:sub(1, - #lastID - 1) field = field:sub(1, - #lastID - 1)
end end
cmark[field or ''] = true
return true return true
end end
...@@ -286,15 +286,18 @@ function m.searchRefsByID(status, uri, expect, mode) ...@@ -286,15 +286,18 @@ function m.searchRefsByID(status, uri, expect, mode)
local callStack = status.callStack local callStack = status.callStack
local mark = status.flock[uri] or {} local slock = status.slock[uri] or {}
status.flock[uri] = mark local elock = status.elock[uri] or {}
status.slock[uri] = slock
status.elock[uri] = elock
local function search(id, field) local function search(id, field)
local firstID = noder.getFirstID(id) local firstID = noder.getFirstID(id)
if ignoredIDs[firstID] and (field or firstID ~= id) then if ignoredIDs[firstID] and (field or firstID ~= id) then
return return
end end
if not checkMark(mark, id, field) then if not checkSLock(slock, id, field) then
footprint(status, 'slocked:', id, field)
return return
end end
footprint(status, 'search:', id, field) footprint(status, 'search:', id, field)
...@@ -550,7 +553,8 @@ function m.searchRefsByID(status, uri, expect, mode) ...@@ -550,7 +553,8 @@ function m.searchRefsByID(status, uri, expect, mode)
end end
local tid = id .. (field or '') local tid = id .. (field or '')
local sid = id local sid = id
if ignoredIDs[id] then if ignoredIDs[id]
or id == 'dn:string' then
sid = 'def:' .. sid sid = 'def:' .. sid
end end
for _, guri in collector.each(sid) do for _, guri in collector.each(sid) do
...@@ -577,23 +581,22 @@ function m.searchRefsByID(status, uri, expect, mode) ...@@ -577,23 +581,22 @@ function m.searchRefsByID(status, uri, expect, mode)
end end
end end
local expanding = {}
local function lockExpanding(id, field) local function lockExpanding(id, field)
local locked = expanding[id] local locked = elock[id]
if locked and field then if locked and field then
if #locked <= #field then if #locked <= #field then
if field:sub(-#locked) == locked then if field:sub(-#locked) == locked then
footprint(status, 'locked:', id, locked, field) footprint(status, 'elocked:', id, locked, field)
return false return false
end end
end end
end end
expanding[id] = field elock[id] = field
return true return true
end end
local function releaseExpanding(id, field) local function releaseExpanding(id, field)
expanding[id] = nil elock[id] = nil
end end
local function searchNode(id, node, field) local function searchNode(id, node, field)
...@@ -917,7 +920,8 @@ function m.status(mode) ...@@ -917,7 +920,8 @@ function m.status(mode)
callStack = {}, callStack = {},
crossed = {}, crossed = {},
lock = {}, lock = {},
flock = {}, slock = {},
elock = {},
results = {}, results = {},
rmark = {}, rmark = {},
smark = {}, smark = {},
......
...@@ -10,7 +10,7 @@ ROOT = fs.path(rootPath) ...@@ -10,7 +10,7 @@ ROOT = fs.path(rootPath)
TEST = true TEST = true
DEVELOP = true DEVELOP = true
--FOOTPRINT = true --FOOTPRINT = true
TRACE = true --TRACE = true
LOGPATH = LOGPATH or (ROOT .. '/log') LOGPATH = LOGPATH or (ROOT .. '/log')
METAPATH = METAPATH or (ROOT .. '/meta') METAPATH = METAPATH or (ROOT .. '/meta')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment