From cbf0c9749c0eb64c47e9ab09b8d0453a37c70f8e Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 21 Jan 2023 11:20:26 -0600 Subject: split interface from implementation --- src/slskd/Relay/IRelayClient.cs | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 src/slskd/Relay/IRelayClient.cs (limited to 'src') diff --git a/src/slskd/Relay/IRelayClient.cs b/src/slskd/Relay/IRelayClient.cs new file mode 100644 index 00000000..376f3eaf --- /dev/null +++ b/src/slskd/Relay/IRelayClient.cs @@ -0,0 +1,55 @@ +// +// 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.Relay +{ + using System; + using System.Threading; + using System.Threading.Tasks; + + /// + /// Relay client (agent). + /// + public interface IRelayClient : IDisposable + { + /// + /// Gets the client state. + /// + IStateMonitor StateMonitor { get; } + + /// + /// Starts the client and connects to the controller. + /// + /// The token to monitor for cancellation requests. + /// The operation context. + Task StartAsync(CancellationToken cancellationToken = default); + + /// + /// Stops the client and disconnects from the controller. + /// + /// The token to monitor for cancellation requests. + /// The operation context. + Task StopAsync(CancellationToken cancellationToken = default); + + /// + /// Synchronizes state with the controller. + /// + /// The token to monitor for cancellation requests. + /// The operation context. + Task SynchronizeAsync(CancellationToken cancellationToken = default); + } +} -- cgit v1.2.3