Skip to main content

Module pool

Module pool 

Source
Expand description

docbox-database re-exports

§Database Pool

This is the docbox solution for managing multiple database connections and connection pools for each tenant and the root database itself.

Pools are held in a cache with an expiry time to ensure they don’t hog too many database connections.

Database pools and credentials are stored in a Tiny LFU cache these caches can be flushed using DatabasePoolCache::flush

§Environment Variables

  • DOCBOX_DB_HOST - Database host
  • DOCBOX_DB_PORT - Database port
  • DOCBOX_DB_CREDENTIAL_NAME - Secrets manager name for the root database secret
  • DOCBOX_DB_ROOT_IAM - Whether to use IAM to authenticate the root database
  • DOCBOX_DB_MAX_CONNECTIONS - Max connections each tenant pool can contain
  • DOCBOX_DB_MAX_ROOT_CONNECTIONS - Max connections the root “docbox” pool can contain
  • DOCBOX_DB_ACQUIRE_TIMEOUT - Timeout before acquiring a connection fails
  • DOCBOX_DB_POOL_TIMEOUT - Maximum time a connection can live in the cache for
  • DOCBOX_DB_IDLE_TIMEOUT - Timeout before a idle connection is closed to save resources
  • DOCBOX_DB_CACHE_DURATION - Duration pools can remain in the cache for untouched before they are closed and removed
  • DOCBOX_DB_CACHE_CAPACITY - Maximum database pools to hold at once
  • DOCBOX_DB_CREDENTIALS_CACHE_DURATION - Duration database credentials should be cached for
  • DOCBOX_DB_CREDENTIALS_CACHE_CAPACITY - Maximum database credentials to cache

Structs§

DatabasePoolCache
Cache for database pools
DatabasePoolCacheConfig
Config for the database pool
DbSecrets
Username and password for a specific database

Enums§

DatabasePoolCacheConfigError
DbConnectErr