github.com/cockroachdb/pebble@v1.1.2/objstorage/noop_readahead.go (about) 1 // Copyright 2023 The LevelDB-Go and Pebble Authors. All rights reserved. Use 2 // of this source code is governed by a BSD-style license that can be found in 3 // the LICENSE file. 4 5 package objstorage 6 7 import "context" 8 9 // NoopReadHandle can be used by Readable implementations that don't 10 // support read-ahead. 11 type NoopReadHandle struct { 12 readable Readable 13 } 14 15 // MakeNoopReadHandle initializes a NoopReadHandle. 16 func MakeNoopReadHandle(r Readable) NoopReadHandle { 17 return NoopReadHandle{readable: r} 18 } 19 20 var _ ReadHandle = (*NoopReadHandle)(nil) 21 22 // ReadAt is part of the ReadHandle interface. 23 func (h *NoopReadHandle) ReadAt(ctx context.Context, p []byte, off int64) error { 24 return h.readable.ReadAt(ctx, p, off) 25 } 26 27 // Close is part of the ReadHandle interface. 28 func (*NoopReadHandle) Close() error { return nil } 29 30 // SetupForCompaction is part of the ReadHandle interface. 31 func (*NoopReadHandle) SetupForCompaction() {} 32 33 // RecordCacheHit is part of the ReadHandle interface. 34 func (*NoopReadHandle) RecordCacheHit(_ context.Context, offset, size int64) {}