87 lines
4.3 KiB
C#
87 lines
4.3 KiB
C#
using Explorer.Domain;
|
|
|
|
namespace Explorer.Contracts;
|
|
|
|
public interface IWorkbenchHost
|
|
{
|
|
IIndexingHost Indexing { get; }
|
|
ITransferHost Transfers { get; }
|
|
ISourceHost Sources { get; }
|
|
IIndexMutations Mutations { get; }
|
|
}
|
|
|
|
public interface IIndexingHost
|
|
{
|
|
event EventHandler<ScanProgress>? ProgressChanged;
|
|
void EnqueueFullScan(long sourceId);
|
|
void EnqueueFolderScan(long sourceId, string pathRel);
|
|
void EnqueueReconcile(long sourceId, string pathRel);
|
|
/// <summary>Shallow reconcile, then descend into child folders whose index no longer matches disk.</summary>
|
|
void EnqueueVerify(long sourceId, string pathRel) => EnqueueReconcile(sourceId, pathRel);
|
|
void Cancel(long sourceId);
|
|
}
|
|
|
|
public interface ITransferHost
|
|
{
|
|
event EventHandler? Changed;
|
|
event EventHandler<TransferJob>? JobFinished;
|
|
bool IsPaused { get; }
|
|
IReadOnlyList<TransferJob> Snapshot();
|
|
void PauseAll();
|
|
void ResumeAll();
|
|
void Pause(long jobId);
|
|
void Resume(long jobId);
|
|
void Retry(long jobId);
|
|
void Cancel(long jobId);
|
|
void Dismiss(long jobId);
|
|
void ClearFinished();
|
|
bool MoveUp(long jobId);
|
|
bool MoveDown(long jobId);
|
|
Task EnqueueCopyAsync(IReadOnlyList<string> sources, string destinationDirectory, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
Task EnqueueMoveAsync(IReadOnlyList<string> sources, string destinationDirectory, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
Task EnqueueDeleteAsync(IReadOnlyList<string> paths, bool permanent = false, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
Task EnqueueRenameAsync(string path, string newName, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
Task EnqueueEmptyRecycleBinAsync(CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
Task EnqueueExtractAsync(string archivePath, string destinationDirectory, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
Task EnqueueCompressAsync(IReadOnlyList<string> sources, string archivePath, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
Task EnqueueAddToArchiveAsync(string archivePath, IReadOnlyList<string> sources, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
Task EnqueueVerifyArchiveAsync(string archivePath, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
Task EnqueueConvertAsync(string sourcePath, string destinationPath, ConversionKind kind, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
Task EnqueueWriteTagsAsync(string path, string payload, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
Task EnqueueMoveToAsync(string source, string destinationPath, CancellationToken cancellationToken = default)
|
|
=> Task.CompletedTask;
|
|
}
|
|
|
|
public interface ISourceHost
|
|
{
|
|
Task RefreshAsync(CancellationToken cancellationToken = default);
|
|
Task<Source> AddUncAsync(string path, CancellationToken cancellationToken = default);
|
|
Task<Source?> EnsureForPathAsync(string path, CancellationToken cancellationToken = default);
|
|
Task<bool> ForgetAsync(string path, CancellationToken cancellationToken = default);
|
|
Task<Source?> MarkReachableAsync(string path, CancellationToken cancellationToken = default)
|
|
=> Task.FromResult<Source?>(null);
|
|
}
|
|
|
|
public interface IIndexMutations
|
|
{
|
|
Task<long> UpsertSyncProfileAsync(SyncProfile profile, CancellationToken cancellationToken = default);
|
|
Task DeleteSyncProfileAsync(long id, CancellationToken cancellationToken = default);
|
|
Task<long> UpsertOperationProfileAsync(OperationProfile profile, CancellationToken cancellationToken = default);
|
|
Task DeleteOperationProfileAsync(long id, CancellationToken cancellationToken = default);
|
|
Task<long> CreateRenameBatchAsync(IReadOnlyList<RenameBatchItem> items, CancellationToken cancellationToken = default);
|
|
Task MarkRenameBatchUndoneAsync(long id, CancellationToken cancellationToken = default);
|
|
Task EnqueueHashCollisionsAsync(long? sourceId, CancellationToken cancellationToken = default);
|
|
Task UpsertRelationAsync(FileRelation relation, CancellationToken cancellationToken = default);
|
|
}
|