aboutsummaryrefslogtreecommitdiff
path: root/src/server.rs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2020-04-11 23:00:26 +0200
committerAlex Auvolat <alex@adnab.me>2020-04-11 23:00:26 +0200
commit5dd59e437d5af84dfa2cf5dcc2c15807b971002d (patch)
tree2debd795082e810e384f765f84217d47cd158ba3 /src/server.rs
parentdcf58499a4f529e1033de65b4fca8d45458d60d2 (diff)
downloadgarage-5dd59e437d5af84dfa2cf5dcc2c15807b971002d.tar.gz
garage-5dd59e437d5af84dfa2cf5dcc2c15807b971002d.zip
Local refcounting of blocks
Diffstat (limited to 'src/server.rs')
-rw-r--r--src/server.rs11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/server.rs b/src/server.rs
index e1f6dc80..8b2bd0c3 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -1,4 +1,4 @@
-use futures_util::future::FutureExt;
+pub use futures_util::future::FutureExt;
use serde::Deserialize;
use std::collections::HashMap;
use std::io::{Read, Write};
@@ -6,11 +6,12 @@ use std::net::SocketAddr;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::sync::watch;
-use tokio::sync::{Mutex, RwLock};
+use tokio::sync::RwLock;
use crate::api_server;
use crate::background::*;
use crate::data::*;
+use crate::block::*;
use crate::error::Error;
use crate::membership::System;
use crate::proto::*;
@@ -40,7 +41,7 @@ pub struct Config {
pub struct Garage {
pub db: sled::Db,
pub system: Arc<System>,
- pub fs_lock: Mutex<()>,
+ pub block_manager: BlockManager,
pub background: Arc<BackgroundRunner>,
pub table_rpc_handlers: HashMap<String, Box<dyn TableRpcHandler + Sync + Send>>,
@@ -57,6 +58,8 @@ impl Garage {
db: sled::Db,
background: Arc<BackgroundRunner>,
) -> Arc<Self> {
+ let block_manager = BlockManager::new(&db, config.data_dir.clone());
+
let system = Arc::new(System::new(config, id, background.clone()));
let meta_rep_param = TableReplicationParams {
@@ -105,7 +108,7 @@ impl Garage {
let mut garage = Self {
db,
system: system.clone(),
- fs_lock: Mutex::new(()),
+ block_manager,
background,
table_rpc_handlers: HashMap::new(),
object_table,