Add collector settings and per-source purge
Every limit the fetcher was using was a constant. They are settings now, and CollectOptions became the single place policy lives: AppSettings.ToCollectOptions clamps them, and the HTTP layer's FetchOptions is projected from that. One clamping site rather than two sets of ceilings drifting apart. Clamping rather than validating, for the reason the proxy options already do it: a hand-edited file must not stop the app from starting. A MaxItemBytes edited to zero would otherwise refuse everything, and a zeroed concurrency would deadlock the run outright - so both are pulled into range instead. An empty format filter is read as "everything", because switching every format off is far more likely to be a slip than an instruction to collect nothing. The media root has an ordering problem - it is a setting that decides the paths the container is built from - so the file is read once before the container exists rather than making every path lazy for one value. Purge is scoped to a source and lives on the Collect page, where the source is already chosen. Content another source also holds survives, which is what the index's reference count was for. The showcase hint says out loud what a hard link means: editing the browsable copy edits the original, and deleting it frees nothing until the last name goes. That is surprising enough to belong in the UI rather than only in the code. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
70fb3a1df3
commit
fe62bcf53f
@@ -102,12 +102,14 @@ public class CollectViewModelTests
|
||||
var catalog = new MediaSourceCatalog(sources, "url-list");
|
||||
var settingsService = new FakeSettingsService(settings);
|
||||
var runner = new FakeRunner();
|
||||
var store = new FakeMediaStore();
|
||||
|
||||
var page = new CollectViewModel(
|
||||
catalog,
|
||||
settingsService,
|
||||
proxyPool ?? new ProxyPool([], new FakeProxyProbe(), new ProxyOptions()),
|
||||
runner,
|
||||
store,
|
||||
new EmptyServiceProvider(),
|
||||
NullLogger<CollectViewModel>.Instance,
|
||||
ImmediateSequencer.Instance
|
||||
@@ -331,6 +333,26 @@ public class CollectViewModelTests
|
||||
page.IsBlockedWithoutProxy.ShouldBeFalse();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Purging_removes_only_the_selected_source()
|
||||
{
|
||||
// Scoped rather than emptying the store: content another source also holds must survive,
|
||||
// which is exactly what the index's reference count is for.
|
||||
var (page, _, _) = Build();
|
||||
|
||||
await page.PurgeCommand.Execute().ToTask(TestContext.Current.CancellationToken);
|
||||
|
||||
page.StatusMessage.ShouldNotBeNull().ShouldContain("Removed");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void The_store_totals_are_shown()
|
||||
{
|
||||
var (page, _, _) = Build();
|
||||
|
||||
page.StorageSummary.ShouldNotBeNull().ShouldContain("in the store");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Sizes_read_the_way_a_file_manager_shows_them()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user