Persist file categories on the index and classify archives and unknown types during idle maintenance.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-28 11:37:29 +02:00
parent b33a78dbbe
commit 222b5d9969
42 changed files with 1719 additions and 80 deletions

View File

@@ -59,6 +59,11 @@ public interface IEntryStore
Task DeleteExpiredTombstonesAsync(DateTimeOffset cutoffUtc, CancellationToken cancellationToken = default);
Task RenameSubtreePathAsync(long sourceId, string oldPathRel, string newPathRel, CancellationToken cancellationToken = default);
Task<long> CountPresentAsync(long sourceId, CancellationToken cancellationToken = default);
Task RefreshCategoryFromChildrenAsync(long folderOrArchiveId, CancellationToken cancellationToken = default);
Task SetUserCategoryAsync(long entryId, FileCategory category, string? reason = null, CancellationToken cancellationToken = default);
Task<int> BackfillCheapCategoriesAsync(int take, CancellationToken cancellationToken = default);
Task<IReadOnlyList<long>> GetArchiveIdsNeedingContentClassifyAsync(int take, CancellationToken cancellationToken = default);
Task<IReadOnlyList<IndexEntry>> GetUnknownFilesForSignatureAsync(int take, CancellationToken cancellationToken = default);
}
public interface IExcludeStore
@@ -109,6 +114,7 @@ public sealed class SearchRequest
public bool DirectChildrenOnly { get; init; }
public bool IncludeOffline { get; init; } = true;
public bool IncludeDeleted { get; init; }
public FileCategory? Category { get; init; }
public int Skip { get; init; }
public int Take { get; init; } = 500;
}
@@ -121,6 +127,7 @@ public interface IAnalysisStore
Task<IReadOnlyList<IndexEntry>> LargestDirectoriesAsync(long? sourceId, long? parentId, int take, CancellationToken cancellationToken = default);
Task<IReadOnlyList<IndexEntry>> LargestFilesAsync(long? sourceId, string? pathRelPrefix, int take, CancellationToken cancellationToken = default);
Task<IReadOnlyList<ExtensionUsage>> UsageByExtensionAsync(long? sourceId, string? pathRelPrefix, int take, CancellationToken cancellationToken = default);
Task<IReadOnlyList<CategoryUsage>> UsageByCategoryAsync(long? sourceId, string? pathRelPrefix, int take, CancellationToken cancellationToken = default);
Task<IReadOnlyList<SourceUsage>> UsageBySourceAsync(CancellationToken cancellationToken = default);
Task<IReadOnlyList<IndexEntry>> ChildrenBySizeAsync(long parentId, int take, CancellationToken cancellationToken = default);
}
@@ -132,6 +139,13 @@ public sealed class ExtensionUsage
public long FileCount { get; init; }
}
public sealed class CategoryUsage
{
public required string Category { get; init; }
public long TotalSize { get; init; }
public long FileCount { get; init; }
}
public sealed class SourceUsage
{
public long SourceId { get; init; }