mirror of
https://codeberg.org/icewind/haze.git
synced 2026-06-03 09:04:12 +02:00
sharding
This commit is contained in:
parent
ce0d3ff3e4
commit
fdbc6f2e46
1 changed files with 17 additions and 7 deletions
|
|
@ -15,7 +15,7 @@ use std::convert::identity;
|
|||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct Sharding;
|
||||
|
||||
const SHARDS: &[&str] = &["-1", "-2"];
|
||||
const SHARDS: &[&str] = &["-1", "-2", "-3", "-4"];
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl ServiceTrait for Sharding {
|
||||
|
|
@ -73,25 +73,35 @@ impl ServiceTrait for Sharding {
|
|||
"table": "filecache",
|
||||
"primary_key": "fileid",
|
||||
"shard_key": "storage",
|
||||
"companion_tables": ["filecache_extended"],
|
||||
"companion_tables": ["filecache_extended", "files_metadata"],
|
||||
"shards": [
|
||||
{
|
||||
"name": "haze",
|
||||
"dbname": "haze",
|
||||
"host": "db-1",
|
||||
"tableprefix": "oc_",
|
||||
"user": "haze",
|
||||
"password": "haze",
|
||||
},
|
||||
{
|
||||
"name": "haze",
|
||||
"dbname": "haze",
|
||||
"host": "db-2",
|
||||
"tableprefix": "oc_",
|
||||
"user": "haze",
|
||||
"password": "haze",
|
||||
},
|
||||
{
|
||||
"dbname": "haze",
|
||||
"host": "db-3",
|
||||
"user": "haze",
|
||||
"password": "haze",
|
||||
},
|
||||
{
|
||||
"dbname": "haze",
|
||||
"host": "db-4",
|
||||
"user": "haze",
|
||||
"password": "haze",
|
||||
}
|
||||
],
|
||||
}
|
||||
});
|
||||
Ok(hashmap! {String::from("db.sharding") => shard_config})
|
||||
Ok(hashmap! {String::from("dbsharding") => shard_config})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue