mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-10-26 02:48:35 -04:00
fixes, abolish underscores, folder restructure
This commit is contained in:
1 parent
ef9a7e31f0
commit
3c75f864c5
13 files changed
+56
-34
No files matched your search
Vendored
+1
@@ -3,6 +3,7 @@
|
||||
"creationdate",
|
||||
"ipfs",
|
||||
"Keepsafe",
|
||||
"pathctx",
|
||||
"quicktime",
|
||||
"repr",
|
||||
"tailwindcss"
|
||||
|
||||
Generated
+1
-1
@@ -5768,7 +5768,7 @@ checksum = "be91bcc43e73799dc46a6c194a55e7aae1d86cc867c860fd4a436019af21bd8c"
|
||||
[[package]]
|
||||
name = "prisma-client-rust"
|
||||
version = "0.3.1"
|
||||
source = "git+https://github.com/Brendonovich/prisma-client-rust.git?rev=eb7a7804518f68933ce313ae6226b882b22b81f8#eb7a7804518f68933ce313ae6226b882b22b81f8"
|
||||
source = "git+https://github.com/Brendonovich/prisma-client-rust.git?rev=3f742cc4fb4df9a77c6311d43183d5082cf32510#3f742cc4fb4df9a77c6311d43183d5082cf32510"
|
||||
dependencies = [
|
||||
"chrono",
|
||||
"datamodel",
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
pub mod metadata;
|
||||
pub mod thumb;
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -1,7 +1,8 @@
|
||||
use std::path::Path;
|
||||
|
||||
use crate::{
|
||||
file::{thumb::THUMBNAIL_CACHE_DIR_NAME, DirectoryWithContents, FileError, FilePath},
|
||||
encode::thumb::THUMBNAIL_CACHE_DIR_NAME,
|
||||
file::{DirectoryWithContents, FileError, FilePath},
|
||||
prisma,
|
||||
state::client,
|
||||
sys::locations::get_location,
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
use crate::job::{
|
||||
jobs::{Job, JobReportUpdate},
|
||||
worker::WorkerContext,
|
||||
};
|
||||
use anyhow::Result;
|
||||
|
||||
use self::scan::ScanProgress;
|
||||
pub mod pathctx;
|
||||
pub mod scan;
|
||||
|
||||
pub use {pathctx::PathContext, scan::scan_path};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct IndexerJob {
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl Job for IndexerJob {
|
||||
async fn run(&self, ctx: WorkerContext) -> Result<()> {
|
||||
let core_ctx = ctx.core_ctx.clone();
|
||||
scan_path(&core_ctx, self.path.as_str(), move |p| {
|
||||
ctx.progress(
|
||||
p.iter()
|
||||
.map(|p| match p.clone() {
|
||||
ScanProgress::ChunkCount(c) => JobReportUpdate::TaskCount(c),
|
||||
ScanProgress::SavedChunks(p) => JobReportUpdate::CompletedTaskCount(p),
|
||||
ScanProgress::Message(m) => JobReportUpdate::Message(m),
|
||||
})
|
||||
.collect(),
|
||||
)
|
||||
})
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
// PathContext provides the indexer with instruction to handle particular directory structures and identify rich context.
|
||||
pub struct PathContext {
|
||||
// an app specific key "com.github.repo"
|
||||
pub key: String,
|
||||
pub name: String,
|
||||
pub is_dir: bool,
|
||||
// possible file extensions for this path
|
||||
pub extensions: Vec<String>,
|
||||
// sub-paths that must be found
|
||||
pub must_contain_sub_paths: Vec<String>,
|
||||
// sub-paths that are ignored
|
||||
pub always_ignored_sub_paths: Option<String>,
|
||||
}
|
||||
@@ -1,7 +1,5 @@
|
||||
use crate::job::jobs::JobReportUpdate;
|
||||
use crate::job::{jobs::Job, worker::WorkerContext};
|
||||
use crate::file::cas::checksum::partial_checksum;
|
||||
use crate::sys::locations::{create_location, LocationResource};
|
||||
|
||||
use crate::CoreContext;
|
||||
use anyhow::{anyhow, Result};
|
||||
use chrono::{DateTime, SecondsFormat, Utc};
|
||||
@@ -10,33 +8,6 @@ use std::ffi::OsStr;
|
||||
use std::{collections::HashMap, fs, path::Path, path::PathBuf, time::Instant};
|
||||
use walkdir::{DirEntry, WalkDir};
|
||||
|
||||
use super::cas::checksum::partial_checksum;
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct IndexerJob {
|
||||
pub path: String,
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl Job for IndexerJob {
|
||||
async fn run(&self, ctx: WorkerContext) -> Result<()> {
|
||||
let core_ctx = ctx.core_ctx.clone();
|
||||
scan_path(&core_ctx, self.path.as_str(), move |p| {
|
||||
ctx.progress(
|
||||
p.iter()
|
||||
.map(|p| match p.clone() {
|
||||
ScanProgress::ChunkCount(c) => JobReportUpdate::TaskCount(c),
|
||||
ScanProgress::SavedChunks(p) => JobReportUpdate::CompletedTaskCount(p),
|
||||
ScanProgress::Message(m) => JobReportUpdate::Message(m),
|
||||
})
|
||||
.collect(),
|
||||
)
|
||||
})
|
||||
.await?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
pub enum ScanProgress {
|
||||
ChunkCount(usize),
|
||||
@@ -11,7 +11,6 @@ use crate::{
|
||||
pub mod cas;
|
||||
pub mod explorer;
|
||||
pub mod indexer;
|
||||
pub mod thumb;
|
||||
pub mod watcher;
|
||||
|
||||
// A unique file
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ use tokio::sync::{
|
||||
};
|
||||
use ts_rs::TS;
|
||||
|
||||
use crate::file::thumb::ThumbnailJob;
|
||||
use crate::encode::thumb::ThumbnailJob;
|
||||
|
||||
// init modules
|
||||
pub mod client;
|
||||
|
||||
File renamed without changes.
Reference in new issue
Block a user