aboutsummaryrefslogtreecommitdiff
path: root/src/server.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-10 23:11:52 +0200
committerAlex Auvolat <alex@adnab.me>2020-04-10 23:11:52 +0200
commitcf8fd948fc4bb6a9f48100ebf89df3752371805d (patch)
tree77fcb45f80ab75da2e5cdf520a50ab7192f9e25c /src/server.rs
parentff4fb9756810abeff17c360f3055c3865160b240 (diff)
downloadgarage-cf8fd948fc4bb6a9f48100ebf89df3752371805d.tar.gz
garage-cf8fd948fc4bb6a9f48100ebf89df3752371805d.zip
Add block ref table
Diffstat (limited to 'src/server.rs')
-rw-r--r--src/server.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/server.rs b/src/server.rs
index 3df6ca59..b62c18cc 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -24,6 +24,7 @@ pub struct Garage {
pub object_table: Arc<Table<ObjectTable>>,
pub version_table: Arc<Table<VersionTable>>,
+ pub block_ref_table: Arc<Table<BlockRefTable>>,
}
impl Garage {
@@ -55,6 +56,15 @@ impl Garage {
"version".to_string(),
meta_rep_param.clone(),
));
+ let block_ref_table = Arc::new(Table::new(
+ BlockRefTable {
+ garage: RwLock::new(None),
+ },
+ system.clone(),
+ &db,
+ "block_ref".to_string(),
+ meta_rep_param.clone(),
+ ));
let mut garage = Self {
db,
@@ -63,6 +73,7 @@ impl Garage {
table_rpc_handlers: HashMap::new(),
object_table,
version_table,
+ block_ref_table,
};
garage.table_rpc_handlers.insert(
@@ -73,11 +84,16 @@ impl Garage {
garage.version_table.name.clone(),
garage.version_table.clone().rpc_handler(),
);
+ garage.table_rpc_handlers.insert(
+ garage.block_ref_table.name.clone(),
+ garage.block_ref_table.clone().rpc_handler(),
+ );
let garage = Arc::new(garage);
*garage.object_table.instance.garage.write().await = Some(garage.clone());
*garage.version_table.instance.garage.write().await = Some(garage.clone());
+ *garage.block_ref_table.instance.garage.write().await = Some(garage.clone());
garage
}