feat(drive): limit NC request by disk
This commit is contained in:
@@ -12,6 +12,7 @@ use std::path::PathBuf;
|
||||
|
||||
use bytes::Bytes;
|
||||
use futures::Stream;
|
||||
use uuid::Uuid;
|
||||
|
||||
use crate::common::errors::DomainError;
|
||||
use crate::domain::entities::file::File;
|
||||
@@ -49,8 +50,12 @@ pub trait FileReadRepository: Send + Sync + 'static {
|
||||
/// Gets the logical storage path of a file.
|
||||
async fn get_file_path(&self, id: &str) -> Result<StoragePath, DomainError>;
|
||||
|
||||
/// Gets the parent folder ID from a path (WebDAV).
|
||||
async fn get_parent_folder_id(&self, path: &str) -> Result<String, DomainError>;
|
||||
/// Gets the parent folder ID from a path (WebDAV), scoped to a drive.
|
||||
///
|
||||
/// Post-D0, `storage.folders.path` is unique only within a single
|
||||
/// drive — the `drive_id` filter scopes the lookup.
|
||||
async fn get_parent_folder_id(&self, path: &str, drive_id: Uuid)
|
||||
-> Result<String, DomainError>;
|
||||
}
|
||||
|
||||
// ─────────────────────────────────────────────────────
|
||||
|
||||
@@ -28,17 +28,17 @@ pub trait FolderRepository: Send + Sync + 'static {
|
||||
/// Gets a folder by its ID
|
||||
async fn get_folder(&self, id: &str) -> Result<Folder, DomainError>;
|
||||
|
||||
/// Gets a folder by its storage path within the caller's tree.
|
||||
/// Gets a folder by its storage path within a drive's tree.
|
||||
///
|
||||
/// Post-D0, `storage.folders.path` is no longer globally unique —
|
||||
/// multiple users share root-folder names like `"Personal"`. The
|
||||
/// `user_id` filter scopes the lookup to the caller's own folders
|
||||
/// (the equivalent of the pre-D0 implicit user-namespacing that
|
||||
/// came from `My Folder - <username>` paths).
|
||||
/// Post-D0, `storage.folders.path` is unique only within a single
|
||||
/// drive — root-folder names like `"Personal"` repeat across drives.
|
||||
/// The `drive_id` filter scopes the lookup to a specific drive
|
||||
/// (caller derives it from its protocol context: NC chroot, native
|
||||
/// default-drive lookup, WOPI default-drive lookup).
|
||||
async fn get_folder_by_path(
|
||||
&self,
|
||||
storage_path: &StoragePath,
|
||||
user_id: Uuid,
|
||||
drive_id: Uuid,
|
||||
) -> Result<Folder, DomainError>;
|
||||
|
||||
/// Lists folders within a parent folder
|
||||
@@ -87,8 +87,15 @@ pub trait FolderRepository: Send + Sync + 'static {
|
||||
/// Deletes a folder
|
||||
async fn delete_folder(&self, id: &str) -> Result<(), DomainError>;
|
||||
|
||||
/// Checks if a folder exists at the given path
|
||||
async fn folder_exists(&self, storage_path: &StoragePath) -> Result<bool, DomainError>;
|
||||
/// Checks if a folder exists at the given path within a drive.
|
||||
///
|
||||
/// Post-D0 `storage.folders.path` is unique only within a single
|
||||
/// drive — the `drive_id` filter scopes the existence check.
|
||||
async fn folder_exists(
|
||||
&self,
|
||||
storage_path: &StoragePath,
|
||||
drive_id: Uuid,
|
||||
) -> Result<bool, DomainError>;
|
||||
|
||||
/// Gets the path of a folder
|
||||
async fn get_folder_path(&self, id: &str) -> Result<StoragePath, DomainError>;
|
||||
|
||||
Reference in New Issue
Block a user