コード例 #1
0
ファイル: RoutedCollection.cs プロジェクト: Pater1/Hotplay
        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);
        }
コード例 #2
0
ファイル: RoutedCollection.cs プロジェクト: Pater1/Hotplay
        public RoutedCollection(ChainedFileSystem chainedFileSystem, ICollection collection) : this()
        {
            this.collection        = collection;
            this.chainedFileSystem = chainedFileSystem;

            //DebugChildren = GetChildrenAsync(CancellationToken.None).RunSync().ToList();
        }
コード例 #3
0
        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;
        }
コード例 #4
0
ファイル: DocumentPredictor.cs プロジェクト: Pater1/Hotplay
        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");
                }
            });
        }
コード例 #5
0
 public RoutedDocument(ChainedFileSystem chainedFileSystem, IDocument baseDocument)
 {
     this.baseDocument      = baseDocument;
     this.chainedFileSystem = chainedFileSystem;
 }