aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/api/admin/cluster.rs2
-rw-r--r--src/db/lib.rs5
-rw-r--r--src/db/lmdb_adapter.rs4
-rw-r--r--src/db/sled_adapter.rs4
-rw-r--r--src/db/sqlite_adapter.rs4
-rw-r--r--src/garage/admin.rs1
6 files changed, 20 insertions, 0 deletions
diff --git a/src/api/admin/cluster.rs b/src/api/admin/cluster.rs
index 6d01317d..4b7716a3 100644
--- a/src/api/admin/cluster.rs
+++ b/src/api/admin/cluster.rs
@@ -19,6 +19,7 @@ pub async fn handle_get_cluster_status(garage: &Arc<Garage>) -> Result<Response<
let res = GetClusterStatusResponse {
node: hex::encode(garage.system.id),
garage_version: garage.system.garage_version(),
+ db_engine: garage.db.engine(),
known_nodes: garage
.system
.get_known_nodes()
@@ -98,6 +99,7 @@ fn get_cluster_layout(garage: &Arc<Garage>) -> GetClusterLayoutResponse {
struct GetClusterStatusResponse {
node: String,
garage_version: &'static str,
+ db_engine: String,
known_nodes: HashMap<String, KnownNodeResp>,
layout: GetClusterLayoutResponse,
}
diff --git a/src/db/lib.rs b/src/db/lib.rs
index 9fae7cc9..e9d3ea18 100644
--- a/src/db/lib.rs
+++ b/src/db/lib.rs
@@ -63,6 +63,10 @@ pub fn unabort<R, E>(res: TxResult<R, E>) -> TxOpResult<std::result::Result<R, E
// ----
impl Db {
+ pub fn engine(&self) -> String {
+ self.0.engine()
+ }
+
pub fn open_tree<S: AsRef<str>>(&self, name: S) -> Result<Tree> {
let tree_id = self.0.open_tree(name.as_ref())?;
Ok(Tree(self.0.clone(), tree_id))
@@ -298,6 +302,7 @@ impl<'a> Transaction<'a> {
// ---- Internal interfaces
pub(crate) trait IDb: Send + Sync {
+ fn engine(&self) -> String;
fn open_tree(&self, name: &str) -> Result<usize>;
fn list_trees(&self) -> Result<Vec<String>>;
diff --git a/src/db/lmdb_adapter.rs b/src/db/lmdb_adapter.rs
index 23b8c87e..74622919 100644
--- a/src/db/lmdb_adapter.rs
+++ b/src/db/lmdb_adapter.rs
@@ -57,6 +57,10 @@ impl LmdbDb {
}
impl IDb for LmdbDb {
+ fn engine(&self) -> String {
+ "LMDB (using Heed crate)".into()
+ }
+
fn open_tree(&self, name: &str) -> Result<usize> {
let mut trees = self.trees.write().unwrap();
if let Some(i) = trees.1.get(name) {
diff --git a/src/db/sled_adapter.rs b/src/db/sled_adapter.rs
index fb9353f0..982f8d82 100644
--- a/src/db/sled_adapter.rs
+++ b/src/db/sled_adapter.rs
@@ -58,6 +58,10 @@ impl SledDb {
}
impl IDb for SledDb {
+ fn engine(&self) -> String {
+ "Sled".into()
+ }
+
fn open_tree(&self, name: &str) -> Result<usize> {
let mut trees = self.trees.write().unwrap();
if let Some(i) = trees.1.get(name) {
diff --git a/src/db/sqlite_adapter.rs b/src/db/sqlite_adapter.rs
index 251dcafb..84883772 100644
--- a/src/db/sqlite_adapter.rs
+++ b/src/db/sqlite_adapter.rs
@@ -71,6 +71,10 @@ impl SqliteDbInner {
}
impl IDb for SqliteDb {
+ fn engine(&self) -> String {
+ "Sqlite3 (using rusqlite crate)".into()
+ }
+
fn open_tree(&self, name: &str) -> Result<usize> {
let name = format!("tree_{}", name.replace(':', "_COLON_"));
let mut this = self.0.lock().unwrap();
diff --git a/src/garage/admin.rs b/src/garage/admin.rs
index 3af8b046..c662aa00 100644
--- a/src/garage/admin.rs
+++ b/src/garage/admin.rs
@@ -672,6 +672,7 @@ impl AdminRpcHandler {
self.garage.system.garage_version(),
)
.unwrap();
+ writeln!(&mut ret, "\nDatabase engine: {}", self.garage.db.engine()).unwrap();
// Gather ring statistics
let ring = self.garage.system.ring.borrow().clone();