2
0
Fork 0
mirror of https://git.asonix.dog/asonix/pict-rs synced 2024-12-22 11:21:24 +00:00

Attempt to mark unmarked variants as accessed on launch

This commit is contained in:
asonix 2023-07-22 19:55:50 -05:00
parent fe1f7c869f
commit 1f3298363f
2 changed files with 26 additions and 1 deletions

View file

@ -1692,6 +1692,9 @@ impl PictRsConfiguration {
sled_repo sled_repo
.requeue_in_progress(config.server.worker_id.as_bytes().to_vec()) .requeue_in_progress(config.server.worker_id.as_bytes().to_vec())
.await?; .await?;
sled_repo
.mark_accessed::<<FileStore as Store>::Identifier>()
.await?;
launch_file_store(sled_repo, store, client, config, sled_extra_config) launch_file_store(sled_repo, store, client, config, sled_extra_config)
.await?; .await?;
@ -1734,6 +1737,9 @@ impl PictRsConfiguration {
sled_repo sled_repo
.requeue_in_progress(config.server.worker_id.as_bytes().to_vec()) .requeue_in_progress(config.server.worker_id.as_bytes().to_vec())
.await?; .await?;
sled_repo
.mark_accessed::<<ObjectStore as Store>::Identifier>()
.await?;
launch_object_store(sled_repo, store, client, config, sled_extra_config) launch_object_store(sled_repo, store, client, config, sled_extra_config)
.await?; .await?;

View file

@ -133,7 +133,26 @@ impl SledRepo {
Ok(db) Ok(db)
} }
#[tracing::instrument(level = "warn")] #[tracing::instrument(level = "debug", skip_all)]
pub(crate) async fn mark_accessed<I: Identifier + 'static>(&self) -> Result<(), StoreError> {
use futures_util::StreamExt;
let mut stream = self.hashes().await;
while let Some(res) = stream.next().await {
let hash = res?;
for (variant, _) in self.variants::<I>(hash.clone()).await? {
if !self.contains_variant(hash.clone(), variant.clone()).await? {
VariantAccessRepo::accessed(self, hash.clone(), variant).await?;
}
}
}
Ok(())
}
#[tracing::instrument(level = "warn", skip_all)]
pub(crate) async fn export(&self) -> Result<(), RepoError> { pub(crate) async fn export(&self) -> Result<(), RepoError> {
let path = self let path = self
.export_path .export_path