datastore: use new ProcessLocker
To make sure only one process runs garbage collection while having active writers.
This commit is contained in:
@ -175,6 +175,7 @@ impl IndexFile for FixedIndexReader {
|
||||
|
||||
pub struct FixedIndexWriter {
|
||||
store: Arc<ChunkStore>,
|
||||
_lock: tools::ProcessLockSharedGuard,
|
||||
filename: PathBuf,
|
||||
tmp_filename: PathBuf,
|
||||
chunk_size: usize,
|
||||
@ -204,6 +205,8 @@ impl FixedIndexWriter {
|
||||
|
||||
pub fn create(store: Arc<ChunkStore>, path: &Path, size: usize, chunk_size: usize) -> Result<Self, Error> {
|
||||
|
||||
let shared_lock = store.try_shared_lock()?;
|
||||
|
||||
let full_path = store.relative_path(path);
|
||||
let mut tmp_path = full_path.clone();
|
||||
tmp_path.set_extension("tmp_fidx");
|
||||
@ -250,6 +253,7 @@ impl FixedIndexWriter {
|
||||
|
||||
Ok(Self {
|
||||
store,
|
||||
_lock: shared_lock,
|
||||
filename: full_path,
|
||||
tmp_filename: tmp_path,
|
||||
chunk_size,
|
||||
|
Reference in New Issue
Block a user