File tree 7 files changed +28
-28
lines changed 7 files changed +28
-28
lines changed Original file line number Diff line number Diff line change
1
+ local fiber = require (' fiber' )
2
+
3
+ local router_metadata_cache = {}
4
+
5
+ router_metadata_cache .SHARDING_KEY_MAP_NAME = " sharding_key_as_index_obj_map"
6
+ router_metadata_cache .SHARDING_FUNC_MAP_NAME = " sharding_func_map"
7
+ router_metadata_cache [router_metadata_cache .SHARDING_KEY_MAP_NAME ] = nil
8
+ router_metadata_cache [router_metadata_cache .SHARDING_FUNC_MAP_NAME ] = nil
9
+ router_metadata_cache .fetch_lock = fiber .channel (1 )
10
+ router_metadata_cache .is_part_of_pk = {}
11
+
12
+ function router_metadata_cache .drop_caches ()
13
+ router_metadata_cache [router_metadata_cache .SHARDING_KEY_MAP_NAME ] = nil
14
+ router_metadata_cache [router_metadata_cache .SHARDING_FUNC_MAP_NAME ] = nil
15
+ if router_metadata_cache .fetch_lock ~= nil then
16
+ router_metadata_cache .fetch_lock :close ()
17
+ end
18
+ router_metadata_cache .fetch_lock = fiber .channel (1 )
19
+ router_metadata_cache .is_part_of_pk = {}
20
+ end
21
+
22
+ return router_metadata_cache
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ local errors = require('errors')
2
2
local log = require (' log' )
3
3
4
4
local dev_checks = require (' crud.common.dev_checks' )
5
- local cache = require (' crud.common.sharding.sharding_metadata_cache ' )
5
+ local cache = require (' crud.common.sharding.router_metadata_cache ' )
6
6
local utils = require (' crud.common.utils' )
7
7
8
8
local ShardingFuncError = errors .new_class (' ShardingFuncError' , {capture_stack = false })
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ local errors = require('errors')
2
2
local log = require (' log' )
3
3
4
4
local dev_checks = require (' crud.common.dev_checks' )
5
- local cache = require (' crud.common.sharding.sharding_metadata_cache ' )
5
+ local cache = require (' crud.common.sharding.router_metadata_cache ' )
6
6
local utils = require (' crud.common.utils' )
7
7
8
8
local ShardingKeyError = errors .new_class (" ShardingKeyError" , {capture_stack = false })
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ local errors = require('errors')
4
4
local call = require (' crud.common.call' )
5
5
local const = require (' crud.common.const' )
6
6
local dev_checks = require (' crud.common.dev_checks' )
7
- local cache = require (' crud.common.sharding.sharding_metadata_cache ' )
7
+ local cache = require (' crud.common.sharding.router_metadata_cache ' )
8
8
local storage_cache = require (' crud.common.sharding.storage_metadata_cache' )
9
9
local sharding_func = require (' crud.common.sharding.sharding_func' )
10
10
local sharding_key = require (' crud.common.sharding.sharding_key' )
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 334
334
335
335
function helpers .get_sharding_key_cache (cluster )
336
336
return cluster .main_server .net_box :eval ([[
337
- local sharding_metadata_cache = require('crud.common.sharding.sharding_metadata_cache ')
337
+ local sharding_metadata_cache = require('crud.common.sharding.router_metadata_cache ')
338
338
339
339
return sharding_metadata_cache[sharding_metadata_cache.SHARDING_KEY_MAP_NAME]
340
340
]] )
362
362
-- but not the cache itself
363
363
function helpers .get_sharding_func_cache_size (cluster )
364
364
return cluster .main_server .net_box :eval ([[
365
- local sharding_metadata_cache = require('crud.common.sharding.sharding_metadata_cache ')
365
+ local sharding_metadata_cache = require('crud.common.sharding.router_metadata_cache ')
366
366
367
367
local cache, err = sharding_metadata_cache[sharding_metadata_cache.SHARDING_FUNC_MAP_NAME]
368
368
if cache == nil then
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ local ffi = require('ffi')
3
3
local sharding_metadata_module = require (' crud.common.sharding.sharding_metadata' )
4
4
local sharding_key_module = require (' crud.common.sharding.sharding_key' )
5
5
local sharding_func_module = require (' crud.common.sharding.sharding_func' )
6
- local cache = require (' crud.common.sharding.sharding_metadata_cache ' )
6
+ local cache = require (' crud.common.sharding.router_metadata_cache ' )
7
7
local utils = require (' crud.common.utils' )
8
8
9
9
local helpers = require (' test.helper' )
You can’t perform that action at this time.
0 commit comments