public async Task <IReadOnlyCollection <IEntry> > GetChildrenAsync(CancellationToken ct) { IReadOnlyCollection <IEntry> wrapAndRet = await collection.GetChildrenAsync(ct); IEntry[] ret = new IEntry[wrapAndRet.Count]; ChainedFileSystem fileSystem = chainedFileSystem; int i = 0; foreach (var r in wrapAndRet) { int j = i++; if (r is IDocument) { ret[j] = new RoutedDocument(fileSystem, r as IDocument); } else { ret[j] = new RoutedCollection(fileSystem, r as ICollection); } } //Parallel.ForEach(wrapAndRet, r => { // int j = i++; // if(r is IDocument) { // ret[j] = new RoutedDocument(fileSystem, r as IDocument); // } else { // ret[j] = new RoutedCollection(fileSystem, r as ICollection); // } //}); return(ret); }
public RoutedCollection(ChainedFileSystem chainedFileSystem, ICollection collection) : this() { this.collection = collection; this.chainedFileSystem = chainedFileSystem; //DebugChildren = GetChildrenAsync(CancellationToken.None).RunSync().ToList(); }
public NetworkAccessServer(WebSocket socket, ulong key = 0) { Key = key; Socket = socket; ChainedFileSystem FileSystem = new ChainedFileSystem(); IFileChain[] chains = new IFileChain[] { new LocalDiskAccessFileChain(new LocalDiskAccessFileChain.LocalDiskAccessFileChain_Options() { RootPath = @"E:\\Testing" }, FileSystem) }; FileSystem.SetupFileChain(chains); this.FileSystem = FileSystem; }
public DocumentPredictor(IDocumentStore store, IDocumentPredictor predictor, ICacheAllocator allocator, ChainedFileSystem predictOnFileSystem) { Store = store; Predictor = predictor; Allocator = allocator; Allocator.OnDeallocate.Add(async(x) => { await Store.Remove(x); }); ThreadPool.QueueUserWorkItem(async(x) => { try { RequestLockManager.LockAndWait("DocumentPredictor_ctor"); while (FileSystem == null) { await Task.Delay(10); } await PredicitiveFillCache(0, CancellationToken.None); }finally{ RequestLockManager.Unlock("DocumentPredictor_ctor"); } }); }
public RoutedDocument(ChainedFileSystem chainedFileSystem, IDocument baseDocument) { this.baseDocument = baseDocument; this.chainedFileSystem = chainedFileSystem; }