Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
332dc8c7
Commit
332dc8c7
authored
2 years ago
by
Igor Kuznetsov
Browse files
Options
Downloads
Patches
Plain Diff
refactor: extract `fiber_id` function to the lua path
parent
646ec5c8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1414
sbroad import
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/init.lua
+26
-0
26 additions, 0 deletions
src/init.lua
src/otm/fiber.rs
+1
-24
1 addition, 24 deletions
src/otm/fiber.rs
src/router.lua
+1
-20
1 addition, 20 deletions
src/router.lua
src/storage.lua
+2
-20
2 additions, 20 deletions
src/storage.lua
with
30 additions
and
64 deletions
src/init.lua
0 → 100644
+
26
−
0
View file @
332dc8c7
local
cartridge
=
require
(
'cartridge'
)
_G
.
fiber_id
=
function
()
local
fiber
=
require
(
'fiber'
)
return
fiber
.
id
()
end
_G
.
get_jaeger_agent_host
=
function
()
local
cfg
=
cartridge
.
config_get_readonly
()
if
cfg
[
"jaeger_agent_host"
]
==
nil
then
return
"localhost"
end
return
cfg
[
"jaeger_agent_host"
]
end
_G
.
get_jaeger_agent_port
=
function
()
local
cfg
=
cartridge
.
config_get_readonly
()
if
cfg
[
"jaeger_agent_port"
]
==
nil
then
return
6831
end
return
cfg
[
"jaeger_agent_port"
]
end
This diff is collapsed.
Click to expand it.
src/otm/fiber.rs
+
1
−
24
View file @
332dc8c7
#[cfg(not(feature
=
"mock"
))]
pub
(
super
)
fn
fiber_id
()
->
u64
{
static
mut
FIBER_FUNC_DEFINED
:
bool
=
false
;
let
lua
=
global_lua
();
let
lua
=
tarantool
::
lua_state
();
if
!
unsafe
{
FIBER_FUNC_DEFINED
}
{
#[rustfmt::skip]
lua
.exec
(
r#"
function fiber_id()
local fiber = require('fiber')
return fiber.id()
end
"#
,
)
.unwrap
();
unsafe
{
FIBER_FUNC_DEFINED
=
true
;
}
}
lua
.get
::
<
tarantool
::
tlua
::
LuaFunction
<
_
>
,
_
>
(
"fiber_id"
)
.unwrap
()
.into_call
()
.unwrap
()
}
#[cfg(not(feature
=
"mock"
))]
fn
global_lua
()
->
tarantool
::
tlua
::
StaticLua
{
use
tarantool
::
tlua
::
Lua
;
unsafe
{
Lua
::
from_static
(
tarantool
::
ffi
::
tarantool
::
luaT_state
())
}
}
This diff is collapsed.
Click to expand it.
src/router.lua
+
1
−
20
View file @
332dc8c7
require
(
'strict'
).
on
()
require
(
'sbroad'
)
local
vshard
=
require
(
'vshard'
)
local
cartridge
=
require
(
'cartridge'
)
...
...
@@ -8,26 +9,6 @@ _G.get_schema = function()
return
cartridge
.
get_schema
()
end
_G
.
get_jaeger_agent_host
=
function
()
local
cfg
=
cartridge
.
config_get_readonly
()
if
cfg
[
"jaeger_agent_host"
]
==
nil
then
return
"localhost"
end
return
cfg
[
"jaeger_agent_host"
]
end
_G
.
get_jaeger_agent_port
=
function
()
local
cfg
=
cartridge
.
config_get_readonly
()
if
cfg
[
"jaeger_agent_port"
]
==
nil
then
return
6831
end
return
cfg
[
"jaeger_agent_port"
]
end
_G
.
get_waiting_timeout
=
function
()
local
cfg
=
cartridge
.
config_get_readonly
()
...
...
This diff is collapsed.
Click to expand it.
src/storage.lua
+
2
−
20
View file @
332dc8c7
require
(
'strict'
).
on
()
require
(
'sbroad'
)
local
cartridge
=
require
(
'cartridge'
)
_G
.
get_storage_cache_capacity
=
function
()
...
...
@@ -22,26 +24,6 @@ _G.get_storage_cache_size_bytes = function()
return
cfg
[
"storage_cache_size_bytes"
]
end
_G
.
get_jaeger_agent_host
=
function
()
local
cfg
=
cartridge
.
config_get_readonly
()
if
cfg
[
"jaeger_agent_host"
]
==
nil
then
return
"localhost"
end
return
cfg
[
"jaeger_agent_host"
]
end
_G
.
get_jaeger_agent_port
=
function
()
local
cfg
=
cartridge
.
config_get_readonly
()
if
cfg
[
"jaeger_agent_port"
]
==
nil
then
return
6831
end
return
cfg
[
"jaeger_agent_port"
]
end
_G
.
prepare
=
function
(
pattern
)
local
prep
,
err
=
box
.
prepare
(
pattern
)
if
err
~=
nil
then
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment