fix(tvix/store): Immediately return an error when using sled on /

We already do this for redb and for sled in SledDirectoryService.

Change-Id: I34c7178257a6a04e9f12ed4037a4ef585d7b0d54
Reviewed-on: https://cl.tvl.fyi/c/depot/+/12060
Tested-by: BuildkiteCI
Reviewed-by: flokli <flokli@flokli.de>
Autosubmit: Ilan Joselevich <personal@ilanjoselevich.com>
This commit is contained in:
Ilan Joselevich 2024-07-29 18:12:05 +03:00 committed by clbot
parent 47a8baf178
commit 3f6cd7aebc

View file

@ -21,6 +21,12 @@ pub struct SledPathInfoService {
impl SledPathInfoService {
pub fn new<P: AsRef<Path>>(p: P) -> Result<Self, sled::Error> {
if p.as_ref() == Path::new("/") {
return Err(sled::Error::Unsupported(
"cowardly refusing to open / with sled".to_string(),
));
}
let config = sled::Config::default()
.use_compression(false) // is a required parameter
.path(p);