noms

package
v0.40.4 Latest Latest
Warning

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

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Overview

Package nbf provides TableReadCloser and TableWriteCloser implementations for working with dolt tables in noms.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SqlRowFromTuples

func SqlRowFromTuples(sch schema.Schema, key, val types.Tuple) (sql.Row, error)

SqlRowFromTuples constructs a go-mysql-server/sql.Row from Noms tuples.

Types

type CardinalityCounter

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

func NewCardinalityCounter

func NewCardinalityCounter() *CardinalityCounter

type InRangeCheck

type InRangeCheck interface {
	// Check is a call made as the reader reads through values to check that the next value either being read is valid
	// and whether it should be skipped or returned.
	Check(ctx context.Context, tuple types.Tuple) (valid bool, skip bool, err error)
}

InRangeCheck evaluates tuples to determine whether they are valid and/or should be skipped.

type InRangeCheckAlways

type InRangeCheckAlways struct{}

InRangeCheckAlways will always return that the given tuple is valid and not to be skipped.

func (InRangeCheckAlways) Check

func (InRangeCheckAlways) Check(context.Context, types.Tuple) (valid bool, skip bool, err error)

type InRangeCheckNever

type InRangeCheckNever struct{}

InRangeCheckNever will always return that the given tuple is not valid.

func (InRangeCheckNever) Check

func (InRangeCheckNever) Check(context.Context, types.Tuple) (valid bool, skip bool, err error)

type InRangeCheckPartial

type InRangeCheckPartial types.Tuple

InRangeCheckPartial will check if the given tuple contains the aliased tuple as a partial key.

func (InRangeCheckPartial) Check

func (ircp InRangeCheckPartial) Check(_ context.Context, t types.Tuple) (valid bool, skip bool, err error)

type KeyIterator

type KeyIterator interface {
	// Next returns the next key in the collection. When all keys are exhausted nil, io.EOF must be returned.
	Next() (types.Value, error)
}

KeyIterator is an interface for iterating through a collection of keys

type NomsMapReader

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

NomsMapReader is a TableReader that reads rows from a noms table which is stored in a types.Map where the key is a types.Value and the value is a types.Tuple of field values.

func NewNomsMapReader

func NewNomsMapReader(ctx context.Context, m types.Map, sch schema.Schema) (*NomsMapReader, error)

NewNomsMapReader creates a NomsMapReader for a given noms types.Map

func (*NomsMapReader) Close

func (nmr *NomsMapReader) Close(ctx context.Context) error

Close should release resources being held

func (*NomsMapReader) GetSchema

func (nmr *NomsMapReader) GetSchema() schema.Schema

GetSchema gets the schema of the rows that this reader will return

func (*NomsMapReader) ReadRow

func (nmr *NomsMapReader) ReadRow(ctx context.Context) (row.Row, error)

ReadRow reads a row from a table. If there is a bad row the returned error will be non nil, and callin IsBadRow(err) will be return true. This is a potentially non-fatal error and callers can decide if they want to continue on a bad row, or fail.

func (*NomsMapReader) VerifySchema

func (nmr *NomsMapReader) VerifySchema(outSch schema.Schema) (bool, error)

VerifySchema checks that the incoming schema matches the schema from the existing table

type NomsMapReaderForKeys

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

NomsMapReaderForKeys implements TableReadCloser

func NewNomsMapReaderForKeyItr

func NewNomsMapReaderForKeyItr(m types.Map, sch schema.Schema, keyItr KeyIterator) *NomsMapReaderForKeys

NewNomsMapReaderForKeyItr creates a NomsMapReaderForKeys for a given noms types.Map, and a list of keys

func NewNomsMapReaderForKeys

func NewNomsMapReaderForKeys(m types.Map, sch schema.Schema, keys []types.Tuple) *NomsMapReaderForKeys

NewNomsMapReaderForKeys creates a NomsMapReaderForKeys for a given noms types.Map, and a list of keys

func (*NomsMapReaderForKeys) Close

func (nmr *NomsMapReaderForKeys) Close(ctx context.Context) error

Close should release resources being held

func (*NomsMapReaderForKeys) GetSchema

func (nmr *NomsMapReaderForKeys) GetSchema() schema.Schema

GetSchema gets the schema of the rows being read.

func (*NomsMapReaderForKeys) ReadRow

func (nmr *NomsMapReaderForKeys) ReadRow(ctx context.Context) (row.Row, error)

ReadRow reads a row from a table. If there is a bad row the returned error will be non nil, and calling IsBadRow(err) will be return true. This is a potentially non-fatal error and callers can decide if they want to continue on a bad row, or fail.

func (*NomsMapReaderForKeys) VerifySchema

func (nmr *NomsMapReaderForKeys) VerifySchema(outSch schema.Schema) (bool, error)

VerifySchema checks that the incoming schema matches the schema from the existing table

type NomsRangeReader

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

NomsRangeReader reads values in one or more ranges from a map

func NewNomsRangeReader

func NewNomsRangeReader(sch schema.Schema, m types.Map, ranges []*ReadRange) *NomsRangeReader

NewNomsRangeReader creates a NomsRangeReader

func (*NomsRangeReader) Close

func (nrr *NomsRangeReader) Close(ctx context.Context) error

Close should release resources being held

func (*NomsRangeReader) GetSchema

func (nrr *NomsRangeReader) GetSchema() schema.Schema

GetSchema gets the schema of the rows being read.

func (*NomsRangeReader) ReadKV

func (nrr *NomsRangeReader) ReadKV(ctx context.Context) (types.Tuple, types.Tuple, error)

func (*NomsRangeReader) ReadKey

func (nrr *NomsRangeReader) ReadKey(ctx context.Context) (types.Tuple, error)

func (*NomsRangeReader) ReadRow

func (nrr *NomsRangeReader) ReadRow(ctx context.Context) (row.Row, error)

ReadRow reads a row from a table. If there is a bad row the returned error will be non nil, and calling IsBadRow(err) will be return true. This is a potentially non-fatal error and callers can decide if they want to continue on a bad row, or fail.

func (*NomsRangeReader) VerifySchema

func (nrr *NomsRangeReader) VerifySchema(outSch schema.Schema) (bool, error)

VerifySchema checks that the incoming schema matches the schema from the existing table

type ReadRange

type ReadRange struct {
	// Start is a Dolt map key which is the starting point (or ending point if Reverse is true)
	Start types.Tuple
	// Inclusive says whether the Start key should be included in the range.
	Inclusive bool
	// Reverse says if the range should be read in reverse (from high to low) instead of the default (low to high)
	Reverse bool
	// Check is a callb made as the reader reads through values to check that the next value being read is in the range.
	Check InRangeCheck
}

ReadRange represents a range of values to be read

func NewRangeEndingAt

func NewRangeEndingAt(key types.Tuple, inRangeCheck InRangeCheck) *ReadRange

NewRangeEndingAt creates a range with a starting key which will be iterated in reverse

func NewRangeEndingBefore

func NewRangeEndingBefore(key types.Tuple, inRangeCheck InRangeCheck) *ReadRange

NewRangeEndingBefore creates a range starting before the provided key iterating in reverse

func NewRangeStartingAfter

func NewRangeStartingAfter(key types.Tuple, inRangeCheck InRangeCheck) *ReadRange

NewRangeStartingAfter creates a range starting after the provided key

func NewRangeStartingAt

func NewRangeStartingAt(key types.Tuple, inRangeCheck InRangeCheck) *ReadRange

NewRangeStartingAt creates a range with a starting key

type SliceOfKeysIterator

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

SliceOfKeysIterator is a KeyIterator implementation backed by a slice of keys which are iterated in order

func (*SliceOfKeysIterator) Next

func (sokItr *SliceOfKeysIterator) Next() (types.Value, error)

Next returns the next key in the slice. When all keys are exhausted nil, io.EOF is be returned.

type StatsCB

type StatsCB func(stats types.AppliedEditStats)

Jump to

Keyboard shortcuts

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