示例#1
0
        /// <inheritdoc />
        public Result <InfoPin> GetPin(string path)
        {
            var ok = _db.Get($"pins/{path}", out var rawStream);

            return((ok && rawStream != null)
                ? Result <InfoPin> .Success(InfoPin.FromStream(rawStream))
                : Result <InfoPin> .Failure(NotFound));
        }
示例#2
0
        /// <inheritdoc />
        public Result <InfoPin[]> ReadAllPins()
        {
            var pinPaths = _db.Search("pins/");

            var result = new List <InfoPin>();

            foreach (var path in pinPaths)
            {
                var ok = _db.Get(path, out var rawStream);
                if (ok && rawStream != null)
                {
                    result.Add(InfoPin.FromStream(rawStream));
                }
            }

            return(Result <InfoPin[]> .Success(result.ToArray()));
        }