prolly

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: 17 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChunkStoreFromVRW

func ChunkStoreFromVRW(vrw types.ValueReadWriter) chunks.ChunkStore

func ConflictDebugFormat

func ConflictDebugFormat(ctx context.Context, m ConflictMap) (string, error)

ConflictDebugFormat formats a ConflictMap.

func DebugFormat

func DebugFormat(ctx context.Context, m Map) (string, error)

DebugFormat formats a Map.

func DiffMaps

func DiffMaps(ctx context.Context, from, to Map, cb DiffFn) error

func KeyDescriptorFromSchema

func KeyDescriptorFromSchema(sch schema.Schema) val.TupleDesc

func MapDescriptorsFromScheam

func MapDescriptorsFromScheam(sch schema.Schema) (kd, vd val.TupleDesc)

func NodeFromValue

func NodeFromValue(v types.Value) tree.Node

func ValueDescriptorFromSchema

func ValueDescriptorFromSchema(sch schema.Schema) val.TupleDesc

func ValueFromConflictMap

func ValueFromConflictMap(m ConflictMap) types.Value

func ValueFromMap

func ValueFromMap(m Map) types.Value

Types

type AddressMap

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

func NewEmptyAddressMap

func NewEmptyAddressMap(ns tree.NodeStore) AddressMap

func (AddressMap) Count

func (c AddressMap) Count() int

func (AddressMap) Editor

func (c AddressMap) Editor() AddressMapEditor

func (AddressMap) Format

func (c AddressMap) Format() *types.NomsBinFormat

func (AddressMap) Get

func (c AddressMap) Get(ctx context.Context, name string) (addr hash.Hash, err error)

func (AddressMap) Has

func (c AddressMap) Has(ctx context.Context, name string) (ok bool, err error)

func (AddressMap) HashOf

func (c AddressMap) HashOf() hash.Hash

func (AddressMap) Height

func (c AddressMap) Height() int

func (AddressMap) IterAll

func (c AddressMap) IterAll(ctx context.Context, cb func(name string, address hash.Hash) error) error

func (AddressMap) WalkAddresses

func (c AddressMap) WalkAddresses(ctx context.Context, cb tree.AddressCb) error

func (AddressMap) WalkNodes

func (c AddressMap) WalkNodes(ctx context.Context, cb tree.NodeCb) error

type AddressMapEditor

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

func (AddressMapEditor) Add

func (wr AddressMapEditor) Add(ctx context.Context, name string, addr hash.Hash) error

func (AddressMapEditor) Delete

func (wr AddressMapEditor) Delete(ctx context.Context, name string) error

func (AddressMapEditor) Flush

func (wr AddressMapEditor) Flush(ctx context.Context) (AddressMap, error)

func (AddressMapEditor) Update

func (wr AddressMapEditor) Update(ctx context.Context, name string, addr hash.Hash) error

type Conflict

type Conflict val.Triple[val.Tuple]

func (Conflict) BaseValue

func (c Conflict) BaseValue() val.Tuple

func (Conflict) OurValue

func (c Conflict) OurValue() val.Tuple

func (Conflict) TheirValue

func (c Conflict) TheirValue() val.Tuple

type ConflictEditor

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

func (ConflictEditor) Add

func (wr ConflictEditor) Add(ctx context.Context, key, ourVal, theirVal, baseVal val.Tuple) error

func (ConflictEditor) Delete

func (wr ConflictEditor) Delete(ctx context.Context, key val.Tuple) error

func (ConflictEditor) Flush

func (wr ConflictEditor) Flush(ctx context.Context) (ConflictMap, error)

type ConflictIter

type ConflictIter kvIter[val.Tuple, Conflict]

type ConflictMap

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

func ConflictMapFromValue

func ConflictMapFromValue(v types.Value, ourSchema, theirSchema, baseSchema schema.Schema, vrw types.ValueReadWriter) ConflictMap

func NewConflictMap

func NewConflictMap(root tree.Node, ns tree.NodeStore, key, ours, theirs, base val.TupleDesc) ConflictMap

func NewEmptyConflictMap

func NewEmptyConflictMap(ns tree.NodeStore, key, ours, theirs, base val.TupleDesc) ConflictMap

func (ConflictMap) Count

func (c ConflictMap) Count() int

func (ConflictMap) Descriptors

func (c ConflictMap) Descriptors() (key, ours, theirs, base val.TupleDesc)

func (ConflictMap) Editor

func (c ConflictMap) Editor() ConflictEditor

func (ConflictMap) Format

func (c ConflictMap) Format() *types.NomsBinFormat

func (ConflictMap) Get

func (c ConflictMap) Get(ctx context.Context, key val.Tuple, cb KeyValueFn[val.Tuple, Conflict]) (err error)

func (ConflictMap) Has

func (c ConflictMap) Has(ctx context.Context, key val.Tuple) (ok bool, err error)

func (ConflictMap) HashOf

func (c ConflictMap) HashOf() hash.Hash

func (ConflictMap) Height

func (c ConflictMap) Height() int

func (ConflictMap) IterAll

func (c ConflictMap) IterAll(ctx context.Context) (ConflictIter, error)

func (ConflictMap) IterOrdinalRange

func (c ConflictMap) IterOrdinalRange(ctx context.Context, start, stop uint64) (ConflictIter, error)

func (ConflictMap) WalkAddresses

func (c ConflictMap) WalkAddresses(ctx context.Context, cb tree.AddressCb) error

func (ConflictMap) WalkNodes

func (c ConflictMap) WalkNodes(ctx context.Context, cb tree.NodeCb) error

type DiffFn

type DiffFn func(context.Context, tree.Diff) error

type KeyValueFn

type KeyValueFn[K, V ~[]byte] func(key K, value V) error

type Map

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

func MapFromValue

func MapFromValue(v types.Value, sch schema.Schema, vrw types.ValueReadWriter) Map

func MergeMaps

func MergeMaps(ctx context.Context, left, right, base Map, cb tree.CollisionFn) (Map, error)

func NewMap

func NewMap(node tree.Node, ns tree.NodeStore, keyDesc, valDesc val.TupleDesc) Map

NewMap creates an empty prolly tree Map

func NewMapFromTuples

func NewMapFromTuples(ctx context.Context, ns tree.NodeStore, keyDesc, valDesc val.TupleDesc, tups ...val.Tuple) (Map, error)

NewMapFromTuples creates a prolly tree Map from slice of sorted Tuples.

func (Map) Count

func (m Map) Count() int

Count returns the number of key-value pairs in the Map.

func (Map) Descriptors

func (m Map) Descriptors() (val.TupleDesc, val.TupleDesc)

Descriptors returns the TupleDesc's from this Map.

func (Map) Format

func (m Map) Format() *types.NomsBinFormat

Format returns the NomsBinFormat of this Map.

func (Map) Get

func (m Map) Get(ctx context.Context, key val.Tuple, cb KeyValueFn[val.Tuple, val.Tuple]) (err error)

Get searches for the key-value pair keyed by |key| and passes the results to the callback. If |key| is not present in the map, a nil key-value pair are passed.

func (Map) Has

func (m Map) Has(ctx context.Context, key val.Tuple) (ok bool, err error)

Has returns true is |key| is present in the Map.

func (Map) HashOf

func (m Map) HashOf() hash.Hash

HashOf returns the Hash of this Map.

func (Map) Height

func (m Map) Height() int

func (Map) IterAll

func (m Map) IterAll(ctx context.Context) (MapIter, error)

IterAll returns a mutableMapIter that iterates over the entire Map.

func (Map) IterOrdinalRange

func (m Map) IterOrdinalRange(ctx context.Context, start, stop uint64) (MapIter, error)

IterOrdinalRange returns a MapIter for the ordinal range beginning at |start| and ending before |stop|.

func (Map) IterRange

func (m Map) IterRange(ctx context.Context, rng Range) (MapIter, error)

IterRange returns a mutableMapIter that iterates over a Range.

func (Map) Last

func (m Map) Last(ctx context.Context) (key, value val.Tuple, err error)

func (Map) Mutate

func (m Map) Mutate() MutableMap

Mutate makes a MutableMap from a Map.

func (Map) Pool

func (m Map) Pool() pool.BuffPool

Pool returns the pool.BuffPool of the underlying tuples' tree.NodeStore

func (Map) WalkAddresses

func (m Map) WalkAddresses(ctx context.Context, cb tree.AddressCb) error

func (Map) WalkNodes

func (m Map) WalkNodes(ctx context.Context, cb tree.NodeCb) error

type MapIter

type MapIter kvIter[val.Tuple, val.Tuple]

type MutableMap

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

MutableMap represents a Map that is able to store mutations in-memory. A MutableMap has two tiers of in-memory storage: pending and applied. All mutations are first written to the pending tier, which may be discarded at any time. However, once ApplyPending() is called, those mutations are moved to the applied tier, and the pending tier is cleared.

func (*MutableMap) ApplyPending

func (mut *MutableMap) ApplyPending(ctx context.Context) error

ApplyPending moves all pending mutations to the underlying map.

func (MutableMap) Delete

func (mut MutableMap) Delete(ctx context.Context, key val.Tuple) error

Delete deletes the pair keyed by |key| from the MutableMap.

func (*MutableMap) DiscardPending

func (mut *MutableMap) DiscardPending(context.Context)

DiscardPending removes all pending mutations.

func (MutableMap) Get

func (mut MutableMap) Get(ctx context.Context, key val.Tuple, cb KeyValueFn[val.Tuple, val.Tuple]) (err error)

Get fetches the Tuple pair keyed by |key|, if it exists, and passes it to |cb|. If the |key| is not present in the MutableMap, a nil Tuple pair is passed to |cb|.

func (MutableMap) Has

func (mut MutableMap) Has(ctx context.Context, key val.Tuple) (ok bool, err error)

Has returns true if |key| is present in the MutableMap.

func (MutableMap) HasEdits

func (mut MutableMap) HasEdits() bool

HasEdits returns true when the MutableMap has performed at least one Put or Delete operation. This does not indicate whether the materialized map contains different values to the contained unedited map.

func (MutableMap) IterAll

func (mut MutableMap) IterAll(ctx context.Context) (MapIter, error)

IterAll returns a mutableMapIter that iterates over the entire MutableMap.

func (MutableMap) IterRange

func (mut MutableMap) IterRange(ctx context.Context, rng Range) (MapIter, error)

IterRange returns a MapIter that iterates over a Range.

func (MutableMap) Map

func (mut MutableMap) Map(ctx context.Context) (Map, error)

Map materializes all pending and applied mutations in the MutableMap.

func (MutableMap) Put

func (mut MutableMap) Put(ctx context.Context, key, value val.Tuple) error

Put adds the Tuple pair |key|, |value| to the MutableMap.

type Range

type Range struct {
	Start, Stop []RangeCut
	Desc        val.TupleDesc
}

Range defines a contiguous set of Tuples bounded by RangeCut predicates. Tuples satisfying all predicates must be included in the Range, but not all Tuples within a Range will satisfy all predicates.

func ClosedRange

func ClosedRange(start, stop val.Tuple, desc val.TupleDesc) Range

ClosedRange defines an inclusive Range of Tuples from |start| to |stop|.

func GreaterOrEqualRange

func GreaterOrEqualRange(start val.Tuple, desc val.TupleDesc) Range

GreaterOrEqualRange defines a Range of Tuples greater than or equal to |start|.

func GreaterRange

func GreaterRange(start val.Tuple, desc val.TupleDesc) Range

GreaterRange defines a Range of Tuples greater than |start|.

func LesserOrEqualRange

func LesserOrEqualRange(stop val.Tuple, desc val.TupleDesc) Range

LesserOrEqualRange defines a Range of Tuples less than or equal to |stop|.

func LesserRange

func LesserRange(stop val.Tuple, desc val.TupleDesc) Range

LesserRange defines a Range of Tuples less than |stop|.

func MergeOverlappingRanges

func MergeOverlappingRanges(ranges ...Range) (merged []Range)

MergeOverlappingRanges merges overlapping ranges.

func OpenRange

func OpenRange(start, stop val.Tuple, desc val.TupleDesc) Range

OpenRange defines a non-inclusive Range of Tuples from |start| to |stop|.

func OpenStartRange

func OpenStartRange(start, stop val.Tuple, desc val.TupleDesc) Range

OpenStartRange defines a half-open Range of Tuples from |start| to |stop|.

func OpenStopRange

func OpenStopRange(start, stop val.Tuple, desc val.TupleDesc) Range

OpenStopRange defines a half-open Range of Tuples from |start| to |stop|.

func SortRanges

func SortRanges(ranges ...Range) []Range

SortRanges sorts ranges by start bound.

func (Range) AboveStart

func (r Range) AboveStart(t val.Tuple) bool

AboveStart returns true if |t| is a member of |r|.

func (Range) BelowStop

func (r Range) BelowStop(t val.Tuple) bool

BelowStop returns true if |t| is a member of |r|.

type RangeCut

type RangeCut struct {
	Value     []byte
	Inclusive bool
	Null      bool
}

RangeCut bounds one dimension of a Range.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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