mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-23 18:45:06 +08:00
feat: Expose the sled compression setting
This commit is contained in:
parent
349f0f7068
commit
2e79b2a871
@ -28,5 +28,9 @@ rev = "40b3d48"
|
|||||||
git = "https://github.com/Kerollmops/fst.git"
|
git = "https://github.com/Kerollmops/fst.git"
|
||||||
branch = "arc-byte-slice"
|
branch = "arc-byte-slice"
|
||||||
|
|
||||||
|
[features]
|
||||||
|
default = []
|
||||||
|
compression = ["sled/compression"]
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
tempfile = "3.0.7"
|
tempfile = "3.0.7"
|
||||||
|
@ -41,6 +41,18 @@ impl Database {
|
|||||||
Ok(Database { cache, inner })
|
Ok(Database { cache, inner })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn start_with_compression<P: AsRef<Path>>(path: P, factor: i32) -> Result<Database, Error> {
|
||||||
|
let config = sled::ConfigBuilder::default()
|
||||||
|
.use_compression(true)
|
||||||
|
.compression_factor(factor)
|
||||||
|
.path(path)
|
||||||
|
.build();
|
||||||
|
|
||||||
|
let cache = RwLock::new(HashMap::new());
|
||||||
|
let inner = sled::Db::start(config)?;
|
||||||
|
Ok(Database { cache, inner })
|
||||||
|
}
|
||||||
|
|
||||||
pub fn indexes(&self) -> Result<Option<HashSet<String>>, Error> {
|
pub fn indexes(&self) -> Result<Option<HashSet<String>>, Error> {
|
||||||
let bytes = match self.inner.get("indexes")? {
|
let bytes = match self.inner.get("indexes")? {
|
||||||
Some(bytes) => bytes,
|
Some(bytes) => bytes,
|
||||||
|
Loading…
Reference in New Issue
Block a user