mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
.. [no ci]
This commit is contained in:
parent
a0d251ec8b
commit
8e2d56461d
7 changed files with 55 additions and 47 deletions
|
|
@ -7,6 +7,7 @@ use tracing::warn;
|
||||||
use yazi_config::TASKS;
|
use yazi_config::TASKS;
|
||||||
use yazi_shared::fs::{calculate_size, copy_with_progress, path_relative_to, Url};
|
use yazi_shared::fs::{calculate_size, copy_with_progress, path_relative_to, Url};
|
||||||
|
|
||||||
|
use super::{FileOp, FileOpDelete, FileOpLink, FileOpPaste, FileOpTrash};
|
||||||
use crate::TaskProg;
|
use crate::TaskProg;
|
||||||
|
|
||||||
pub struct File {
|
pub struct File {
|
||||||
|
|
@ -16,49 +17,6 @@ pub struct File {
|
||||||
prog: mpsc::UnboundedSender<TaskProg>,
|
prog: mpsc::UnboundedSender<TaskProg>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
pub enum FileOp {
|
|
||||||
Paste(FileOpPaste),
|
|
||||||
Link(FileOpLink),
|
|
||||||
Delete(FileOpDelete),
|
|
||||||
Trash(FileOpTrash),
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
|
||||||
pub struct FileOpPaste {
|
|
||||||
pub id: usize,
|
|
||||||
pub from: Url,
|
|
||||||
pub to: Url,
|
|
||||||
pub cut: bool,
|
|
||||||
pub follow: bool,
|
|
||||||
pub retry: u8,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
|
||||||
pub struct FileOpLink {
|
|
||||||
pub id: usize,
|
|
||||||
pub from: Url,
|
|
||||||
pub to: Url,
|
|
||||||
pub meta: Option<Metadata>,
|
|
||||||
pub resolve: bool,
|
|
||||||
pub relative: bool,
|
|
||||||
pub delete: bool,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
|
||||||
pub struct FileOpDelete {
|
|
||||||
pub id: usize,
|
|
||||||
pub target: Url,
|
|
||||||
pub length: u64,
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
|
||||||
pub struct FileOpTrash {
|
|
||||||
pub id: usize,
|
|
||||||
pub target: Url,
|
|
||||||
pub length: u64,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl File {
|
impl File {
|
||||||
pub fn new(prog: mpsc::UnboundedSender<TaskProg>) -> Self {
|
pub fn new(prog: mpsc::UnboundedSender<TaskProg>) -> Self {
|
||||||
let (tx, rx) = async_channel::unbounded();
|
let (tx, rx) = async_channel::unbounded();
|
||||||
5
yazi-scheduler/src/file/mod.rs
Normal file
5
yazi-scheduler/src/file/mod.rs
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
mod file;
|
||||||
|
mod op;
|
||||||
|
|
||||||
|
pub use file::*;
|
||||||
|
pub use op::*;
|
||||||
46
yazi-scheduler/src/file/op.rs
Normal file
46
yazi-scheduler/src/file/op.rs
Normal file
|
|
@ -0,0 +1,46 @@
|
||||||
|
use std::fs::Metadata;
|
||||||
|
|
||||||
|
use yazi_shared::fs::Url;
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum FileOp {
|
||||||
|
Paste(FileOpPaste),
|
||||||
|
Link(FileOpLink),
|
||||||
|
Delete(FileOpDelete),
|
||||||
|
Trash(FileOpTrash),
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct FileOpPaste {
|
||||||
|
pub id: usize,
|
||||||
|
pub from: Url,
|
||||||
|
pub to: Url,
|
||||||
|
pub cut: bool,
|
||||||
|
pub follow: bool,
|
||||||
|
pub retry: u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct FileOpLink {
|
||||||
|
pub id: usize,
|
||||||
|
pub from: Url,
|
||||||
|
pub to: Url,
|
||||||
|
pub meta: Option<Metadata>,
|
||||||
|
pub resolve: bool,
|
||||||
|
pub relative: bool,
|
||||||
|
pub delete: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct FileOpDelete {
|
||||||
|
pub id: usize,
|
||||||
|
pub target: Url,
|
||||||
|
pub length: u64,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug)]
|
||||||
|
pub struct FileOpTrash {
|
||||||
|
pub id: usize,
|
||||||
|
pub target: Url,
|
||||||
|
pub length: u64,
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
#![allow(clippy::option_map_unit_fn, clippy::unit_arg)]
|
#![allow(clippy::option_map_unit_fn, clippy::unit_arg)]
|
||||||
|
|
||||||
mod blocker;
|
mod blocker;
|
||||||
|
mod file;
|
||||||
mod running;
|
mod running;
|
||||||
mod scheduler;
|
mod scheduler;
|
||||||
mod task;
|
mod task;
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@ use yazi_config::{open::Opener, plugin::PluginRule, TASKS};
|
||||||
use yazi_shared::{emit, event::Exec, fs::{unique_path, Url}, Layer, Throttle};
|
use yazi_shared::{emit, event::Exec, fs::{unique_path, Url}, Layer, Throttle};
|
||||||
|
|
||||||
use super::{Running, TaskProg, TaskStage};
|
use super::{Running, TaskProg, TaskStage};
|
||||||
use crate::{workers::{File, FileOpDelete, FileOpLink, FileOpPaste, FileOpTrash, Plugin, PluginOpEntry, Preload, PreloadOpRule, PreloadOpSize, Process, ProcessOpOpen}, TaskKind, TaskOp};
|
use crate::{file::{File, FileOpDelete, FileOpLink, FileOpPaste, FileOpTrash}, workers::{Plugin, PluginOpEntry, Preload, PreloadOpRule, PreloadOpSize, Process, ProcessOpOpen}, TaskKind, TaskOp};
|
||||||
|
|
||||||
pub struct Scheduler {
|
pub struct Scheduler {
|
||||||
pub file: Arc<File>,
|
pub file: Arc<File>,
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ impl From<&Task> for TaskSummary {
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub enum TaskOp {
|
pub enum TaskOp {
|
||||||
File(Box<crate::workers::FileOp>),
|
File(Box<crate::file::FileOp>),
|
||||||
Plugin(Box<crate::workers::PluginOp>),
|
Plugin(Box<crate::workers::PluginOp>),
|
||||||
Preload(Box<crate::workers::PreloadOp>),
|
Preload(Box<crate::workers::PreloadOp>),
|
||||||
Process(Box<crate::workers::ProcessOp>),
|
Process(Box<crate::workers::ProcessOp>),
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
mod file;
|
|
||||||
mod plugin;
|
mod plugin;
|
||||||
mod preload;
|
mod preload;
|
||||||
mod process;
|
mod process;
|
||||||
|
|
||||||
pub use file::*;
|
|
||||||
pub use plugin::*;
|
pub use plugin::*;
|
||||||
pub use preload::*;
|
pub use preload::*;
|
||||||
pub use process::*;
|
pub use process::*;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue