pub struct DatabasePoolCacheConfig {
pub host: String,
pub port: u16,
pub root_secret_name: Option<String>,
pub root_iam: bool,
pub max_connections: Option<u32>,
pub max_connections_root: Option<u32>,
pub acquire_timeout: Option<u64>,
pub idle_timeout: Option<u64>,
pub cache_duration: Option<u64>,
pub cache_capacity: Option<u64>,
pub credentials_cache_duration: Option<u64>,
pub credentials_cache_capacity: Option<u64>,
}Expand description
Config for the database pool
Fields§
§host: StringDatabase host
port: u16Database port
root_secret_name: Option<String>Name of the secrets manager secret to use when connecting to the root “docbox” database if using secret based authentication
root_iam: boolWhether to use IAM authentication to connect to the root database instead of secrets
max_connections: Option<u32>Max number of active connections per tenant database pool
This is the maximum number of connections that should be allocated for performing all queries against each specific tenant.
Ensure a reasonable amount of connections are allocated but make
sure that the max_connections * your number of tenants stays
within the limits for your database
Default: 10
max_connections_root: Option<u32>Max number of active connections per “docbox” database pool
This is the maximum number of connections that should be allocated for performing queries like:
- Listing tenants
- Getting tenant details
These pools are often short lived and complete their queries very fast and thus don’t need a huge amount of resources allocated to them
Default: 2
acquire_timeout: Option<u64>Timeout before a acquiring a database connection is considered a failure
Default: 60s
idle_timeout: Option<u64>If a connection has been idle for this duration the connection will be closed and released back to the database for other consumers
Default: 10min
cache_duration: Option<u64>Duration in seconds idle database pools are allowed to be cached before they are closed
Default: 48h
cache_capacity: Option<u64>Maximum database pools to maintain in the cache at once. If the cache capacity is exceeded old pools will be closed and removed from the cache
This capacity should be aligned with your expected number of
tenants along with your max_connections to ensure your database
has enough connections to accommodate all tenants.
Default: 50
credentials_cache_duration: Option<u64>Duration in seconds database credentials (host, port, password, ..etc) are allowed to be cached before they are refresh from the secrets manager
Default: 12h
credentials_cache_capacity: Option<u64>Maximum database credentials to maintain in the cache at once. If the cache capacity is exceeded old credentials will be removed from the cache
Default: 50
Implementations§
Trait Implementations§
Source§impl Clone for DatabasePoolCacheConfig
impl Clone for DatabasePoolCacheConfig
Source§fn clone(&self) -> DatabasePoolCacheConfig
fn clone(&self) -> DatabasePoolCacheConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for DatabasePoolCacheConfig
impl Debug for DatabasePoolCacheConfig
Source§impl Default for DatabasePoolCacheConfig
impl Default for DatabasePoolCacheConfig
Source§impl<'de> Deserialize<'de> for DatabasePoolCacheConfig
impl<'de> Deserialize<'de> for DatabasePoolCacheConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for DatabasePoolCacheConfig
impl RefUnwindSafe for DatabasePoolCacheConfig
impl Send for DatabasePoolCacheConfig
impl Sync for DatabasePoolCacheConfig
impl Unpin for DatabasePoolCacheConfig
impl UnwindSafe for DatabasePoolCacheConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more