pyignite.connection package¶
This module contains Connection class, that wraps TCP socket handling, as well as Ignite protocol handshaking.
-
class
pyignite.connection.
Connection
(prefetch: bytes = b'', **kwargs)¶ Bases:
object
This is a pyignite class, that represents a connection to Ignite node. It serves multiple purposes:
- socket wrapper. Detects fragmentation and network errors. See also https://docs.python.org/3/howto/sockets.html,
- binary protocol connector. Incapsulates handshake, data read-ahead and failover reconnection.
-
__init__
(prefetch: bytes = b'', **kwargs)¶ Initialize connection.
For the use of the SSL-related parameters see https://docs.python.org/3/library/ssl.html#ssl-certificates.
Parameters: - prefetch – (optional) initialize the read-ahead data buffer. Empty by default,
- timeout – (optional) sets timeout (in seconds) for each socket operation including connect. 0 means non-blocking mode, which is virtually guaranteed to fail. Can accept integer or float value. Default is None (blocking mode),
- use_ssl – (optional) set to True if Ignite server uses SSL on its binary connector. Defaults to use SSL when username and password has been supplied, not to use SSL otherwise,
- ssl_version – (optional) SSL version constant from standard ssl module. Defaults to TLS v1.1, as in Ignite 2.5,
- ssl_ciphers – (optional) ciphers to use. If not provided, ssl default ciphers are used,
- ssl_cert_reqs –
(optional) determines how the remote side certificate is treated:
- ssl.CERT_NONE − remote certificate is ignored (default),
- ssl.CERT_OPTIONAL − remote certificate will be validated, if provided,
- ssl.CERT_REQUIRED − valid remote certificate is required,
- ssl_keyfile – (optional) a path to SSL key file to identify local (client) party,
- ssl_certfile – (optional) a path to ssl certificate file to identify local (client) party,
- ssl_ca_certfile – (optional) a path to a trusted certificate or a certificate chain. Required to check the validity of the remote (server-side) certificate,
- username – (optional) user name to authenticate to Ignite cluster,
- password – (optional) password to authenticate to Ignite cluster.
-
clone
(prefetch: bytes = b'') → pyignite.connection.Connection¶ Clones this connection in its current state.
Returns: Connection object.
-
close
()¶ Mark socket closed. This is recommended but not required, since sockets are automatically closed when they are garbage-collected.
-
connect
(*args)¶ Connect to the server. Connection parameters may be either one node (host and port), or list (or other iterable) of nodes.
Parameters: - host – Ignite server host,
- port – Ignite server port,
- nodes – iterable of (host, port) tuples.
-
host
= None¶
-
nodes
= None¶
-
password
= None¶
-
port
= None¶
-
prefetch
= None¶
-
read_response
()¶
-
recv
(buffersize, flags=None) → bytes¶ Receive data from socket or read-ahead buffer.
Parameters: - buffersize – bytes to receive,
- flags – (optional) OS-specific flags,
Returns: data received.
-
send
(data: bytes, flags=None)¶ Send data down the socket.
Parameters: - data – bytes to send,
- flags – (optional) OS-specific flags.
-
socket
¶ Network socket.
-
timeout
= None¶
-
username
= None¶