public async Task <Errorable <TreePathStreamedBlob> > GetBlobByTreePath(TreeBlobPath treePath) { var etrm = await trrepo.GetTreeIDByPath(new TreeTreePath(treePath.RootTreeID, treePath.Path.Tree)).ConfigureAwait(continueOnCapturedContext: false); if (etrm.HasErrors) { return(etrm.Errors); } TreeIDPathMapping trm = etrm.Value; if (!trm.TreeID.HasValue) { return(new BlobNotFoundByPathError(treePath)); } // Get the tree: var etr = await trrepo.GetTree(trm.TreeID.Value).ConfigureAwait(continueOnCapturedContext: false); if (etr.HasErrors) { return(etr.Errors); } TreeNode tr = etr.Value; // Get the blob out of this tree: // TODO: standardize name comparison semantics: var trbl = tr.Blobs.SingleOrDefault(x => x.Name == treePath.Path.Name); if (trbl == null) { return(new BlobNotFoundByPathError(treePath)); } // Check for system inconsistency: if (!system.getPathByID(trbl.BlobID).Exists) { return(new BlobNotFoundByPathError(treePath)); } return(new TreePathStreamedBlob(treePath, new StreamedBlob(blrepo, trbl.BlobID))); }
public async Task <Errorable <TreeTree> > GetTreeRecursivelyFromPath(TreeTreePath path) { // Find the TreeID given the path and its root TreeID: var etpm = await getTreeIDByPath(path).ConfigureAwait(continueOnCapturedContext: false); if (etpm.HasErrors) { return(etpm.Errors); } TreeIDPathMapping tpm = etpm.Value; // TODO: TreePathNotFoundError if (!tpm.TreeID.HasValue) { return((TreeTree)null); } // Now use GetTreeRecursively to do the rest: return(await GetTreeRecursively(tpm.TreeID.Value).ConfigureAwait(continueOnCapturedContext: false)); }