cellstore

package module
v0.0.0-...-ae8fcd9 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package cellstore contains a toolkit for building fast and efficient "write-once, read-only" proximity indices. It is using github.com/bsm/sntable for its underlying storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWriter

func NewWriter(w io.Writer, o *sntable.WriterOptions) *sntable.Writer

NewWriter wraps a writer and returns a sntable Writer.

Types

type NearbyEntry

type NearbyEntry struct {
	s2.CellID
	Value    []byte
	Distance s1.Angle
}

NearbyEntry is returned by Nearby search.

type NearbyRS

type NearbyRS struct {
	Entries []NearbyEntry
	// contains filtered or unexported fields
}

NearbyRS is the nearby result set.

func (*NearbyRS) Len

func (n *NearbyRS) Len() int

Len returns the number of entries in the set.

func (*NearbyRS) Release

func (n *NearbyRS) Release()

Release releases the result set.

func (*NearbyRS) Reset

func (n *NearbyRS) Reset()

Reset resets the set.

type Reader

type Reader struct {
	*sntable.Reader
}

Reader represents a cellstore reader

func NewReader

func NewReader(r io.ReaderAt, size int64) (*Reader, error)

NewReader opens a reader.

func (*Reader) FindSection

func (r *Reader) FindSection(cellID s2.CellID) (*SectionIterator, error)

FindSection finds a section right before the the cellID.

func (*Reader) Nearby

func (r *Reader) Nearby(cellID s2.CellID, limit int) (*NearbyRS, error)

Nearby returns a limited iterator over close to cellID. Please note that the iterator entries are not sorted.

type SectionIterator

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

SectionIterator is a section iterator

func (*SectionIterator) CellID

func (i *SectionIterator) CellID() s2.CellID

CellID returns the CellID of the current entry.

func (*SectionIterator) Err

func (i *SectionIterator) Err() error

Err exposes errors.

func (*SectionIterator) Next

func (i *SectionIterator) Next() bool

Next advances the cursor to the next entry in the section.

func (*SectionIterator) NextSection

func (i *SectionIterator) NextSection() bool

NextSection advances the iterator to the next section.

func (*SectionIterator) PrevSection

func (i *SectionIterator) PrevSection() bool

PrevSection advances the cursor to the begin of the previous section.

func (*SectionIterator) Release

func (i *SectionIterator) Release()

Release releases the iterator to the pool.

func (*SectionIterator) Reset

func (i *SectionIterator) Reset() bool

Reset resets the position to the origin.

func (*SectionIterator) Value

func (i *SectionIterator) Value() []byte

Value returns the data of the current entry.

type Sorter

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

Sorter allows to pre-sort entries to avoid out-of-order appends to Writer instances.

func NewSorter

func NewSorter(o *SorterOptions) *Sorter

NewSorter creates a sorter.

func (*Sorter) Append

func (s *Sorter) Append(cellID s2.CellID, data []byte) error

Append appends a cell to the sorter.

func (*Sorter) Close

func (s *Sorter) Close() error

Close closes the sorter and releases all resources.

func (*Sorter) Sort

func (s *Sorter) Sort() (*SorterIterator, error)

Sort sorts appended values and returns an iterator.

type SorterIterator

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

SorterIterator iterates over sorted results

func (*SorterIterator) Close

func (i *SorterIterator) Close() error

Close closes iterator and releases resources.

func (*SorterIterator) NextEntry

func (i *SorterIterator) NextEntry() (s2.CellID, [][]byte, error)

NextEntry reads the next entry. This function will return io.EOF if no more entries can be read.

type SorterOptions

type SorterOptions struct {
	// An optional temporary directory. Default: os.TempDir()
	TempDir string
}

SorterOptions define Sorter specific options.

Jump to

Keyboard shortcuts

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