github.com/cockroachdb/pebble@v0.0.0-20231214172447-ab4952c5f87b/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  	"context"
     9  
    10  	"github.com/cockroachdb/pebble/internal/base"
    11  	"github.com/cockroachdb/pebble/internal/keyspan"
    12  )
    13  
    14  type errorIter struct {
    15  	err error
    16  }
    17  
    18  // errorIter implements the base.InternalIterator interface.
    19  var _ internalIterator = (*errorIter)(nil)
    20  
    21  func (c *errorIter) SeekGE(key []byte, flags base.SeekGEFlags) (*InternalKey, base.LazyValue) {
    22  	return nil, base.LazyValue{}
    23  }
    24  
    25  func (c *errorIter) SeekPrefixGE(
    26  	prefix, key []byte, flags base.SeekGEFlags,
    27  ) (*base.InternalKey, base.LazyValue) {
    28  	return nil, base.LazyValue{}
    29  }
    30  
    31  func (c *errorIter) SeekLT(key []byte, flags base.SeekLTFlags) (*InternalKey, base.LazyValue) {
    32  	return nil, base.LazyValue{}
    33  }
    34  
    35  func (c *errorIter) First() (*InternalKey, base.LazyValue) {
    36  	return nil, base.LazyValue{}
    37  }
    38  
    39  func (c *errorIter) Last() (*InternalKey, base.LazyValue) {
    40  	return nil, base.LazyValue{}
    41  }
    42  
    43  func (c *errorIter) Next() (*InternalKey, base.LazyValue) {
    44  	return nil, base.LazyValue{}
    45  }
    46  
    47  func (c *errorIter) Prev() (*InternalKey, base.LazyValue) {
    48  	return nil, base.LazyValue{}
    49  }
    50  
    51  func (c *errorIter) NextPrefix([]byte) (*InternalKey, base.LazyValue) {
    52  	return nil, base.LazyValue{}
    53  }
    54  
    55  func (c *errorIter) Error() error {
    56  	return c.err
    57  }
    58  
    59  func (c *errorIter) Close() error {
    60  	return c.err
    61  }
    62  
    63  func (c *errorIter) String() string {
    64  	return "error"
    65  }
    66  
    67  func (c *errorIter) SetBounds(lower, upper []byte) {}
    68  
    69  func (c *errorIter) SetContext(_ context.Context) {}
    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 (*errorKeyspanIter) SeekGE(key []byte) *keyspan.Span { return nil }
    79  func (*errorKeyspanIter) SeekLT(key []byte) *keyspan.Span { return nil }
    80  func (*errorKeyspanIter) First() *keyspan.Span            { return nil }
    81  func (*errorKeyspanIter) Last() *keyspan.Span             { return nil }
    82  func (*errorKeyspanIter) Next() *keyspan.Span             { return nil }
    83  func (*errorKeyspanIter) Prev() *keyspan.Span             { return nil }
    84  func (i *errorKeyspanIter) Error() error                  { return i.err }
    85  func (i *errorKeyspanIter) Close() error                  { return i.err }
    86  func (*errorKeyspanIter) String() string                  { return "error" }