• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

abatar1 / CyclicalFileWatcher / 14686199120

26 Apr 2025 11:42PM UTC coverage: 11.635% (-4.0%) from 15.605%
14686199120

push

github

abatar1
documentation + minor refactoring

0 of 64 branches covered (0.0%)

Branch coverage included in aggregate %.

2 of 32 new or added lines in 2 files covered. (6.25%)

1 existing line in 1 file now uncovered.

37 of 254 relevant lines covered (14.57%)

1622.3 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

33.33
/src/CyclicalFileWatcher/CyclicalFileWatcher.cs
1
using System;
2
using System.Collections.Generic;
3
using System.IO;
4
using System.Threading;
5
using System.Threading.Tasks;
6
using FileWatcher.Base;
7
using FileWatcher.Internals;
8

9
namespace FileWatcher;
10

11
public sealed class CyclicalFileWatcher<TFileStateContent> : IFileWatcher<TFileStateContent>
12
    where TFileStateContent : IFileStateContent
13
{
14
    private readonly IFileStateManager<TFileStateContent> _fileStateManager;
15
    private readonly FileSubscriptionManager<TFileStateContent> _subscriptionManager;
16
    
17
    public CyclicalFileWatcher(IFileStateManagerConfiguration configuration)
1✔
18
    {
19
        _subscriptionManager = new FileSubscriptionManager<TFileStateContent>();
1✔
20
        _fileStateManager = new FileStateManager<TFileStateContent>(configuration, _subscriptionManager);
1✔
21
    }
1✔
22

23
    /// <exception cref="FileNotFoundException">file found on path filePath, ensure WatchAsync has been called</exception>
24
    public Task WatchAsync(FileWatcherParameters<TFileStateContent> parameters, CancellationToken cancellationToken)
25
    {
26
        return _fileStateManager.WatchAsync(parameters, cancellationToken);
×
27
    }
28
    
29
    /// <exception cref="FileNotFoundException">file found on path filePath, ensure WatchAsync has been called</exception>
30
    /// <exception cref="KeyNotFoundException">file was found, but key is not</exception>
31
    public Task<IFileState<TFileStateContent>> GetAsync(string filePath, string fileKey, CancellationToken cancellationToken)
32
    {
33
        return _fileStateManager.GetAsync(filePath, fileKey, cancellationToken);
×
34
    }
35

36
    /// <exception cref="FileNotFoundException">file found on path filePath, ensure WatchAsync has been called</exception>
37
    public Task<IFileState<TFileStateContent>> GetLatestAsync(string filePath, CancellationToken cancellationToken)
38
    {
39
        return _fileStateManager.GetLatestAsync(filePath, cancellationToken);
×
40
    }
41

42
    public Task<FileSubscription> SubscribeAsync(string filePath, Func<IFileState<TFileStateContent>, Task> actionOnUpdate, CancellationToken cancellationToken)
43
    {
44
        return _subscriptionManager.SubscribeAsync(filePath, actionOnUpdate, cancellationToken);
×
45
    }
46

47
    public Task UnsubscribeAsync(FileSubscription subscription, CancellationToken cancellationToken)
48
    {
NEW
49
        return _subscriptionManager.UnsubscribeAsync(subscription, cancellationToken);
×
50
    }
51
    
52
    public async ValueTask DisposeAsync()
53
    {
54
        await _fileStateManager.DisposeAsync();
×
55
        await _subscriptionManager.DisposeAsync();
×
56
    }
×
57
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc