github.com/zuoyebang/bitalostable@v1.0.1-0.20240229032404-e3b99a834294/error_iter.go (about)

     1  // Copyright 2018 The LevelDB-Go and Pebble and Bitalostored 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 bitalostable
     6  
     7  import (
     8  	"github.com/zuoyebang/bitalostable/internal/base"
     9  	"github.com/zuoyebang/bitalostable/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, []byte) {
    24  	return nil, nil
    25  }
    26  
    27  func (c *errorIter) SeekPrefixGE(
    28  	prefix, key []byte, flags base.SeekGEFlags,
    29  ) (*base.InternalKey, []byte) {
    30  	return nil, nil
    31  }
    32  
    33  func (c *errorIter) SeekLT(key []byte, flags base.SeekLTFlags) (*InternalKey, []byte) {
    34  	return nil, nil
    35  }
    36  
    37  func (c *errorIter) First() (*InternalKey, []byte) {
    38  	return nil, nil
    39  }
    40  
    41  func (c *errorIter) Last() (*InternalKey, []byte) {
    42  	return nil, nil
    43  }
    44  
    45  func (c *errorIter) Next() (*InternalKey, []byte) {
    46  	return nil, nil
    47  }
    48  
    49  func (c *errorIter) Prev() (*InternalKey, []byte) {
    50  	return nil, nil
    51  }
    52  
    53  func (c *errorIter) Error() error {
    54  	return c.err
    55  }
    56  
    57  func (c *errorIter) Close() error {
    58  	return c.err
    59  }
    60  
    61  func (c *errorIter) String() string {
    62  	return "error"
    63  }
    64  
    65  func (c *errorIter) SetBounds(lower, upper []byte) {}
    66  
    67  type errorKeyspanIter struct {
    68  	err error
    69  }
    70  
    71  // errorKeyspanIter implements the keyspan.FragmentIterator interface.
    72  var _ keyspan.FragmentIterator = (*errorKeyspanIter)(nil)
    73  
    74  func newErrorKeyspanIter(err error) *errorKeyspanIter {
    75  	return &errorKeyspanIter{err: err}
    76  }
    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" }