testcontainers-cpp 0.2.0
Native C++20 Testcontainers over the Docker Engine API
Loading...
Searching...
No Matches
testcontainers::DockerClient::Session Class Reference

While alive, THIS client instance keeps its daemon connection open across requests and reuses it for consecutive idempotent GET calls — all other requests keep opening fresh connections, so a stale-connection retry can never replay a side effect. More...

#include <testcontainers/docker/DockerClient.hpp>

Public Member Functions

 Session (DockerClient &client)
 ~Session ()
 Session (const Session &)=delete
Sessionoperator= (const Session &)=delete

Detailed Description

While alive, THIS client instance keeps its daemon connection open across requests and reuses it for consecutive idempotent GET calls — all other requests keep opening fresh connections, so a stale-connection retry can never replay a side effect.

If a reused connection turns out dead (the daemon or an intermediary closed it while idle), the request is transparently retried ONCE on a fresh connection; a deadline expiry (TransportTimeoutError) is never retried. The cached connection is closed when the session ends.

Sessions make the instance stateful: do not share one DockerClient instance across threads while a session is active (copies made while a session is active do not inherit it and stay independent). The client must outlive the Session — the guard holds a reference.

Constructor & Destructor Documentation

◆ Session() [1/2]

testcontainers::DockerClient::Session::Session ( DockerClient & client)
inlineexplicitnodiscard

◆ ~Session()

testcontainers::DockerClient::Session::~Session ( )
inline

◆ Session() [2/2]

testcontainers::DockerClient::Session::Session ( const Session & )
delete

Member Function Documentation

◆ operator=()

Session & testcontainers::DockerClient::Session::operator= ( const Session & )
delete