Skip to content

Latest commit

 

History

History
82 lines (46 loc) · 4.77 KB

File metadata and controls

82 lines (46 loc) · 4.77 KB
graph LR
    aiomysql_pool_Pool["aiomysql.pool.Pool"]
    aiomysql_pool_create_pool["aiomysql.pool.create_pool"]
    aiomysql_pool_acquire["aiomysql.pool.acquire"]
    aiomysql_pool_release["aiomysql.pool.release"]
    aiomysql_pool_close["aiomysql.pool.close"]
    aiomysql_pool__fill_free_pool["aiomysql.pool._fill_free_pool"]
    aiomysql_pool_create_pool -- "instantiates and returns" --> aiomysql_pool_Pool
    aiomysql_pool_Pool -- "manages operations of" --> aiomysql_pool_acquire
    aiomysql_pool_Pool -- "manages operations of" --> aiomysql_pool_release
    aiomysql_pool_acquire -- "requests connections from" --> aiomysql_pool_Pool
    aiomysql_pool_acquire -- "may trigger" --> aiomysql_pool__fill_free_pool
    aiomysql_pool__fill_free_pool -- "ensures connections for" --> aiomysql_pool_acquire
    aiomysql_pool_release -- "returns connections to" --> aiomysql_pool_Pool
    aiomysql_pool_Pool -- "orchestrates shutdown via" --> aiomysql_pool_close
    aiomysql_pool_close -- "shuts down" --> aiomysql_pool_Pool
Loading

CodeBoardingDemoContact

Details

The aiomysql.pool subsystem provides robust asynchronous database connection pooling. At its core, the Pool component efficiently manages a collection of aiomysql connections, optimizing resource utilization and handling concurrent access. The create_pool function serves as the entry point for pool initialization. Clients interact with the pool by calling acquire to retrieve a connection and release to return it, facilitating connection reuse. An internal _fill_free_pool mechanism proactively maintains the desired number of available connections. The subsystem ensures proper resource cleanup through the close function, which gracefully shuts down the entire pool. This design promotes efficient, scalable, and reliable database interactions within asynchronous applications.

aiomysql.pool.Pool

The core component responsible for managing the lifecycle, availability, and limits of aiomysql connections. It orchestrates connection reuse, handles concurrent access, and maintains the pool of free and used connections.

Related Classes/Methods:

aiomysql.pool.create_pool

A factory function that initializes and returns a new Pool instance. It abstracts the pool creation process, allowing users to configure pool parameters without direct Pool class instantiation.

Related Classes/Methods:

aiomysql.pool.acquire

Provides the asynchronous interface for users to obtain an available database connection from the pool. It manages waiting for connections if none are immediately available and ensures proper connection handover.

Related Classes/Methods:

aiomysql.pool.release

Returns a previously acquired database connection back to the pool, making it available for reuse. It ensures the connection is properly returned and its state is reset if necessary.

Related Classes/Methods:

aiomysql.pool.close

Initiates the graceful asynchronous shutdown of the connection pool. It ensures all managed connections are properly closed and resources are released.

Related Classes/Methods:

aiomysql.pool._fill_free_pool

An internal mechanism to proactively create and add new connections to the pool. It ensures the pool maintains a minimum number of available connections and adheres to configured size limits.

Related Classes/Methods: