goskipiter

package
v0.0.0-...-4b38c65 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Iterator

type Iterator struct {
	// contains filtered or unexported fields
}

Iterator wraps goskiplist's iterator, which is a bit janky; seeking doesn't play nice with the iteration idiom. If you seek, then iterate using the examples provided in the godoc, your iteration will always skip the first result. It would be less error prone and astonishing if Seek meant that the next call to Next() would give you what you expect.

func New

func New(inner skiplist.Iterator) *Iterator

func (*Iterator) Close

func (iter *Iterator) Close()

Close this iterator to reap resources associated with it. While not strictly required, it will provide extra hints for the garbage collector.

func (*Iterator) Key

func (iter *Iterator) Key() interface{}

Key returns the current key.

func (*Iterator) Next

func (iter *Iterator) Next() (ok bool)

Next returns true if the iterator contains subsequent elements and advances its state to the next element if that is possible.

func (*Iterator) Previous

func (iter *Iterator) Previous() (ok bool)

Previous returns true if the iterator contains previous elements and rewinds its state to the previous element if that is possible.

func (*Iterator) Seek

func (iter *Iterator) Seek(key interface{}) (ok bool)

Seek reduces iterative seek costs for searching forward into the Skip List by remarking the range of keys over which it has scanned before. If the requested key occurs prior to the point, the Skip List will start searching as a safeguard. It returns true if the key is within the known range of the list.

func (*Iterator) Value

func (iter *Iterator) Value() interface{}

Value returns the current value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL