mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2026-02-19 06:30:07 +00:00
- Add is_missing column to AssetCacheState for soft-delete - Replace hard-delete pruning with mark_cache_states_missing_outside_prefixes - Auto-restore missing cache states when files are re-scanned - Filter out missing cache states from queries by default - Rename functions for clarity: - mark_cache_states_missing_outside_prefixes (was delete_cache_states_outside_prefixes) - get_unreferenced_unhashed_asset_ids (was get_orphaned_seed_asset_ids) - mark_assets_missing_outside_prefixes (was prune_orphaned_assets) - mark_missing_outside_prefixes_safely (was prune_orphans_safely) - Add restore_cache_states_by_paths for explicit restoration - Add cleanup_unreferenced_assets for explicit hard-delete when needed - Update API endpoint /api/assets/prune to use new soft-delete behavior This preserves user metadata (tags, etc.) when base directories change, allowing assets to be restored when the original paths become available again. Amp-Thread-ID: https://ampcode.com/threads/T-019c3114-bf28-73a9-a4d2-85b208fd5462 Co-authored-by: Amp <amp@ampcode.com>
90 lines
2.0 KiB
Python
90 lines
2.0 KiB
Python
from app.assets.services.asset_management import (
|
|
asset_exists,
|
|
delete_asset_reference,
|
|
get_asset_by_hash,
|
|
get_asset_detail,
|
|
list_assets_page,
|
|
resolve_asset_for_download,
|
|
set_asset_preview,
|
|
update_asset_metadata,
|
|
)
|
|
from app.assets.services.bulk_ingest import (
|
|
BulkInsertResult,
|
|
batch_insert_seed_assets,
|
|
cleanup_unreferenced_assets,
|
|
mark_assets_missing_outside_prefixes,
|
|
)
|
|
from app.assets.services.file_utils import (
|
|
get_mtime_ns,
|
|
get_size_and_mtime_ns,
|
|
list_files_recursively,
|
|
verify_file_unchanged,
|
|
)
|
|
from app.assets.services.ingest import (
|
|
DependencyMissingError,
|
|
HashMismatchError,
|
|
create_from_hash,
|
|
upload_from_temp_path,
|
|
)
|
|
from app.assets.services.schemas import (
|
|
AddTagsResult,
|
|
AssetData,
|
|
AssetDetailResult,
|
|
AssetInfoData,
|
|
AssetSummaryData,
|
|
DownloadResolutionResult,
|
|
IngestResult,
|
|
ListAssetsResult,
|
|
RegisterAssetResult,
|
|
RemoveTagsResult,
|
|
SetTagsResult,
|
|
TagUsage,
|
|
UploadResult,
|
|
UserMetadata,
|
|
)
|
|
from app.assets.services.tagging import (
|
|
apply_tags,
|
|
list_tags,
|
|
remove_tags,
|
|
)
|
|
|
|
__all__ = [
|
|
"AddTagsResult",
|
|
"AssetData",
|
|
"AssetDetailResult",
|
|
"AssetInfoData",
|
|
"AssetSummaryData",
|
|
"BulkInsertResult",
|
|
"DependencyMissingError",
|
|
"DownloadResolutionResult",
|
|
"HashMismatchError",
|
|
"IngestResult",
|
|
"ListAssetsResult",
|
|
"RegisterAssetResult",
|
|
"RemoveTagsResult",
|
|
"SetTagsResult",
|
|
"TagUsage",
|
|
"UploadResult",
|
|
"UserMetadata",
|
|
"apply_tags",
|
|
"asset_exists",
|
|
"batch_insert_seed_assets",
|
|
"create_from_hash",
|
|
"delete_asset_reference",
|
|
"get_asset_by_hash",
|
|
"get_asset_detail",
|
|
"get_mtime_ns",
|
|
"get_size_and_mtime_ns",
|
|
"list_assets_page",
|
|
"list_files_recursively",
|
|
"list_tags",
|
|
"cleanup_unreferenced_assets",
|
|
"mark_assets_missing_outside_prefixes",
|
|
"remove_tags",
|
|
"resolve_asset_for_download",
|
|
"set_asset_preview",
|
|
"update_asset_metadata",
|
|
"upload_from_temp_path",
|
|
"verify_file_unchanged",
|
|
]
|