// 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)); }
public PostBag(ITaskHelper th, ITime time, CmdLineOptions options) { _th = th; _time = time; _initTcs = new TaskCompletionSource <int>(); th.Run(() => InitAsync(new SystemDirectory(th, options.BlogRootDirectory))); }
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)); }
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); }
public static Task Run(this ITaskHelper taskHelper, Func <Task> function) => taskHelper.Run(async() => { await taskHelper.ConfigureAwait(function()); return(0); });