mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-26 18:36:28 +00:00
Automatic sharding: part one of many (#194)
Starting automatic sharding
This commit is contained in:
@@ -267,6 +267,10 @@ pub struct Pool {
|
||||
pub connect_timeout: Option<u64>,
|
||||
|
||||
pub sharding_function: ShardingFunction,
|
||||
|
||||
#[serde(default = "Pool::default_automatic_sharding_key")]
|
||||
pub automatic_sharding_key: Option<String>,
|
||||
|
||||
pub shards: BTreeMap<String, Shard>,
|
||||
pub users: BTreeMap<String, User>,
|
||||
}
|
||||
@@ -276,6 +280,10 @@ impl Pool {
|
||||
PoolMode::Transaction
|
||||
}
|
||||
|
||||
pub fn default_automatic_sharding_key() -> Option<String> {
|
||||
None
|
||||
}
|
||||
|
||||
pub fn validate(&self) -> Result<(), Error> {
|
||||
match self.default_role.as_ref() {
|
||||
"any" => (),
|
||||
@@ -318,6 +326,7 @@ impl Default for Pool {
|
||||
query_parser_enabled: false,
|
||||
primary_reads_enabled: false,
|
||||
sharding_function: ShardingFunction::PgBigintHash,
|
||||
automatic_sharding_key: None,
|
||||
connect_timeout: None,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user