Read implements backend.Reader
(ctx context.Context, name string, keypath backend.KeyPath, _ *backend.CacheInfo)
| 361 | |
| 362 | // Read implements backend.Reader |
| 363 | func (rw *readerWriter) Read(ctx context.Context, name string, keypath backend.KeyPath, _ *backend.CacheInfo) (io.ReadCloser, int64, error) { |
| 364 | keypath = backend.KeyPathWithPrefix(keypath, rw.cfg.Prefix) |
| 365 | derivedCtx, span := tracer.Start(ctx, "gcs.Read") |
| 366 | defer span.End() |
| 367 | |
| 368 | span.SetAttributes(attribute.String("object", name)) |
| 369 | |
| 370 | b, _, err := rw.readAll(derivedCtx, backend.ObjectFileName(keypath, name)) |
| 371 | if err != nil { |
| 372 | span.SetStatus(codes.Error, "") |
| 373 | } |
| 374 | return io.NopCloser(bytes.NewReader(b)), int64(len(b)), readError(err) |
| 375 | } |
| 376 | |
| 377 | // ReadRange implements backend.Reader |
| 378 | func (rw *readerWriter) ReadRange(ctx context.Context, name string, keypath backend.KeyPath, offset uint64, buffer []byte, _ *backend.CacheInfo) error { |
nothing calls this directly
no test coverage detected