mirror of
https://github.com/postgresml/pgcat.git
synced 2026-03-24 17:56:29 +00:00
Refactor query routing into its own module (#22)
* Refactor query routing into its own module * commments; tests; dead code * error message * safer startup * hm * dont have to be public * wow * fix ci * ok * nl * no more silent errors
This commit is contained in:
13
src/main.rs
13
src/main.rs
@@ -25,7 +25,6 @@ extern crate statsd;
|
||||
extern crate tokio;
|
||||
extern crate toml;
|
||||
|
||||
use regex::Regex;
|
||||
use tokio::net::TcpListener;
|
||||
use tokio::signal;
|
||||
|
||||
@@ -39,6 +38,7 @@ mod constants;
|
||||
mod errors;
|
||||
mod messages;
|
||||
mod pool;
|
||||
mod query_router;
|
||||
mod server;
|
||||
mod sharding;
|
||||
mod stats;
|
||||
@@ -54,12 +54,11 @@ use stats::{Collector, Reporter};
|
||||
async fn main() {
|
||||
println!("> Welcome to PgCat! Meow.");
|
||||
|
||||
client::SHARDING_REGEX_RE
|
||||
.set(Regex::new(client::SHARDING_REGEX).unwrap())
|
||||
.unwrap();
|
||||
client::ROLE_REGEX_RE
|
||||
.set(Regex::new(client::ROLE_REGEX).unwrap())
|
||||
.unwrap();
|
||||
// Prepare regexes
|
||||
if !query_router::QueryRouter::setup() {
|
||||
println!("> Could not setup query router.");
|
||||
return;
|
||||
}
|
||||
|
||||
let config = match config::parse("pgcat.toml").await {
|
||||
Ok(config) => config,
|
||||
|
||||
Reference in New Issue
Block a user