Skip to content

Commit 99f0d12

Browse files
committed
Support default namespace on RocksDB
1 parent 4b37563 commit 99f0d12

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

linera-client/src/storage.rs

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ example service:tcp:127.0.0.1:7878:table_do_my_test"
268268
namespace,
269269
});
270270
}
271-
if parts.len() == 3 {
271+
if parts.len() == 2 || parts.len() == 3 {
272272
let path = parts[0].to_string().into();
273273
let spawn_mode = match parts[1] {
274274
"spawn_blocking" => Ok(RocksDbSpawnMode::SpawnBlocking),
@@ -279,14 +279,20 @@ example service:tcp:127.0.0.1:7878:table_do_my_test"
279279
parts[1]
280280
))),
281281
}?;
282-
let namespace = parts[2].to_string();
282+
let namespace = if parts.len() == 2 {
283+
DEFAULT_NAMESPACE.to_string()
284+
} else {
285+
parts[2].to_string()
286+
};
283287
let storage_config = StorageConfig::RocksDb { path, spawn_mode };
284288
return Ok(StorageConfigNamespace {
285289
storage_config,
286290
namespace,
287291
});
288292
}
289-
return Err(Error::Format("We should have one or three parts".into()));
293+
return Err(Error::Format(
294+
"We should have one, two or three parts".into(),
295+
));
290296
}
291297
#[cfg(feature = "dynamodb")]
292298
if let Some(s) = input.strip_prefix(DYNAMO_DB) {

0 commit comments

Comments
 (0)