Cluster

class aerospike_sdk.aio.cluster.Cluster[source]

Bases: object

Live connection to a cluster, obtained from ClusterDefinition.connect().

Owns a connected Client and exposes create_session() / create_transactional_session(). Prefer async with await ClusterDefinition(...).connect() as cluster so close() runs on exit.

Example:

async with await ClusterDefinition("localhost", 3100).connect() as cluster:
    session = cluster.create_session(Behavior.DEFAULT)
__init__(sdk_client)[source]

Initialize a Cluster instance.

Parameters:

sdk_client (Client) – The underlying Client instance

Note

This should not be called directly. Use ClusterDefinition.connect() instead.

create_session(behavior=None)[source]

Open a Session with optional behavior.

A session represents a logical connection to the cluster with specific behavior settings that control how operations are performed (timeouts, retry policies, consistency levels, etc.).

Parameters:

behavior (Optional[Behavior]) – Defaults to DEFAULT.

Return type:

Session

Returns:

Session bound to this cluster’s SDK client.

See also

create_session()

create_transactional_session(behavior=None)[source]

Return a transactional session facade (behavior reserved for API parity).

Parameters:

behavior (Optional[Behavior]) – Accepted for symmetry with create_session(); the underlying client may not apply it yet.

Return type:

TransactionalSession

Returns:

TransactionalSession.

is_connected()[source]

Mirror is_connected.

Return type:

bool

async close()[source]

Close the SDK client and release cluster resources.

Invoked automatically when used as an async context manager.

Return type:

None