コード例 #1
0
ファイル: AtomsController.cs プロジェクト: alex-ks/Ecclesia
        public async Task <IActionResult> Get(string kind, string name, [FromQuery] string version)
        {
            try
            {
                var atomId = await _storage.FetchVersionAsync(new AtomId(kind, name, version));

                var content = await _storage.GetContentAsync(atomId);

                return(Ok(new AtomContent
                {
                    Kind = kind,
                    Name = name,
                    Version = atomId.Version,
                    Content = Convert.ToBase64String(content)
                }));
            }
            catch (ArgumentException e)
            {
                return(NotFound(e.Message));
            }
            catch (FormatException e)
            {
                return(BadRequest(e.Message));
            }
        }
コード例 #2
0
        private async Task AtomDfs(AtomId atom, HashSet <AtomId> resolved, List <AtomId> ordered)
        {
            var current = await _storage.FetchVersionAsync(atom);

            var deps = await _storage.GetDependenciesAsync(current);

            foreach (var dep in deps)
            {
                await AtomDfs(dep, resolved, ordered);
            }
            if (!resolved.Contains(current))
            {
                resolved.Add(current);
                ordered.Add(current);
            }
        }