public async Task <Stream?> Read(string objectName, CancellationToken cancellationToken)
        {
            Stream?result;

            try
            {
                result = await _inner.Read(objectName, cancellationToken);
            }
            catch (OperationCanceledException)
            {
                throw;
            }
            catch
            {
                _writer.Add(_prefix + "read_errors", 1);
                throw;
            }

            _writer.Add(_prefix + "reads", 1);
            if (result is object)
            {
                _writer.Add(_prefix + "reads_length", result.Length);
            }

            return(result);
        }
Exemple #2
0
        public async Task Delete(string objectName, CancellationToken cancellationToken)
        {
            try
            {
                await _inner.Delete(objectName, cancellationToken);
            }
            catch (OperationCanceledException)
            {
                throw;
            }
            catch
            {
                _writer.Add(_prefix + "delete_errors", 1);
                throw;
            }

            _writer.Add(_prefix + "deletes", 1);
        }
        public async Task <IReadOnlyCollection <ObjectInfo> > GetOrdered(string?fromName, CancellationToken cancellationToken)
        {
            IReadOnlyCollection <ObjectInfo> result;

            try
            {
                result = await _inner.GetOrdered(fromName, cancellationToken);
            }
            catch (OperationCanceledException)
            {
                throw;
            }
            catch
            {
                _writer.Add(_prefix + "get_errors", 1);
                throw;
            }

            _writer.Add(_prefix + "gets", 1);
            _writer.Add(_prefix + "objects", result.Count);
            return(result);
        }