github.com/cockroachdb/pebble@v1.1.1-0.20240513155919-3622ade60459/error_iter.go (about) 1 // Copyright 2018 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 pebble 6 7 import ( 8 "github.com/cockroachdb/pebble/internal/base" 9 "github.com/cockroachdb/pebble/internal/keyspan" 10 ) 11 12 type errorIter struct { 13 err error 14 } 15 16 // errorIter implements the base.InternalIterator interface. 17 var _ internalIterator = (*errorIter)(nil) 18 19 func newErrorIter(err error) *errorIter { 20 return &errorIter{err: err} 21 } 22 23 func (c *errorIter) SeekGE(key []byte, flags base.SeekGEFlags) (*InternalKey, base.LazyValue) { 24 return nil, base.LazyValue{} 25 } 26 27 func (c *errorIter) SeekPrefixGE( 28 prefix, key []byte, flags base.SeekGEFlags, 29 ) (*base.InternalKey, base.LazyValue) { 30 return nil, base.LazyValue{} 31 } 32 33 func (c *errorIter) SeekLT(key []byte, flags base.SeekLTFlags) (*InternalKey, base.LazyValue) { 34 return nil, base.LazyValue{} 35 } 36 37 func (c *errorIter) First() (*InternalKey, base.LazyValue) { 38 return nil, base.LazyValue{} 39 } 40 41 func (c *errorIter) Last() (*InternalKey, base.LazyValue) { 42 return nil, base.LazyValue{} 43 } 44 45 func (c *errorIter) Next() (*InternalKey, base.LazyValue) { 46 return nil, base.LazyValue{} 47 } 48 49 func (c *errorIter) Prev() (*InternalKey, base.LazyValue) { 50 return nil, base.LazyValue{} 51 } 52 53 func (c *errorIter) NextPrefix([]byte) (*InternalKey, base.LazyValue) { 54 return nil, base.LazyValue{} 55 } 56 57 func (c *errorIter) Error() error { 58 return c.err 59 } 60 61 func (c *errorIter) Close() error { 62 return c.err 63 } 64 65 func (c *errorIter) String() string { 66 return "error" 67 } 68 69 func (c *errorIter) SetBounds(lower, upper []byte) {} 70 71 type errorKeyspanIter struct { 72 err error 73 } 74 75 // errorKeyspanIter implements the keyspan.FragmentIterator interface. 76 var _ keyspan.FragmentIterator = (*errorKeyspanIter)(nil) 77 78 func newErrorKeyspanIter(err error) *errorKeyspanIter { 79 return &errorKeyspanIter{err: err} 80 } 81 82 func (*errorKeyspanIter) SeekGE(key []byte) *keyspan.Span { return nil } 83 func (*errorKeyspanIter) SeekLT(key []byte) *keyspan.Span { return nil } 84 func (*errorKeyspanIter) First() *keyspan.Span { return nil } 85 func (*errorKeyspanIter) Last() *keyspan.Span { return nil } 86 func (*errorKeyspanIter) Next() *keyspan.Span { return nil } 87 func (*errorKeyspanIter) Prev() *keyspan.Span { return nil } 88 func (i *errorKeyspanIter) Error() error { return i.err } 89 func (i *errorKeyspanIter) Close() error { return i.err } 90 func (*errorKeyspanIter) String() string { return "error" }