format code

This commit is contained in:
mpostma
2021-03-24 11:29:11 +01:00
parent 1f16c8d224
commit 4041d9dc48
18 changed files with 60 additions and 61 deletions

View File

@ -2,15 +2,15 @@ use std::io::SeekFrom;
use std::path::{Path, PathBuf};
use log::info;
use tokio::sync::mpsc;
use uuid::Uuid;
use oxidized_json_checker::JsonChecker;
use tokio::fs;
use tokio::io::{AsyncSeekExt, AsyncWriteExt};
use tokio::sync::mpsc;
use uuid::Uuid;
use super::{PayloadData, UpdateError, UpdateMsg, UpdateStoreStore, Result};
use super::{PayloadData, Result, UpdateError, UpdateMsg, UpdateStoreStore};
use crate::index_controller::index_actor::IndexActorHandle;
use crate::index_controller::{UpdateMeta, UpdateStatus, get_arc_ownership_blocking};
use crate::index_controller::{get_arc_ownership_blocking, UpdateMeta, UpdateStatus};
pub struct UpdateActor<D, S, I> {
path: PathBuf,

View File

@ -1,9 +1,9 @@
use std::path::PathBuf;
use tokio::sync::{mpsc, oneshot};
use uuid::Uuid;
use tokio::sync::{oneshot, mpsc};
use super::{Result, PayloadData, UpdateStatus, UpdateMeta};
use super::{PayloadData, Result, UpdateMeta, UpdateStatus};
pub enum UpdateMsg<D> {
Update {

View File

@ -1,7 +1,7 @@
mod actor;
mod store;
mod message;
mod handle_impl;
mod message;
mod store;
mod update_store;
use std::path::PathBuf;
@ -15,7 +15,7 @@ use crate::index_controller::{UpdateMeta, UpdateStatus};
use actor::UpdateActor;
use message::UpdateMsg;
use store::{UpdateStoreStore, MapUpdateStoreStore};
use store::{MapUpdateStoreStore, UpdateStoreStore};
pub use handle_impl::UpdateActorHandleImpl;
@ -51,5 +51,5 @@ pub trait UpdateActorHandle {
meta: UpdateMeta,
data: mpsc::Receiver<PayloadData<Self::Data>>,
uuid: Uuid,
) -> Result<UpdateStatus> ;
) -> Result<UpdateStatus>;
}

View File

@ -1,10 +1,10 @@
use std::fs::{remove_file, create_dir_all, copy};
use std::fs::{copy, create_dir_all, remove_file};
use std::path::{Path, PathBuf};
use std::sync::Arc;
use heed::types::{DecodeIgnore, OwnedType, SerdeJson};
use heed::{Database, Env, EnvOpenOptions, CompactionOption};
use parking_lot::{RwLock, Mutex};
use heed::{CompactionOption, Database, Env, EnvOpenOptions};
use parking_lot::{Mutex, RwLock};
use serde::{Deserialize, Serialize};
use std::fs::File;
use tokio::sync::mpsc;
@ -379,7 +379,12 @@ where
Ok(aborted_updates)
}
pub fn snapshot(&self, txn: &mut heed::RwTxn, path: impl AsRef<Path>, uuid: Uuid) -> anyhow::Result<()> {
pub fn snapshot(
&self,
txn: &mut heed::RwTxn,
path: impl AsRef<Path>,
uuid: Uuid,
) -> anyhow::Result<()> {
let update_path = path.as_ref().join("updates");
create_dir_all(&update_path)?;
@ -389,7 +394,8 @@ where
snapshot_path.push("data.mdb");
// create db snapshot
self.env.copy_to_path(&snapshot_path, CompactionOption::Enabled)?;
self.env
.copy_to_path(&snapshot_path, CompactionOption::Enabled)?;
let update_files_path = update_path.join("update_files");
create_dir_all(&update_files_path)?;