protected EncryptedBlobCache( string cacheDirectory = null, IFilesystemProvider filesystemProvider = null, IScheduler scheduler = null, Action<AsyncSubject<byte[]>> invalidatedCallback = null) : base(cacheDirectory, filesystemProvider, scheduler, invalidatedCallback) { }
protected PersistentBlobCache(string cacheDirectory = null, IFilesystemProvider filesystemProvider = null, IScheduler scheduler = null) { this.CacheDirectory = cacheDirectory ?? GetDefaultRoamingCacheDirectory(); this.Scheduler = scheduler ?? RxApp.TaskpoolScheduler; this.filesystem = filesystemProvider ?? new SimpleFilesystemProvider(); // Here, we're not actually caching the requests directly (i.e. as // byte[]s), but as the "replayed result of the request", in the // AsyncSubject - this makes the code infinitely simpler because // we don't have to keep a separate list of "in-flight reads" vs // "already completed and cached reads" MemoizedRequests = new MemoizingMRUCache<string, AsyncSubject<byte[]>>( (x, c) => FetchOrWriteBlobFromDisk(x, c, false), 20); try { var dir = filesystem.CreateRecursive(CacheDirectory); #if WINRT // NB: I don't want to talk about it. dir.Wait(); #endif } catch (Exception ex) { this.Log().FatalException("Couldn't create cache directory", ex); } var cacheIndex = FetchOrWriteBlobFromDisk(BlobCacheIndexKey, null, true) .Catch(Observable.Return(new byte[0])) .Select(x => Encoding.UTF8.GetString(x, 0, x.Length).Split('\n') .SelectMany(ParseCacheIndexEntry) .ToDictionary(y => y.Key, y => y.Value)) .Select(x => new ConcurrentDictionary<string, CacheIndexEntry>(x)); #if WINRT CacheIndex = cacheIndex.First(); #else cacheIndex.Subscribe(x => CacheIndex = x); #endif flushThreadSubscription = Disposable.Empty; if (!RxApp.InUnitTestRunner()) { flushThreadSubscription = actionTaken .Where(_ => CacheIndex != null) .Throttle(TimeSpan.FromSeconds(30), Scheduler) .SelectMany(_ => FlushCacheIndex(true)) .Subscribe(_ => { this.Log().Debug("Flushing cache"); lastFlushTime = Scheduler.Now; }); } this.Log().Info("{0} entries in blob cache index", CacheIndex.Count); }
public PersistentBlobCache( string cacheDirectory = null, IFilesystemProvider filesystemProvider = null, IScheduler scheduler = null, Action <AsyncSubject <byte[]> > invalidateCallback = null) { BlobCache.EnsureInitialized(); this.filesystem = filesystemProvider ?? Locator.Current.GetService <IFilesystemProvider>(); if (this.filesystem == null) { throw new Exception("No IFilesystemProvider available. This should never happen, your DependencyResolver is broken"); } this.CacheDirectory = cacheDirectory ?? filesystem.GetDefaultRoamingCacheDirectory(); this.Scheduler = scheduler ?? BlobCache.TaskpoolScheduler; // Here, we're not actually caching the requests directly (i.e. as // byte[]s), but as the "replayed result of the request", in the // AsyncSubject - this makes the code infinitely simpler because // we don't have to keep a separate list of "in-flight reads" vs // "already completed and cached reads" memoizedRequests = new MemoizingMRUCache <string, AsyncSubject <byte[]> >( (x, c) => FetchOrWriteBlobFromDisk(x, c, false), 20, invalidateCallback); var cacheIndex = FetchOrWriteBlobFromDisk(BlobCacheIndexKey, null, true) .Catch(Observable.Return(new byte[0])) .Select(x => Encoding.UTF8.GetString(x, 0, x.Length).Split('\n') .SelectMany(ParseCacheIndexEntry) .ToDictionary(y => y.Key, y => y.Value)) .Select(x => new ConcurrentDictionary <string, CacheIndexEntry>(x)); cacheIndex.Subscribe(x => CacheIndex = x); flushThreadSubscription = Disposable.Empty; if (!ModeDetector.InUnitTestRunner()) { flushThreadSubscription = actionTaken .Where(_ => CacheIndex != null) .Throttle(TimeSpan.FromSeconds(30), Scheduler) .SelectMany(_ => FlushCacheIndex(true)) .Subscribe(_ => this.Log().Debug("Flushing cache")); } this.Log().Info("{0} entries in blob cache index", CacheIndex.Count); }
public PersistentBlobCache( string cacheDirectory = null, IFilesystemProvider filesystemProvider = null, IScheduler scheduler = null, Action<AsyncSubject<byte[]>> invalidateCallback = null) { BlobCache.EnsureInitialized(); this.filesystem = filesystemProvider ?? Locator.Current.GetService<IFilesystemProvider>(); if (this.filesystem == null) { throw new Exception("No IFilesystemProvider available. This should never happen, your DependencyResolver is broken"); } this.CacheDirectory = cacheDirectory ?? filesystem.GetDefaultRoamingCacheDirectory(); this.Scheduler = scheduler ?? BlobCache.TaskpoolScheduler; // Here, we're not actually caching the requests directly (i.e. as // byte[]s), but as the "replayed result of the request", in the // AsyncSubject - this makes the code infinitely simpler because // we don't have to keep a separate list of "in-flight reads" vs // "already completed and cached reads" memoizedRequests = new MemoizingMRUCache<string, AsyncSubject<byte[]>>( (x, c) => FetchOrWriteBlobFromDisk(x, c, false), 20, invalidateCallback); var cacheIndex = FetchOrWriteBlobFromDisk(BlobCacheIndexKey, null, true) .Catch(Observable.Return(new byte[0])) .Select(x => Encoding.UTF8.GetString(x, 0, x.Length).Split('\n') .SelectMany(ParseCacheIndexEntry) .ToDictionary(y => y.Key, y => y.Value)) .Select(x => new ConcurrentDictionary<string, CacheIndexEntry>(x)); cacheIndex.Subscribe(x => CacheIndex = x); flushThreadSubscription = Disposable.Empty; if (!ModeDetector.InUnitTestRunner()) { flushThreadSubscription = actionTaken .Where(_ => CacheIndex != null) .Throttle(TimeSpan.FromSeconds(30), Scheduler) .SelectMany(_ => FlushCacheIndex(true)) .Subscribe(_ => this.Log().Debug("Flushing cache")); } this.Log().Info("{0} entries in blob cache index", CacheIndex.Count); }
public PortableUpdateVariantHandler( IUpdateDownloader updateDownloader, IProcessStartProvider processStartProvider, IFilesystemProvider filesystem, IApplicationPathsProvider pathsProvider, IAssemblyProvider assemblyProvider, IApplicationState applicationState) { this.updateDownloader = updateDownloader; this.processStartProvider = processStartProvider; this.filesystem = filesystem; this.pathsProvider = pathsProvider; this.assemblyProvider = assemblyProvider; this.applicationState = applicationState; }
public ConfigurationProvider(IApplicationPathsProvider paths, IFilesystemProvider filesystemProvider) { this.paths = paths; this.filesystem = filesystemProvider; this.eventDispatcher = new SynchronizedEventDispatcher(this); this.migrations = new Func <XDocument, XDocument>[] { this.MigrateV1ToV2, this.MigrateV2ToV3, this.MigrateV3ToV4, this.MigrateV4ToV5, this.MigrateV5ToV6 }; }
public EncryptedBlobCache( string cacheDirectory = null, IEncryptionProvider encryptionProvider = null, IFilesystemProvider filesystemProvider = null, IScheduler scheduler = null, Action<AsyncSubject<byte[]>> invalidatedCallback = null) : base(cacheDirectory, filesystemProvider, scheduler, invalidatedCallback) { this.encryption = encryptionProvider ?? Locator.Current.GetService<IEncryptionProvider>(); if (this.encryption == null) { throw new Exception("No IEncryptionProvider available. This should never happen, your DependencyResolver is broken"); } }
public Scheduler(IMongoSession session, IBuilderCapability builderCapability, IFilesystemProvider filesystemProvider, BuildPublisher publisher, Builder builder, ILogger logger) { Session = session; BuilderCapability = builderCapability; FilesystemProvider = filesystemProvider; Publisher = publisher; Builder = builder; Logger = logger; taskHandles = new Dictionary<ObjectId, Task>(); }
public EncryptedBlobCache( string cacheDirectory = null, IEncryptionProvider encryptionProvider = null, IFilesystemProvider filesystemProvider = null, IScheduler scheduler = null, Action <AsyncSubject <byte[]> > invalidatedCallback = null) : base(cacheDirectory, filesystemProvider, scheduler, invalidatedCallback) { this.encryption = encryptionProvider ?? Locator.Current.GetService <IEncryptionProvider>(); if (this.encryption == null) { throw new Exception("No IEncryptionProvider available. This should never happen, your DependencyResolver is broken"); } }
public FileWatcher(IFilesystemProvider filesystem, FileWatcherMode mode, string directory, TimeSpan existenceCheckingInterval, string filter = "*.*") { this.filesystem = filesystem; this.mode = mode; this.filter = filter; this.Directory = directory.TrimEnd(Path.DirectorySeparatorChar) + Path.DirectorySeparatorChar; this.watcher = this.TryToCreateWatcher(this.Directory); this.existenceCheckingTimer = new Timer() { AutoReset = true, Interval = existenceCheckingInterval.TotalMilliseconds, Enabled = true, }; this.existenceCheckingTimer.Elapsed += (o, e) => this.CheckExistence(); }
protected PersistentBlobCache(string cacheDirectory = null, IFilesystemProvider filesystemProvider = null, IScheduler scheduler = null) { this.CacheDirectory = cacheDirectory ?? GetDefaultRoamingCacheDirectory(); this.Scheduler = scheduler ?? RxApp.TaskpoolScheduler; this.filesystem = filesystemProvider ?? new SimpleFilesystemProvider(); // Here, we're not actually caching the requests directly (i.e. as // byte[]s), but as the "replayed result of the request", in the // AsyncSubject - this makes the code infinitely simpler because // we don't have to keep a separate list of "in-flight reads" vs // "already completed and cached reads" MemoizedRequests = new MemoizingMRUCache <string, AsyncSubject <byte[]> >( (x, c) => FetchOrWriteBlobFromDisk(x, c, false), 20); filesystem.CreateRecursive(CacheDirectory); FetchOrWriteBlobFromDisk(BlobCacheIndexKey, null, true) .Catch(Observable.Return(new byte[0])) .Select(x => Encoding.UTF8.GetString(x, 0, x.Length).Split('\n') .SelectMany(ParseCacheIndexEntry) .ToDictionary(y => y.Key, y => y.Value)) .Select(x => new ConcurrentDictionary <string, CacheIndexEntry>(x)) .Subscribe(x => CacheIndex = x); flushThreadSubscription = Disposable.Empty; if (!RxApp.InUnitTestRunner()) { flushThreadSubscription = actionTaken .Where(_ => CacheIndex != null) .Throttle(TimeSpan.FromSeconds(30), Scheduler) .SelectMany(_ => FlushCacheIndex(true)) .Subscribe(_ => { log.Debug("Flushing cache"); lastFlushTime = Scheduler.Now; }); } log.Info("{0} entries in blob cache index", CacheIndex.Count); }
public DirectoryWatcher(IFilesystemProvider filesystem, string directory, TimeSpan backoffInterval, TimeSpan existenceCheckingInterval) : base(filesystem, FileWatcherMode.All, directory, existenceCheckingInterval) { if (backoffInterval.Ticks < 0) throw new ArgumentException("backoffInterval must be >= 0"); this.backoffTimer = new Timer() { AutoReset = false, Interval = backoffInterval.TotalMilliseconds, }; this.backoffTimer.Elapsed += (o, e) => { string currentNotifyingSubPath; lock (this.currentNotifyingSubPathLock) { currentNotifyingSubPath = this.currentNotifyingSubPath; this.currentNotifyingSubPath = null; } this.OnDirectoryChanged(currentNotifyingSubPath); }; }
public DirectoryWatcher(IFilesystemProvider filesystem, string directory, TimeSpan backoffInterval, TimeSpan existenceCheckingInterval) : base(filesystem, FileWatcherMode.All, directory, existenceCheckingInterval) { if (backoffInterval.Ticks < 0) { throw new ArgumentException("backoffInterval must be >= 0"); } this.backoffTimer = new Timer() { AutoReset = false, Interval = backoffInterval.TotalMilliseconds, }; this.backoffTimer.Elapsed += (o, e) => { string currentNotifyingSubPath; lock (this.currentNotifyingSubPathLock) { currentNotifyingSubPath = this.currentNotifyingSubPath; this.currentNotifyingSubPath = null; } this.OnDirectoryChanged(currentNotifyingSubPath); }; }
public ConfigFolderCleaner(IApplicationPathsProvider applicationPathsProvider, IFilesystemProvider filesystemProvider) { this.applicationPathsProvider = applicationPathsProvider; this.filesystemProvider = filesystemProvider; }
public InstallerCertificateVerifier(IAssemblyProvider assemblyProvider, IFilesystemProvider filesystemProvider) { this.assemblyProvider = assemblyProvider; this.filesystemProvider = filesystemProvider; }
public UpdateDownloader(IApplicationPathsProvider pathsProvider, IFilesystemProvider filesystemProvider, IInstallerCertificateVerifier installerVerifier) { this.downloadsDir = pathsProvider.UpdatesDownloadPath; this.filesystemProvider = filesystemProvider; this.installerVerifier = installerVerifier; }
public void Init() { _filesystemProvider = Locator.Current.GetService <IFilesystemProvider>(); GetLocalMachineCache(); GetSecretLocalMachineCache(); }
public CPersistentBlobCache(string cacheDirectory, IFilesystemProvider fs) : base(cacheDirectory, fs, RxApp.TaskpoolScheduler) { }
public ConflictFileManager(IFilesystemProvider filesystemProvider, ISyncthingManager syncthingManager) { this.filesystemProvider = filesystemProvider; this.syncthingManager = syncthingManager; }
public CEncryptedBlobCache(string cacheDirectory, IFilesystemProvider fsProvider) : base(cacheDirectory, fsProvider, RxApp.TaskpoolScheduler) { }
public ConflictFileManager(IFilesystemProvider filesystemProvider) { this.filesystemProvider = filesystemProvider; }
protected EncryptedBlobCache(string cacheDirectory = null, IFilesystemProvider filesystemProvider = null, IScheduler scheduler = null) : base(cacheDirectory, filesystemProvider, scheduler) { }
public ReadonlyFileSystemProvider(IFilesystemProvider inner = null) { _inner = inner ?? new SimpleFilesystemProvider(); }
public DirectoryWatcherFactory(IFilesystemProvider filesystem) { this.filesystem = filesystem; }
public DefaultMicrosoftBuildProviderEndpoint(IFilesystemProvider provider, IMicrosoftProjectResolver resolver) { _provider = provider; _resolver = resolver; }
public BuildPublisher(IFilesystemProvider filesystemProvider) { this.FilesystemProvider = filesystemProvider; }