pinakes-core: file management improvements; in-datatbase storage cleanup
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: Ic186f9bf08683a14562bbe43743c04706a6a6964
This commit is contained in:
parent
f34c78b238
commit
f5371a30bb
8 changed files with 698 additions and 4 deletions
|
|
@ -741,6 +741,54 @@ pub trait StorageBackend: Send + Sync + 'static {
|
|||
|
||||
/// Mark all notifications as read for a user
|
||||
async fn mark_all_notifications_read(&self, user_id: UserId) -> Result<()>;
|
||||
|
||||
// ===== File Management =====
|
||||
|
||||
/// Rename a media item (changes file_name and updates path accordingly).
|
||||
/// For external storage, this actually renames the file on disk.
|
||||
/// For managed storage, this only updates the metadata.
|
||||
/// Returns the old path for sync log recording.
|
||||
async fn rename_media(&self, id: MediaId, new_name: &str) -> Result<String>;
|
||||
|
||||
/// Move a media item to a new directory.
|
||||
/// For external storage, this actually moves the file on disk.
|
||||
/// For managed storage, this only updates the path in metadata.
|
||||
/// Returns the old path for sync log recording.
|
||||
async fn move_media(&self, id: MediaId, new_directory: &std::path::Path) -> Result<String>;
|
||||
|
||||
/// Batch move multiple media items to a new directory.
|
||||
async fn batch_move_media(
|
||||
&self,
|
||||
ids: &[MediaId],
|
||||
new_directory: &std::path::Path,
|
||||
) -> Result<Vec<(MediaId, String)>> {
|
||||
let mut results = Vec::new();
|
||||
for id in ids {
|
||||
let old_path = self.move_media(*id, new_directory).await?;
|
||||
results.push((*id, old_path));
|
||||
}
|
||||
Ok(results)
|
||||
}
|
||||
|
||||
// ===== Trash / Soft Delete =====
|
||||
|
||||
/// Soft delete a media item (set deleted_at timestamp).
|
||||
async fn soft_delete_media(&self, id: MediaId) -> Result<()>;
|
||||
|
||||
/// Restore a soft-deleted media item.
|
||||
async fn restore_media(&self, id: MediaId) -> Result<()>;
|
||||
|
||||
/// List all soft-deleted media items.
|
||||
async fn list_trash(&self, pagination: &Pagination) -> Result<Vec<MediaItem>>;
|
||||
|
||||
/// Permanently delete all items in trash.
|
||||
async fn empty_trash(&self) -> Result<u64>;
|
||||
|
||||
/// Permanently delete items in trash older than the specified date.
|
||||
async fn purge_old_trash(&self, before: DateTime<Utc>) -> Result<u64>;
|
||||
|
||||
/// Count items in trash.
|
||||
async fn count_trash(&self) -> Result<u64>;
|
||||
}
|
||||
|
||||
/// Comprehensive library statistics.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue