asynctnt.connection

Module Contents

Classes

ConnectionState

Enum where members are also (and must be) ints

Connection

Functions

connect(→ Connection)

connect shorthand. See asynctnt.Connection for kwargs details

class asynctnt.connection.ConnectionState[source]

Bases: enum.IntEnum

Enum where members are also (and must be) ints

CONNECTING = 1[source]
CONNECTED = 2[source]
RECONNECTING = 3[source]
DISCONNECTING = 4[source]
DISCONNECTED = 5[source]
class asynctnt.connection.Connection(*, host: str = '127.0.0.1', port: int | str = 3301, username: str | None = None, password: str | None = None, fetch_schema: bool = True, auto_refetch_schema: bool = True, connect_timeout: float = 3.0, request_timeout: float = -1.0, reconnect_timeout: float = 1.0 / 3.0, ping_timeout: float = 5.0, encoding: str | None = None, initial_read_buffer_size: int | None = None)[source]

Bases: asynctnt.api.Api

property fingerprint: str[source]
property host: str[source]

Tarantool host

property port: int[source]

Tarantool port

property username: str | None[source]

Tarantool username

property password: str | None[source]

Tarantool password

property fetch_schema: bool[source]

fetch_schema flag

property auto_refetch_schema: bool[source]

auto_refetch_schema flag

property encoding: str[source]

Connection encoding

property reconnect_timeout: float[source]

Reconnect timeout value

property connect_timeout: float[source]

Connect timeout value

property request_timeout: float[source]

Request timeout value

property version: tuple | None[source]

Protocol version tuple. ex.: (1, 6, 7)

property state: ConnectionState[source]

Current connection state

Return type:

ConnectionState

property is_connected: bool[source]

Check if an underlying connection is active

property is_fully_connected: bool[source]

Check if connection is fully active (performed auth and schema fetching)

property schema_id: int | None[source]

Tarantool’s current schema id

property schema: asynctnt.iproto.protocol.Schema | None[source]

Current Tarantool schema with all spaces, indexes and fields

property initial_read_buffer_size: int[source]

initial_read_buffer_size value

property features: asynctnt.iproto.protocol.IProtoFeatures[source]

Lookup available Tarantool features - https://www.tarantool.io/en/doc/latest/reference/reference_lua/box_iproto/feature/ :return:

__slots__ = ('_host', '_port', '_username', '_password', '_fetch_schema', '_auto_refetch_schema',...[source]
_set_state(new_state: ConnectionState)[source]
connection_lost(exc)[source]
async _ping_task_func()[source]
_start_reconnect(return_exceptions: bool = False)[source]
protocol_factory(connected_fut: asyncio.Future, loop: asyncio.AbstractEventLoop, cls: Type[asynctnt.iproto.protocol.Protocol] = protocol.Protocol)[source]
async _connect(return_exceptions: bool = True)[source]
async _wait_reconnect(exc: Exception | None = None)[source]
async connect() Connection[source]

Connect coroutine

async disconnect()[source]

Disconnect coroutine

close()[source]

Same as disconnect, but not a coroutine, i.e. it does not wait for disconnect to finish.

async reconnect()[source]

Reconnect coroutine. Just calls disconnect() and connect()

async __aenter__() Connection[source]

Executed on entering the async with section. Connects to Tarantool instance.

async __aexit__(exc_type, exc_val, exc_tb)[source]

Executed on leaving the async with section. Disconnects from Tarantool instance.

async refetch_schema()[source]

Coroutine to force refetch schema

_normalize_api()[source]
__repr__()[source]

Return repr(self).

stream() asynctnt.stream.Stream[source]

Create new stream suitable for interactive transactions

async asynctnt.connection.connect(**kwargs) Connection[source]

connect shorthand. See asynctnt.Connection for kwargs details

Returns:

asynctnt.Connection object