asynctnt.instance
Classes
Interface for protocol for subprocess calls. |
|
Module Contents
- class asynctnt.instance.TarantoolInstanceProtocol(tnt, on_exit)[source]
Bases:
asyncio.SubprocessProtocol
Interface for protocol for subprocess calls.
- connection_made(transport)[source]
Called when a connection is made.
The argument is the transport representing the pipe connection. To receive data, wait for data_received() calls. When the connection is closed, connection_lost() is called.
- pipe_data_received(fd, data)[source]
Called when the subprocess writes data into stdout/stderr pipe.
fd is int file descriptor. data is bytes object.
- class asynctnt.instance.TarantoolInstance(*, host='127.0.0.1', port=3301, console_host=None, console_port=3302, replication_source=None, title=None, logger=None, log_level=5, slab_alloc_arena=0.1, wal_mode='none', root=None, specify_work_dir=True, cleanup=True, initlua_template=None, applua='-- app.lua --', extra_box_cfg='', timeout=5.0, command_to_run='tarantool', command_args=None)[source]
-
- _initlua_template = Multiline-String[source]
Show Value
""" local function check_version(expected, version) -- from tarantool/queue compat.lua local fun = require 'fun' local iter, op = fun.iter, fun.operator local function split(self, sep) local sep, fields = sep or ":", {} local pattern = string.format("([^%s]+)", sep) self:gsub(pattern, function(c) table.insert(fields, c) end) return fields end local function reducer(res, l, r) if res ~= nil then return res end if tonumber(l) == tonumber(r) then return nil end return tonumber(l) > tonumber(r) end local function split_version(version_string) local vtable = split(version_string, '.') local vtable2 = split(vtable[3], '-') vtable[3], vtable[4] = vtable2[1], vtable2[2] return vtable end local function check_version_internal(expected, version) version = version or _TARANTOOL if type(version) == 'string' then version = split_version(version) end local res = iter(version):zip(expected) :reduce(reducer, nil) if res or res == nil then res = true end return res end return check_version_internal(expected, version) end local cfg = { listen = "${host}:${port}", wal_mode = "${wal_mode}", custom_proc_title = "${custom_proc_title}", slab_alloc_arena = ${slab_alloc_arena}, work_dir = ${work_dir}, log_level = ${log_level}, ${extra_box_cfg} } if check_version({1, 7}, _TARANTOOL) then cfg.replication = ${replication_source} else local repl = ${replication_source} if type(repl) == 'table' then repl = table.concat(repl, ',') end cfg.replication_source = repl end require('console').listen("${console_host}:${console_port}") box.cfg(cfg) box.schema.user.grant("guest", "read,write,execute", "universe", nil, {if_not_exists = true}) ${applua} """
- class asynctnt.instance.TarantoolSyncInstance(**kwargs)[source]
Bases:
TarantoolInstance
- class asynctnt.instance.TarantoolAsyncInstance(**kwargs)[source]
Bases:
TarantoolInstance
- class asynctnt.instance.TarantoolSyncDockerInstance(*, docker_image=None, docker_tag=None, host='0.0.0.0', port=3301, console_host=None, console_port=3302, replication_source=None, title=None, logger=None, log_level=5, slab_alloc_arena=0.1, wal_mode='none', initlua_template=None, applua='-- app.lua --', timeout=10.0)[source]
Bases:
TarantoolSyncInstance