feat: new yazi-vfs crate (#3187)

This commit is contained in:
三咲雅 misaki masa 2025-09-21 11:44:52 +08:00 committed by GitHub
parent 30c0279570
commit 4e3ac54c8e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
88 changed files with 930 additions and 286 deletions

View file

@ -24,7 +24,7 @@ pub struct Client {
pub(super) abilities: HashSet<String>,
}
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct Peer {
pub(super) abilities: HashSet<String>,
}

View file

@ -7,7 +7,7 @@ use yazi_shared::url::UrlBuf;
use super::Ember;
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberBulk<'a> {
pub changes: HashMap<Cow<'a, UrlBuf>, Cow<'a, UrlBuf>>,
}

View file

@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use super::Ember;
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberBye;
impl EmberBye {

View file

@ -6,7 +6,7 @@ use yazi_shared::{Id, url::UrlBuf};
use super::Ember;
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberCd<'a> {
pub tab: Id,
pub url: Cow<'a, UrlBuf>,

View file

@ -6,7 +6,7 @@ use yazi_shared::url::UrlBuf;
use super::Ember;
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberDelete<'a> {
pub urls: Cow<'a, Vec<UrlBuf>>,
}

View file

@ -7,7 +7,7 @@ use super::{Ember, EmberHi};
use crate::Peer;
/// Server handshake
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberHey {
pub peers: HashMap<Id, Peer>,
pub version: SStr,

View file

@ -8,7 +8,7 @@ use yazi_shared::SStr;
use super::Ember;
/// Client handshake
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberHi<'a> {
/// Kinds of events the client can handle
pub abilities: HashSet<Cow<'a, str>>,

View file

@ -6,7 +6,7 @@ use yazi_shared::{Id, url::UrlBuf};
use super::Ember;
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberHover<'a> {
pub tab: Id,
pub url: Option<Cow<'a, UrlBuf>>,

View file

@ -7,7 +7,7 @@ use yazi_shared::{Id, url::UrlBuf};
use super::Ember;
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberLoad<'a> {
pub tab: Id,
pub url: Cow<'a, UrlBuf>,

View file

@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use super::Ember;
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberMount;
impl EmberMount {

View file

@ -6,7 +6,7 @@ use yazi_shared::url::UrlBuf;
use super::Ember;
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberMove<'a> {
pub items: Cow<'a, Vec<BodyMoveItem>>,
}
@ -34,7 +34,7 @@ impl IntoLua for EmberMove<'_> {
}
// --- Item
#[derive(Debug, Clone, Serialize, Deserialize)]
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct BodyMoveItem {
pub from: UrlBuf,
pub to: UrlBuf,

View file

@ -6,7 +6,7 @@ use yazi_shared::{Id, url::UrlBuf};
use super::Ember;
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberRename<'a> {
pub tab: Id,
pub from: Cow<'a, UrlBuf>,

View file

@ -4,7 +4,7 @@ use yazi_shared::Id;
use super::Ember;
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberTab {
pub id: Id,
}

View file

@ -6,7 +6,7 @@ use yazi_shared::url::UrlBuf;
use super::Ember;
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberTrash<'a> {
pub urls: Cow<'a, Vec<UrlBuf>>,
}

View file

@ -8,7 +8,7 @@ use yazi_shared::url::UrlBufCov;
use super::Ember;
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Deserialize, Serialize)]
pub struct EmberYank<'a>(UpdateYankedOpt<'a>);
impl<'a> EmberYank<'a> {

View file

@ -58,7 +58,7 @@ impl State {
return Ok(());
}
Local::create_dir_all(&BOOT.state_dir).await?;
Local.create_dir_all(&BOOT.state_dir).await?;
let mut buf = BufWriter::new(
Gate::default()
.write(true)
@ -79,7 +79,7 @@ impl State {
}
async fn load(&self) -> Result<()> {
let mut file = BufReader::new(Local::open(BOOT.state_dir.join(".dds")).await?);
let mut file = BufReader::new(Local.open(BOOT.state_dir.join(".dds")).await?);
let mut buf = String::new();
let mut inner = HashMap::new();
@ -103,7 +103,7 @@ impl State {
}
async fn skip(&self) -> Result<bool> {
let cha = Local::symlink_metadata(BOOT.state_dir.join(".dds")).await?;
let cha = Local.symlink_metadata(BOOT.state_dir.join(".dds")).await?;
let modified = cha.mtime_dur()?.as_micros();
Ok(modified >= self.last.load(Ordering::Relaxed) as u128)
}

View file

@ -40,7 +40,7 @@ impl Stream {
let p = Self::socket_file();
yazi_fs::provider::local::Local::remove_file(&p).await.ok();
yazi_fs::provider::local::Local.remove_file(&p).await.ok();
tokio::net::UnixListener::bind(p)
}