|
|
|
|
@@ -874,8 +874,8 @@ local __update_chunk_storages
|
|
|
|
|
local __trace_major_chunks
|
|
|
|
|
local __trace_minor_chunks
|
|
|
|
|
|
|
|
|
|
local __cache_query_chunks
|
|
|
|
|
local __reset_query_chunks
|
|
|
|
|
local __update_query_chunks
|
|
|
|
|
|
|
|
|
|
local __update_major_chunks
|
|
|
|
|
local __update_major_chunks_trace
|
|
|
|
|
@@ -1138,9 +1138,7 @@ end
|
|
|
|
|
|
|
|
|
|
---@param chunk evolved.chunk
|
|
|
|
|
function __update_chunk_queries(chunk)
|
|
|
|
|
local chunk_major = chunk.__fragment
|
|
|
|
|
|
|
|
|
|
local major_queries = __major_queries[chunk_major]
|
|
|
|
|
local major_queries = __major_queries[chunk.__fragment]
|
|
|
|
|
local major_query_list = major_queries and major_queries.__item_list
|
|
|
|
|
local major_query_count = major_queries and major_queries.__item_count or 0
|
|
|
|
|
|
|
|
|
|
@@ -1304,23 +1302,25 @@ function __trace_minor_chunks(minor, trace, ...)
|
|
|
|
|
__release_table(__table_pool_tag.chunk_list, chunk_stack, true)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---@param query evolved.query
|
|
|
|
|
function __reset_query_chunks(query)
|
|
|
|
|
__query_chunks[query] = nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---@param query evolved.query
|
|
|
|
|
---@return evolved.assoc_list<evolved.chunk>
|
|
|
|
|
function __update_query_chunks(query)
|
|
|
|
|
---@type evolved.assoc_list<evolved.chunk>
|
|
|
|
|
local query_chunks = __assoc_list_new(4)
|
|
|
|
|
__query_chunks[query] = query_chunks
|
|
|
|
|
function __cache_query_chunks(query)
|
|
|
|
|
__reset_query_chunks(query)
|
|
|
|
|
|
|
|
|
|
local query_includes = __sorted_includes[query]
|
|
|
|
|
local query_include_list = query_includes and query_includes.__item_list
|
|
|
|
|
local query_include_count = query_includes and query_includes.__item_count or 0
|
|
|
|
|
|
|
|
|
|
if query_include_count > 0 then
|
|
|
|
|
if query_include_count == 0 then
|
|
|
|
|
__error_fmt('the query (%s) has no include fragments and cannot be cached',
|
|
|
|
|
__id_name(query))
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---@type evolved.assoc_list<evolved.chunk>
|
|
|
|
|
local query_chunks = __assoc_list_new(4)
|
|
|
|
|
__query_chunks[query] = query_chunks
|
|
|
|
|
|
|
|
|
|
do
|
|
|
|
|
local query_major = query_include_list[query_include_count]
|
|
|
|
|
|
|
|
|
|
local major_chunks = __major_chunks[query_major]
|
|
|
|
|
@@ -1339,6 +1339,11 @@ function __update_query_chunks(query)
|
|
|
|
|
return query_chunks
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---@param query evolved.query
|
|
|
|
|
function __reset_query_chunks(query)
|
|
|
|
|
__query_chunks[query] = nil
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---@param major evolved.fragment
|
|
|
|
|
function __update_major_chunks(major)
|
|
|
|
|
__trace_major_chunks(major, __update_major_chunks_trace)
|
|
|
|
|
@@ -5957,7 +5962,7 @@ function __evolved_execute(query)
|
|
|
|
|
local query_exclude_count = query_excludes and query_excludes.__item_count or 0
|
|
|
|
|
|
|
|
|
|
if query_include_count > 0 then
|
|
|
|
|
local query_chunks = __query_chunks[query] or __update_query_chunks(query)
|
|
|
|
|
local query_chunks = __query_chunks[query] or __cache_query_chunks(query)
|
|
|
|
|
local query_chunk_list = query_chunks and query_chunks.__item_list
|
|
|
|
|
local query_chunk_count = query_chunks and query_chunks.__item_count or 0
|
|
|
|
|
|
|
|
|
|
@@ -5971,8 +5976,8 @@ function __evolved_execute(query)
|
|
|
|
|
elseif query_exclude_count > 0 then
|
|
|
|
|
for _, root_chunk in __lua_next, __root_chunks do
|
|
|
|
|
local is_root_chunk_matched =
|
|
|
|
|
(not root_chunk.__has_explicit_fragments) and
|
|
|
|
|
(not __chunk_has_any_fragment_list(root_chunk, query_exclude_list, query_exclude_count))
|
|
|
|
|
not root_chunk.__has_explicit_fragments and
|
|
|
|
|
not __chunk_has_any_fragment_list(root_chunk, query_exclude_list, query_exclude_count)
|
|
|
|
|
|
|
|
|
|
if is_root_chunk_matched then
|
|
|
|
|
chunk_stack_size = chunk_stack_size + 1
|
|
|
|
|
@@ -5982,7 +5987,7 @@ function __evolved_execute(query)
|
|
|
|
|
else
|
|
|
|
|
for _, root_chunk in __lua_next, __root_chunks do
|
|
|
|
|
local is_root_chunk_matched =
|
|
|
|
|
(not root_chunk.__has_explicit_fragments)
|
|
|
|
|
not root_chunk.__has_explicit_fragments
|
|
|
|
|
|
|
|
|
|
if is_root_chunk_matched then
|
|
|
|
|
chunk_stack_size = chunk_stack_size + 1
|
|
|
|
|
@@ -6975,7 +6980,7 @@ __evolved_set(__ON_REMOVE, __UNIQUE)
|
|
|
|
|
---
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
local function __insert_major_query(query)
|
|
|
|
|
local function __insert_query(query)
|
|
|
|
|
local query_includes = __sorted_includes[query]
|
|
|
|
|
local query_include_list = query_includes and query_includes.__item_list
|
|
|
|
|
local query_include_count = query_includes and query_includes.__item_count or 0
|
|
|
|
|
@@ -6993,7 +6998,7 @@ local function __insert_major_query(query)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
local function __remove_major_query(query)
|
|
|
|
|
local function __remove_query(query)
|
|
|
|
|
local query_includes = __sorted_includes[query]
|
|
|
|
|
local query_include_list = query_includes and query_includes.__item_list
|
|
|
|
|
local query_include_count = query_includes and query_includes.__item_count or 0
|
|
|
|
|
@@ -7006,13 +7011,14 @@ local function __remove_major_query(query)
|
|
|
|
|
__major_queries[query_major] = nil
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
__reset_query_chunks(query)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
---@param query evolved.query
|
|
|
|
|
---@param include_list evolved.fragment[]
|
|
|
|
|
__evolved_set(__INCLUDES, __ON_SET, function(query, _, include_list)
|
|
|
|
|
__reset_query_chunks(query)
|
|
|
|
|
__remove_major_query(query)
|
|
|
|
|
__remove_query(query)
|
|
|
|
|
|
|
|
|
|
local include_count = #include_list
|
|
|
|
|
|
|
|
|
|
@@ -7029,18 +7035,17 @@ __evolved_set(__INCLUDES, __ON_SET, function(query, _, include_list)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if include_count > 0 or __sorted_excludes[query] then
|
|
|
|
|
__insert_major_query(query)
|
|
|
|
|
__insert_query(query)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
__evolved_set(__INCLUDES, __ON_REMOVE, function(query)
|
|
|
|
|
__reset_query_chunks(query)
|
|
|
|
|
__remove_major_query(query)
|
|
|
|
|
__remove_query(query)
|
|
|
|
|
|
|
|
|
|
__sorted_includes[query] = nil
|
|
|
|
|
|
|
|
|
|
if __sorted_excludes[query] then
|
|
|
|
|
__insert_major_query(query)
|
|
|
|
|
__insert_query(query)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
@@ -7053,8 +7058,7 @@ end)
|
|
|
|
|
---@param query evolved.query
|
|
|
|
|
---@param exclude_list evolved.fragment[]
|
|
|
|
|
__evolved_set(__EXCLUDES, __ON_SET, function(query, _, exclude_list)
|
|
|
|
|
__reset_query_chunks(query)
|
|
|
|
|
__remove_major_query(query)
|
|
|
|
|
__remove_query(query)
|
|
|
|
|
|
|
|
|
|
local exclude_count = #exclude_list
|
|
|
|
|
|
|
|
|
|
@@ -7071,18 +7075,17 @@ __evolved_set(__EXCLUDES, __ON_SET, function(query, _, exclude_list)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
if exclude_count > 0 or __sorted_includes[query] then
|
|
|
|
|
__insert_major_query(query)
|
|
|
|
|
__insert_query(query)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
__evolved_set(__EXCLUDES, __ON_REMOVE, function(query)
|
|
|
|
|
__reset_query_chunks(query)
|
|
|
|
|
__remove_major_query(query)
|
|
|
|
|
__remove_query(query)
|
|
|
|
|
|
|
|
|
|
__sorted_excludes[query] = nil
|
|
|
|
|
|
|
|
|
|
if __sorted_includes[query] then
|
|
|
|
|
__insert_major_query(query)
|
|
|
|
|
__insert_query(query)
|
|
|
|
|
end
|
|
|
|
|
end)
|
|
|
|
|
|
|
|
|
|
|