コード例 #1
0
        // TODO: Make this roll
        // Filename format: "{baseName}.0x{sequence ID}.log"

        public RollingFileAppender(IDirectory dir, string baseName, ITaskHelper taskHelper)
        {
            _dir          = dir;
            _baseName     = baseName;
            _taskHelper   = taskHelper;
            _findFileTask = taskHelper.Run(() => FindFileAsync(CancellationToken.None));
        }
コード例 #2
0
 public PostBag(ITaskHelper th, ITime time, CmdLineOptions options)
 {
     _th      = th;
     _time    = time;
     _initTcs = new TaskCompletionSource <int>();
     th.Run(() => InitAsync(new SystemDirectory(th, options.BlogRootDirectory)));
 }
コード例 #3
0
 public DataStoreWriter(ITaskHelper taskHelper, IDirectory dir, string prefix)
 {
     _taskHelper = taskHelper;
     _dir        = dir;
     _prefix     = prefix;
     _factory    = Singletons <TFactory> .Instance;
     // Find last file, and check to see if it's version-compatible
     _appendFileNameTask = _taskHelper.Run(() => AppendFileName(CancellationToken.None));
 }
コード例 #4
0
 public Db(ITaskHelper taskHelper, IReader <T> reader, int requestedBlockSize = 0, Duration?pollInterval = null, Duration?maxJitter = null, bool disableWatch = false)
     : base(requestedBlockSize)
 {
     _taskHelper   = taskHelper;
     _reader       = reader;
     _pollInterval = pollInterval ?? Duration.FromMinutes(15);
     _maxJitter    = maxJitter ?? (_pollInterval / 4);
     _enableWatch  = !disableWatch;
     _cts          = new CancellationTokenSource();
     _tcs          = new TaskCompletionSource <int>();
     _rnd          = new Random();
     // Start load of initial data
     taskHelper.Run(ReadAsync);
 }
コード例 #5
0
 public static Task Run(this ITaskHelper taskHelper, Func <Task> function) => taskHelper.Run(async() =>
 {
     await taskHelper.ConfigureAwait(function());
     return(0);
 });