From ae31d127746032803de0eabc9a8bfe3846f6fb78 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 27 May 2021 22:27:27 -0500 Subject: deprecate SearchTracker --- src/slskd/API/Controllers/SearchesController.cs | 4 +- src/slskd/Core/Search/ISearchTracker.cs | 52 --------------------- src/slskd/Core/Search/SearchService.cs | 1 - src/slskd/Core/Search/SearchTracker.cs | 62 ------------------------- src/slskd/Startup.cs | 1 - 5 files changed, 1 insertion(+), 119 deletions(-) delete mode 100644 src/slskd/Core/Search/ISearchTracker.cs delete mode 100644 src/slskd/Core/Search/SearchTracker.cs (limited to 'src') diff --git a/src/slskd/API/Controllers/SearchesController.cs b/src/slskd/API/Controllers/SearchesController.cs index 05a0e002..d652f147 100644 --- a/src/slskd/API/Controllers/SearchesController.cs +++ b/src/slskd/API/Controllers/SearchesController.cs @@ -43,16 +43,14 @@ namespace slskd.API.Controllers /// /// /// - public SearchesController(ISoulseekClient client, ISearchTracker tracker, ISearchService searchService) + public SearchesController(ISoulseekClient client, ISearchService searchService) { Client = client; - Tracker = tracker; SearchService = searchService; } private ISearchService SearchService { get; } private ISoulseekClient Client { get; } - private ISearchTracker Tracker { get; } /// /// Performs a search for the specified . diff --git a/src/slskd/Core/Search/ISearchTracker.cs b/src/slskd/Core/Search/ISearchTracker.cs deleted file mode 100644 index c962138e..00000000 --- a/src/slskd/Core/Search/ISearchTracker.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.Search -{ - using System; - using System.Collections.Concurrent; - using Soulseek; - - /// - /// Tracks active searches. - /// - public interface ISearchTracker - { - /// - /// Gets active searches. - /// - ConcurrentDictionary Searches { get; } - - /// - /// Adds or updates a tracked search. - /// - /// - /// - void AddOrUpdate(Guid id, SearchEventArgs args); - - /// - /// Removes all tracked searches. - /// - void Clear(); - - /// - /// Removes a tracked search. - /// - /// - void TryRemove(Guid id); - } -} \ No newline at end of file diff --git a/src/slskd/Core/Search/SearchService.cs b/src/slskd/Core/Search/SearchService.cs index f1818423..0fd4d6d5 100644 --- a/src/slskd/Core/Search/SearchService.cs +++ b/src/slskd/Core/Search/SearchService.cs @@ -107,7 +107,6 @@ namespace slskd.Search using var context = ContextFactory.CreateDbContext(); var search = await context .Searches - .Select(search => search.) .FirstOrDefaultAsync(expression); if (!includeResponses) diff --git a/src/slskd/Core/Search/SearchTracker.cs b/src/slskd/Core/Search/SearchTracker.cs deleted file mode 100644 index b1ab2b18..00000000 --- a/src/slskd/Core/Search/SearchTracker.cs +++ /dev/null @@ -1,62 +0,0 @@ -// -// Copyright (c) slskd Team. All rights reserved. -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published -// by the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see https://www.gnu.org/licenses/. -// - -namespace slskd.Search -{ - using System; - using System.Collections.Concurrent; - using Soulseek; - - /// - /// Tracks active searches. - /// - public class SearchTracker : ISearchTracker - { - /// - /// Gets active searches. - /// - public ConcurrentDictionary Searches { get; private set; } = - new ConcurrentDictionary(); - - /// - /// Adds or updates a tracked search. - /// - /// - /// - public void AddOrUpdate(Guid id, SearchEventArgs args) - { - Searches.AddOrUpdate(id, args.Search, (token, search) => args.Search); - } - - /// - /// Removes all tracked searches. - /// - public void Clear() - { - Searches.Clear(); - } - - /// - /// Removes a tracked search. - /// - /// - public void TryRemove(Guid id) - { - Searches.TryRemove(id, out _); - } - } -} \ No newline at end of file diff --git a/src/slskd/Startup.cs b/src/slskd/Startup.cs index a4627114..4d11ad1a 100644 --- a/src/slskd/Startup.cs +++ b/src/slskd/Startup.cs @@ -174,7 +174,6 @@ namespace slskd services.AddTransient(p => p.GetRequiredService>().CreateDbContext()); services.AddSingleton(); - services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(_ => new RoomTracker(messageLimit: 250)); -- cgit v1.2.3