using Duplicati.Server;
using System;
using System.Collections.Generic;
using Duplicati.Library.IO;
using Duplicati.Library.RestAPI.Abstractions;
using Duplicati.Library.Utility;
using Duplicati.WebserverCore.Abstractions;
using Microsoft.Extensions.DependencyInjection;
namespace Duplicati.Library.RestAPI
{
/**
* In the absense of dependancy injection, there is a significant amount of variables exposed through Program as globals.
* This causes a problem decoupling classes and leads to circular dependancies.
*/
public static class FIXMEGlobal
{
public static IServiceProvider Provider { get; set; }
///
/// This is the only access to the database
///
public static Server.Database.Connection DataConnection;
///
/// The controller interface for pause/resume and throttle options
///
public static LiveControls LiveControl => Provider.GetRequiredService();
///
/// A delegate method for creating a copy of the current progress state
///
public static Func GenerateProgressState;
///
/// The status event signaler, used to control long polling of status updates
///
public static EventPollNotify StatusEventNotifyer => Provider.GetRequiredService();
///
/// For keeping and incrementing last last events Ids of db save and last notification
///
public static INotificationUpdateService NotificationUpdateService => Provider.GetRequiredService();
///
/// This is the working thread
///
public static WorkerThread WorkThread =>
Provider.GetRequiredService().WorkerThread;
public static IWorkerThreadsManager WorkerThreadsManager =>
Provider.GetRequiredService();
public static Action StartOrStopUsageReporter;
///
/// Gets the folder where Duplicati data is stored
///
public static string DataFolder;
///
/// This is the scheduling thread
///
public static IScheduler Scheduler => Provider.GetRequiredService();
///
/// The log redirect handler
///
public static readonly LogWriteHandler LogHandler = new LogWriteHandler();
public static Func