durable

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: 19 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnknownAutoIncrementValue = fmt.Errorf("auto increment set for non-numeric column type")
)

Functions

func NomsMapFromConflictIndex

func NomsMapFromConflictIndex(i ConflictIndex) types.Map

func NomsMapFromIndex

func NomsMapFromIndex(i Index) types.Map

NomsMapFromIndex unwraps the Index and returns the underlying types.Map.

func ProllyMapFromConflictIndex

func ProllyMapFromConflictIndex(i ConflictIndex) prolly.ConflictMap

func ProllyMapFromIndex

func ProllyMapFromIndex(i Index) prolly.Map

ProllyMapFromIndex unwraps the Index and returns the underlying prolly.Map.

func RefFromConflictIndex

func RefFromConflictIndex(ctx context.Context, vrw types.ValueReadWriter, idx ConflictIndex) (types.Ref, error)

RefFromConflictIndex persists |idx| and returns the types.Ref targeting it.

func RefFromIndex

func RefFromIndex(ctx context.Context, vrw types.ValueReadWriter, idx Index) (types.Ref, error)

RefFromIndex persists the Index and returns a types.Ref to it.

func RefFromNomsTable

func RefFromNomsTable(ctx context.Context, table Table) (types.Ref, error)

RefFromNomsTable serialized |table|, and returns its types.Ref.

func VrwFromTable

func VrwFromTable(t Table) types.ValueReadWriter

VrwFromTable returns the types.ValueReadWriter used by |t|. todo(andy): this is a temporary method that will be removed when there is a

general-purpose abstraction to replace types.ValueReadWriter.

Types

type ConflictIndex

type ConflictIndex interface {
	HashOf() (hash.Hash, error)
	Count() uint64
	Format() *types.NomsBinFormat
}

func ConflictIndexFromNomsMap

func ConflictIndexFromNomsMap(m types.Map, vrw types.ValueReadWriter) ConflictIndex

func ConflictIndexFromProllyMap

func ConflictIndexFromProllyMap(m prolly.ConflictMap) ConflictIndex

func NewEmptyConflictIndex

func NewEmptyConflictIndex(ctx context.Context, vrw types.ValueReadWriter, oursSch, theirsSch, baseSch schema.Schema) (ConflictIndex, error)

NewEmptyConflictIndex returns an ConflictIndex with no rows.

type Index

type Index interface {
	// HashOf returns the hash.Hash of this table.
	HashOf() (hash.Hash, error)

	// Count returns the cardinality of the index.
	Count() uint64

	// Empty returns true if the index is empty.
	Empty() bool

	// Format returns the types.NomsBinFormat for this index.
	Format() *types.NomsBinFormat

	// AddColumnToRows adds the column given to the rows data and returns the resulting rows.
	// The |newCol| is present in |newSchema|.
	AddColumnToRows(ctx context.Context, newCol string, newSchema schema.Schema) (Index, error)
	// contains filtered or unexported methods
}

Index represents a Table index.

func IndexFromNomsMap

func IndexFromNomsMap(m types.Map, vrw types.ValueReadWriter) Index

IndexFromNomsMap wraps a types.Map and returns it as an Index.

func IndexFromProllyMap

func IndexFromProllyMap(m prolly.Map) Index

IndexFromProllyMap wraps a prolly.Map and returns it as an Index.

func NewEmptyIndex

func NewEmptyIndex(ctx context.Context, vrw types.ValueReadWriter, sch schema.Schema) (Index, error)

NewEmptyIndex returns an index with no rows.

type IndexSet

type IndexSet interface {
	// HashOf returns the hash.Hash of this table.
	HashOf() (hash.Hash, error)

	// GetIndex gets an index from the set.
	GetIndex(ctx context.Context, sch schema.Schema, name string) (Index, error)

	// PutIndex puts an index into the set.
	PutIndex(ctx context.Context, name string, idx Index) (IndexSet, error)

	// PutNomsIndex puts a noms index into the set.
	// todo(andy): this is a temporary stop-gap while abstracting types.Map
	PutNomsIndex(ctx context.Context, name string, idx types.Map) (IndexSet, error)

	// DropIndex removes an index from the set.
	DropIndex(ctx context.Context, name string) (IndexSet, error)

	// RenameIndex renames index |oldName| to |newName|.
	RenameIndex(ctx context.Context, oldName, newName string) (IndexSet, error)
}

IndexSet stores a collection secondary Indexes.

func NewIndexSet

func NewIndexSet(ctx context.Context, vrw types.ValueReadWriter) IndexSet

NewIndexSet returns an empty IndexSet.

func NewIndexSetWithEmptyIndexes

func NewIndexSetWithEmptyIndexes(ctx context.Context, vrw types.ValueReadWriter, sch schema.Schema) (IndexSet, error)

type Table

type Table interface {
	// HashOf returns the hash.Hash of this table.
	HashOf() (hash.Hash, error)

	// Format returns the types.NomsBinFormat for this table.
	Format() *types.NomsBinFormat

	// GetSchemaHash returns the hash.Hash of this table's schema.
	GetSchemaHash(ctx context.Context) (hash.Hash, error)
	// GetSchema returns this table's schema.
	GetSchema(ctx context.Context) (schema.Schema, error)
	// SetSchema sets this table's schema.
	SetSchema(ctx context.Context, sch schema.Schema) (Table, error)

	// GetTableRows returns this tables rows.
	GetTableRows(ctx context.Context) (Index, error)
	// SetTableRows sets this table's rows.
	SetTableRows(ctx context.Context, rows Index) (Table, error)

	// GetIndexes returns the secondary indexes for this table.
	GetIndexes(ctx context.Context) (IndexSet, error)
	// SetIndexes sets the secondary indexes for this table.
	SetIndexes(ctx context.Context, indexes IndexSet) (Table, error)

	// GetConflicts returns the merge conflicts for this table.
	GetConflicts(ctx context.Context) (conflict.ConflictSchema, ConflictIndex, error)
	// HasConflicts returns true if this table has conflicts.
	HasConflicts(ctx context.Context) (bool, error)
	// SetConflicts sets the merge conflicts for this table.
	SetConflicts(ctx context.Context, sch conflict.ConflictSchema, conflicts ConflictIndex) (Table, error)
	// ClearConflicts removes all merge conflicts for this table.
	ClearConflicts(ctx context.Context) (Table, error)

	// GetConstraintViolations returns the constraint violations for this table.
	GetConstraintViolations(ctx context.Context) (types.Map, error)
	// SetConstraintViolations sets the constraint violations for this table.
	SetConstraintViolations(ctx context.Context, violations types.Map) (Table, error)

	// GetAutoIncrement returns the AUTO_INCREMENT sequence value for this table.
	GetAutoIncrement(ctx context.Context) (uint64, error)
	// SetAutoIncrement sets the AUTO_INCREMENT sequence value for this table.
	SetAutoIncrement(ctx context.Context, val uint64) (Table, error)

	// DebugString returns the table contents for debugging purposes
	DebugString(ctx context.Context) string
}

Table is a Dolt table that can be persisted.

func NewNomsTable

func NewNomsTable(ctx context.Context, vrw types.ValueReadWriter, sch schema.Schema, rows types.Map, indexes IndexSet, autoIncVal types.Value) (Table, error)

NewNomsTable makes a new Table.

func NewTable

func NewTable(ctx context.Context, vrw types.ValueReadWriter, sch schema.Schema, rows Index, indexes IndexSet, autoIncVal types.Value) (Table, error)

NewTable returns a new Table.

func TableFromAddr

func TableFromAddr(ctx context.Context, vrw types.ValueReadWriter, addr hash.Hash) (Table, error)

TableFromAddr deserializes the table in the chunk at |addr|.

Jump to

Keyboard shortcuts

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