Random instance selection (#136)

* wip

* revert some'

* revert more

* poor-man's integration test

* remove test

* fmt

* --workspace

* fix build

* fix integration test

* another stab

* log

* run after integration

* cargo test after integration

* revert

* revert more

* Refactor + clean up

* more clean up
This commit is contained in:
Mostafa Abdelraouf
2022-08-22 00:15:20 -05:00
committed by GitHub
parent 5948fef6cf
commit 5f5b5e2543
3 changed files with 46 additions and 83 deletions

View File

@@ -63,7 +63,7 @@ pub struct Address {
pub shard: usize,
pub database: String,
pub role: Role,
pub replica_number: usize,
pub instance_index: usize,
pub username: String,
pub poolname: String,
}
@@ -75,7 +75,7 @@ impl Default for Address {
host: String::from("127.0.0.1"),
port: String::from("5432"),
shard: 0,
replica_number: 0,
instance_index: 0,
database: String::from("database"),
role: Role::Replica,
username: String::from("username"),
@@ -92,7 +92,7 @@ impl Address {
Role::Replica => format!(
"{}_shard_{}_replica_{}",
self.poolname, self.shard, self.replica_number
self.poolname, self.shard, self.instance_index
),
}
}