mirror of
https://github.com/meilisearch/meilisearch.git
synced 2024-11-30 00:55:00 +08:00
Apply Rustfmt
This commit is contained in:
parent
b4a73f2d74
commit
aa03e02fdc
@ -66,7 +66,11 @@ impl IndexMapper {
|
|||||||
|
|
||||||
/// Create or open an index in the specified path.
|
/// Create or open an index in the specified path.
|
||||||
/// The path *must* exists or an error will be thrown.
|
/// The path *must* exists or an error will be thrown.
|
||||||
fn create_or_open_index(&self, path: &Path, date: Option<(time::OffsetDateTime, time::OffsetDateTime)>) -> Result<Index> {
|
fn create_or_open_index(
|
||||||
|
&self,
|
||||||
|
path: &Path,
|
||||||
|
date: Option<(time::OffsetDateTime, time::OffsetDateTime)>,
|
||||||
|
) -> Result<Index> {
|
||||||
let mut options = EnvOpenOptions::new();
|
let mut options = EnvOpenOptions::new();
|
||||||
options.map_size(clamp_to_page_size(self.index_size));
|
options.map_size(clamp_to_page_size(self.index_size));
|
||||||
options.max_readers(1024);
|
options.max_readers(1024);
|
||||||
@ -80,7 +84,12 @@ impl IndexMapper {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Get or create the index.
|
/// Get or create the index.
|
||||||
pub fn create_index(&self, mut wtxn: RwTxn, name: &str, date: Option<(time::OffsetDateTime, time::OffsetDateTime)>) -> Result<Index> {
|
pub fn create_index(
|
||||||
|
&self,
|
||||||
|
mut wtxn: RwTxn,
|
||||||
|
name: &str,
|
||||||
|
date: Option<(time::OffsetDateTime, time::OffsetDateTime)>,
|
||||||
|
) -> Result<Index> {
|
||||||
match self.index(&wtxn, name) {
|
match self.index(&wtxn, name) {
|
||||||
Ok(index) => {
|
Ok(index) => {
|
||||||
wtxn.commit()?;
|
wtxn.commit()?;
|
||||||
|
@ -867,7 +867,7 @@ impl IndexScheduler {
|
|||||||
/// Create a new index without any associated task.
|
/// Create a new index without any associated task.
|
||||||
pub fn create_raw_index(&self, name: &str) -> Result<Index> {
|
pub fn create_raw_index(&self, name: &str) -> Result<Index> {
|
||||||
let wtxn = self.env.write_txn()?;
|
let wtxn = self.env.write_txn()?;
|
||||||
let date = Some(( time::OffsetDateTime::now_utc(), time::OffsetDateTime::now_utc() ));
|
let date = Some((time::OffsetDateTime::now_utc(), time::OffsetDateTime::now_utc()));
|
||||||
let index = self.index_mapper.create_index(wtxn, name, date)?;
|
let index = self.index_mapper.create_index(wtxn, name, date)?;
|
||||||
|
|
||||||
Ok(index)
|
Ok(index)
|
||||||
|
Loading…
Reference in New Issue
Block a user