Skip to content

Commit c1e9131

Browse files
committed
Draft for master discovery
1 parent bec9f72 commit c1e9131

File tree

10 files changed

+2420
-4
lines changed

10 files changed

+2420
-4
lines changed

connection_pool/config.lua

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
local nodes_load = require("config_load_nodes")
2+
3+
-- Do not set listen for now so connector won't be
4+
-- able to send requests until everything is configured.
5+
box.cfg{
6+
work_dir = os.getenv("TEST_TNT_WORK_DIR"),
7+
}
8+
9+
-- Function to call for getting address list, part of tarantool/multi API.
10+
local get_cluster_nodes = nodes_load.get_cluster_nodes
11+
rawset(_G, 'get_cluster_nodes', get_cluster_nodes)
12+
13+
box.once("init", function()
14+
box.schema.user.create('test', { password = 'test' })
15+
box.schema.user.grant('test', 'read,write,execute', 'universe')
16+
17+
local s = box.schema.space.create('testPool', {
18+
id = 520,
19+
if_not_exists = true,
20+
format = {
21+
{name = "key", type = "string"},
22+
{name = "value", type = "string"},
23+
},
24+
})
25+
s:create_index('pk', {
26+
type = 'tree',
27+
parts = {{ field = 1, type = 'string' }},
28+
if_not_exists = true
29+
})
30+
end)
31+
32+
-- Set listen only when every other thing is configured.
33+
box.cfg{
34+
listen = os.getenv("TEST_TNT_LISTEN"),
35+
}

connection_pool/config_load_nodes.lua

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
local function get_cluster_nodes()
2+
return { 'localhost:3013', 'localhost:3014' }
3+
end
4+
5+
return {
6+
get_cluster_nodes = get_cluster_nodes
7+
}

0 commit comments

Comments
 (0)