public static async Task <Result <Database> > GetOrAddAsync(MdHead mdHead, IIndexer indexer) { var typeInfo = await TypeStoreInfoFactory.GetOrAddTypeStoreAsync(mdHead.Md, mdHead.Id).ConfigureAwait(false); var db = new Database(mdHead.Md, typeInfo, indexer); var typeStores = await typeInfo.GetAllAsync().ConfigureAwait(false); db._dataTreeAddresses = typeStores .ToDictionary(c => c.Item1, c => c.Item2); return(Result.OK(db)); }
public static async Task <Indexer> GetOrAddAsync(MdHead mdHead) { var typeStoreInfo = await TypeStoreInfoFactory .GetOrAddTypeStoreAsync(mdHead.Md, mdHead.Id) .ConfigureAwait(false); var indexer = new Indexer(mdHead.Md, typeStoreInfo); var typeStores = await typeStoreInfo.GetAllAsync() .ConfigureAwait(false); indexer._dataTreeAddresses = typeStores .ToDictionary(c => c.Item1, c => c.Item2); indexer._paths = new ConcurrentDictionary <string, string[]>(indexer._dataTreeAddresses .Where(c => c.Key.Count(t => t == '/') == 2) // ayy.. must be better than this .ToDictionary(c => c.Key, c => c.Key.Split('/')[1].Split('.'))); return(indexer); }