Documentation ¶
Index ¶
- Constants
- Variables
- func GetAllTableNames(ctx context.Context, root *RootValue) ([]string, error)
- func GetGeneratedSystemTables(ctx context.Context, root *RootValue) ([]string, error)
- func GetNonSystemTableNames(ctx context.Context, root *RootValue) ([]string, error)
- func GetPersistedSystemTables(ctx context.Context, root *RootValue) ([]string, error)
- func GetRootValueSuperSchema(ctx context.Context, root *RootValue) (*schema.SuperSchema, error)
- func GetSystemTableNames(ctx context.Context, root *RootValue) ([]string, error)
- func GetUnreachableRootCause(err error) error
- func HasDoltPrefix(s string) bool
- func IsInvalidFormatErr(err error) bool
- func IsNotACommit(err error) bool
- func IsNotFoundErr(err error) bool
- func IsReadOnlySystemTable(name string) bool
- func IsRootValUnreachable(err error) bool
- func IsValidBranchRef(dref ref.DoltRef) bool
- func IsValidCommitHash(s string) bool
- func IsValidForeignKeyName(name string) bool
- func IsValidIndexName(name string) bool
- func IsValidTableName(name string) bool
- func IsValidTagRef(dref ref.DoltRef) bool
- func IsValidUserBranchName(name string) bool
- func RunAsyncReplicationThreads(bThreads *sql.BackgroundThreads, ch chan PushArg, destDB *DoltDB, ...) error
- func TodoWorkingSetMeta() *datas.WorkingSetMeta
- func UnionTableNames(ctx context.Context, roots ...*RootValue) ([]string, error)
- func WriteValAndGetRef(ctx context.Context, vrw types.ValueReadWriter, val types.Value) (types.Ref, error)
- type AncestorSpec
- type AsyncPushOnWriteHook
- type BranchWithHash
- type Commit
- func (c *Commit) CanFastForwardTo(ctx context.Context, new *Commit) (bool, error)
- func (c *Commit) CanFastReverseTo(ctx context.Context, new *Commit) (bool, error)
- func (c *Commit) DatasParents() []*datas.Commit
- func (c *Commit) GetAncestor(ctx context.Context, as *AncestorSpec) (*Commit, error)
- func (c *Commit) GetCommitMeta(ctx context.Context) (*datas.CommitMeta, error)
- func (c *Commit) GetParent(ctx context.Context, idx int) (*Commit, error)
- func (c *Commit) GetRootValue(ctx context.Context) (*RootValue, error)
- func (c *Commit) HashOf() (hash.Hash, error)
- func (c *Commit) Height() (uint64, error)
- func (c *Commit) NumParents() (int, error)
- func (c *Commit) ParentHashes(ctx context.Context) ([]hash.Hash, error)
- type CommitFilter
- type CommitHook
- type CommitItr
- type CommitSpec
- type DoltDB
- func (ddb *DoltDB) CSMetricsSummary() string
- func (ddb *DoltDB) CanFastForward(ctx context.Context, branch ref.DoltRef, new *Commit) (bool, error)
- func (ddb *DoltDB) Clone(ctx context.Context, destDB *DoltDB, eventCh chan<- pull.TableFileEvent) error
- func (ddb *DoltDB) Commit(ctx context.Context, valHash hash.Hash, dref ref.DoltRef, cm *datas.CommitMeta) (*Commit, error)
- func (ddb *DoltDB) CommitDanglingWithParentCommits(ctx context.Context, valHash hash.Hash, parentCommits []*Commit, ...) (*Commit, error)
- func (ddb *DoltDB) CommitRoot(ctx context.Context, last, current hash.Hash) (bool, error)
- func (ddb *DoltDB) CommitWithParentCommits(ctx context.Context, valHash hash.Hash, dref ref.DoltRef, ...) (*Commit, error)
- func (ddb *DoltDB) CommitWithParentSpecs(ctx context.Context, valHash hash.Hash, dref ref.DoltRef, ...) (*Commit, error)
- func (ddb *DoltDB) CommitWithWorkingSet(ctx context.Context, headRef ref.DoltRef, workingSetRef ref.WorkingSetRef, ...) (*Commit, error)
- func (ddb *DoltDB) CopyWorkingSet(ctx context.Context, fromWSRef ref.WorkingSetRef, toWSRef ref.WorkingSetRef, ...) error
- func (ddb *DoltDB) DeleteBranch(ctx context.Context, branch ref.DoltRef) error
- func (ddb *DoltDB) DeleteTag(ctx context.Context, tag ref.DoltRef) error
- func (ddb *DoltDB) DeleteWorkingSet(ctx context.Context, workingSetRef ref.WorkingSetRef) error
- func (ddb *DoltDB) DeleteWorkspace(ctx context.Context, workRef ref.DoltRef) error
- func (ddb *DoltDB) ExecuteCommitHooks(ctx context.Context, datasetId string) error
- func (ddb *DoltDB) FastForward(ctx context.Context, branch ref.DoltRef, commit *Commit) error
- func (ddb *DoltDB) Format() *types.NomsBinFormat
- func (ddb *DoltDB) GC(ctx context.Context, uncommitedVals ...hash.Hash) error
- func (ddb *DoltDB) GetBranches(ctx context.Context) ([]ref.DoltRef, error)
- func (ddb *DoltDB) GetBranchesWithHashes(ctx context.Context) ([]BranchWithHash, error)
- func (ddb *DoltDB) GetHeadRefs(ctx context.Context) ([]ref.DoltRef, error)
- func (ddb *DoltDB) GetRefsOfType(ctx context.Context, refTypeFilter map[ref.RefType]struct{}) ([]ref.DoltRef, error)
- func (ddb *DoltDB) GetRemoteRefs(ctx context.Context) ([]ref.DoltRef, error)
- func (ddb *DoltDB) GetRemotesWithHashes(ctx context.Context) ([]RemoteWithHash, error)
- func (ddb *DoltDB) GetTags(ctx context.Context) ([]ref.DoltRef, error)
- func (ddb *DoltDB) GetTagsWithHashes(ctx context.Context) ([]TagWithHash, error)
- func (ddb *DoltDB) GetWorkspaces(ctx context.Context) ([]ref.DoltRef, error)
- func (ddb *DoltDB) Has(ctx context.Context, h hash.Hash) (bool, error)
- func (ddb *DoltDB) HasBranch(ctx context.Context, branchName string) (bool, error)
- func (ddb *DoltDB) HasRef(ctx context.Context, doltRef ref.DoltRef) (bool, error)
- func (ddb *DoltDB) NewBranchAtCommit(ctx context.Context, branchRef ref.DoltRef, commit *Commit) error
- func (ddb *DoltDB) NewPendingCommit(ctx context.Context, roots Roots, headRef ref.DoltRef, parentCommits []*Commit, ...) (*PendingCommit, error)
- func (ddb *DoltDB) NewTagAtCommit(ctx context.Context, tagRef ref.DoltRef, c *Commit, meta *datas.TagMeta) error
- func (ddb *DoltDB) NewWorkspaceAtCommit(ctx context.Context, workRef ref.DoltRef, c *Commit) error
- func (ddb *DoltDB) NomsRoot(ctx context.Context) (hash.Hash, error)
- func (ddb *DoltDB) PullChunks(ctx context.Context, tempDir string, srcDB *DoltDB, targetHash hash.Hash, ...) error
- func (ddb *DoltDB) ReadRootValue(ctx context.Context, h hash.Hash) (*RootValue, error)
- func (ddb *DoltDB) Rebase(ctx context.Context) error
- func (ddb *DoltDB) Resolve(ctx context.Context, cs *CommitSpec, cwb ref.DoltRef) (*Commit, error)
- func (ddb *DoltDB) ResolveAllParents(ctx context.Context, commit *Commit) ([]*Commit, error)
- func (ddb *DoltDB) ResolveCommitRef(ctx context.Context, ref ref.DoltRef) (*Commit, error)
- func (ddb *DoltDB) ResolveParent(ctx context.Context, commit *Commit, parentIdx int) (*Commit, error)
- func (ddb *DoltDB) ResolveTag(ctx context.Context, tagRef ref.TagRef) (*Tag, error)
- func (ddb *DoltDB) ResolveWorkingSet(ctx context.Context, workingSetRef ref.WorkingSetRef) (*WorkingSet, error)
- func (ddb *DoltDB) SetCommitHookLogger(ctx context.Context, wr io.Writer) *DoltDB
- func (ddb *DoltDB) SetCommitHooks(ctx context.Context, postHooks []CommitHook) *DoltDB
- func (ddb *DoltDB) SetHead(ctx context.Context, ref ref.DoltRef, addr hash.Hash) error
- func (ddb *DoltDB) SetHeadToCommit(ctx context.Context, ref ref.DoltRef, cm *Commit) error
- func (ddb *DoltDB) ShallowGC(ctx context.Context) error
- func (ddb *DoltDB) UpdateWorkingSet(ctx context.Context, workingSetRef ref.WorkingSetRef, workingSet *WorkingSet, ...) error
- func (ddb *DoltDB) ValueReadWriter() types.ValueReadWriter
- func (ddb *DoltDB) VisitRefsOfType(ctx context.Context, refTypeFilter map[ref.RefType]struct{}, ...) error
- func (ddb *DoltDB) WriteEmptyRepo(ctx context.Context, initBranch, name, email string) error
- func (ddb *DoltDB) WriteEmptyRepoWithCommitTime(ctx context.Context, initBranch, name, email string, t time.Time) error
- func (ddb *DoltDB) WriteEmptyRepoWithCommitTimeAndDefaultBranch(ctx context.Context, name, email string, t time.Time, init ref.BranchRef) error
- func (ddb *DoltDB) WriteRootValue(ctx context.Context, rv *RootValue) (*RootValue, hash.Hash, error)
- type ErrClientOutOfDate
- type FeatureVersion
- type FilteringCommitItr
- type ForeignKey
- func (fk ForeignKey) DeepEquals(other ForeignKey) bool
- func (fk ForeignKey) EqualDefs(other ForeignKey) bool
- func (fk ForeignKey) HashOf() hash.Hash
- func (fk ForeignKey) IsResolved() bool
- func (fk ForeignKey) IsSelfReferential() bool
- func (fk ForeignKey) ValidateData(ctx context.Context, childSch schema.Schema, ...) error
- func (fk ForeignKey) ValidateReferencedTableSchema(sch schema.Schema) error
- func (fk ForeignKey) ValidateTableSchema(sch schema.Schema) error
- type ForeignKeyCollection
- func (fkc *ForeignKeyCollection) AddKeys(fks ...ForeignKey) error
- func (fkc *ForeignKeyCollection) AllKeys() []ForeignKey
- func (fkc *ForeignKeyCollection) ColumnHasFkRelationship(tag uint64) (ForeignKey, bool)
- func (fkc *ForeignKeyCollection) Contains(foreignKeyName string) bool
- func (fkc *ForeignKeyCollection) Count() int
- func (fkc *ForeignKeyCollection) GetByNameCaseInsensitive(foreignKeyName string) (ForeignKey, bool)
- func (fkc *ForeignKeyCollection) GetByTags(childTags, parentTags []uint64) (ForeignKey, bool)
- func (fkc *ForeignKeyCollection) GetMatchingKey(fk ForeignKey, allSchemas map[string]schema.Schema) (ForeignKey, bool)
- func (fkc *ForeignKeyCollection) Iter(cb func(fk ForeignKey) (stop bool, err error)) error
- func (fkc *ForeignKeyCollection) KeysForTable(tableName string) (declaredFk, referencedByFk []ForeignKey)
- func (fkc *ForeignKeyCollection) Map(ctx context.Context, vrw types.ValueReadWriter) (types.Map, error)
- func (fkc *ForeignKeyCollection) RemoveAndUnresolveTables(ctx context.Context, root *RootValue, tables ...string) error
- func (fkc *ForeignKeyCollection) RemoveKeyByName(foreignKeyName string) bool
- func (fkc *ForeignKeyCollection) RemoveKeys(fks ...ForeignKey)
- func (fkc *ForeignKeyCollection) RemoveTables(ctx context.Context, tables ...string) error
- func (fkc *ForeignKeyCollection) RenameTable(oldTableName, newTableName string)
- func (fkc *ForeignKeyCollection) Stage(ctx context.Context, fksToAdd []ForeignKey, fksToRemove []ForeignKey)
- func (fkc *ForeignKeyCollection) Tables() map[string]struct{}
- type ForeignKeyReferentialAction
- type ForeignKeyViolationError
- type LogHook
- type MergeState
- type PendingCommit
- type PushArg
- type PushOnWriteHook
- type RemoteWithHash
- type RootType
- type RootTypeSet
- type RootValue
- func (root *RootValue) CreateEmptyTable(ctx context.Context, tName string, sch schema.Schema) (*RootValue, error)
- func (root *RootValue) DebugString(ctx context.Context, transitive bool) string
- func (root *RootValue) GenerateTagsForNewColColl(ctx context.Context, tableName string, cc *schema.ColCollection) (*schema.ColCollection, error)
- func (root *RootValue) GenerateTagsForNewColumns(ctx context.Context, tableName string, newColNames []string, ...) ([]uint64, error)
- func (root *RootValue) GetAllSchemas(ctx context.Context) (map[string]schema.Schema, error)
- func (root *RootValue) GetFeatureVersion(ctx context.Context) (ver FeatureVersion, ok bool, err error)
- func (root *RootValue) GetForeignKeyCollection(ctx context.Context) (*ForeignKeyCollection, error)
- func (root *RootValue) GetForeignKeyCollectionMap(ctx context.Context) (types.Map, error)
- func (root *RootValue) GetSuperSchema(ctx context.Context, tName string) (*schema.SuperSchema, bool, error)
- func (root *RootValue) GetSuperSchemaMap(ctx context.Context) (types.Map, error)
- func (root *RootValue) GetTable(ctx context.Context, tName string) (*Table, bool, error)
- func (root *RootValue) GetTableByColTag(ctx context.Context, tag uint64) (tbl *Table, name string, found bool, err error)
- func (root *RootValue) GetTableHash(ctx context.Context, tName string) (hash.Hash, bool, error)
- func (root *RootValue) GetTableInsensitive(ctx context.Context, tName string) (*Table, string, bool, error)
- func (root *RootValue) GetTableNames(ctx context.Context) ([]string, error)
- func (root *RootValue) HasConflicts(ctx context.Context) (bool, error)
- func (root *RootValue) HasConstraintViolations(ctx context.Context) (bool, error)
- func (root *RootValue) HasTable(ctx context.Context, tName string) (bool, error)
- func (root *RootValue) HashOf() (hash.Hash, error)
- func (root *RootValue) IterTables(ctx context.Context, ...) error
- func (root *RootValue) MapTableHashes(ctx context.Context) (map[string]hash.Hash, error)
- func (root *RootValue) PutForeignKeyCollection(ctx context.Context, fkc *ForeignKeyCollection) (*RootValue, error)
- func (root *RootValue) PutSuperSchema(ctx context.Context, tName string, ss *schema.SuperSchema) (*RootValue, error)
- func (root *RootValue) PutTable(ctx context.Context, tName string, table *Table) (*RootValue, error)
- func (root *RootValue) RemoveTables(ctx context.Context, skipFKHandling bool, allowDroppingFKReferenced bool, ...) (*RootValue, error)
- func (root *RootValue) RenameTable(ctx context.Context, oldName, newName string) (*RootValue, error)
- func (root *RootValue) ResolveTableName(ctx context.Context, tName string) (string, bool, error)
- func (root *RootValue) SetTableHash(ctx context.Context, tName string, h hash.Hash) (*RootValue, error)
- func (root *RootValue) TablesInConflict(ctx context.Context) ([]string, error)
- func (root *RootValue) TablesWithConstraintViolations(ctx context.Context) ([]string, error)
- func (root *RootValue) UpdateSuperSchemasFromOther(ctx context.Context, tblNames []string, other *RootValue) (*RootValue, error)
- func (root *RootValue) VRW() types.ValueReadWriter
- func (root *RootValue) ValidateForeignKeysOnSchemas(ctx context.Context) (*RootValue, error)
- type RootValueUnreadable
- type Roots
- type Table
- func (t *Table) AddColumnToRows(ctx context.Context, newCol string, newSchema schema.Schema) (*Table, error)
- func (t *Table) ClearConflicts(ctx context.Context) (*Table, error)
- func (t *Table) DebugString(ctx context.Context) string
- func (t *Table) DeleteIndexRowData(ctx context.Context, indexName string) (*Table, error)
- func (t *Table) Format() *types.NomsBinFormat
- func (t *Table) GetAutoIncrementValue(ctx context.Context) (uint64, error)
- func (t *Table) GetConflictSchemas(ctx context.Context) (base, sch, mergeSch schema.Schema, err error)
- func (t *Table) GetConflicts(ctx context.Context) (conflict.ConflictSchema, durable.ConflictIndex, error)
- func (t *Table) GetConstraintViolations(ctx context.Context) (types.Map, error)
- func (t *Table) GetConstraintViolationsSchema(ctx context.Context) (schema.Schema, error)
- func (t *Table) GetIndexRowData(ctx context.Context, indexName string) (durable.Index, error)
- func (t *Table) GetIndexSet(ctx context.Context) (durable.IndexSet, error)
- func (t *Table) GetNomsIndexRowData(ctx context.Context, indexName string) (types.Map, error)
- func (t *Table) GetNomsRowData(ctx context.Context) (types.Map, error)
- func (t *Table) GetRowData(ctx context.Context) (durable.Index, error)
- func (t *Table) GetSchema(ctx context.Context) (schema.Schema, error)
- func (t *Table) GetSchemaHash(ctx context.Context) (hash.Hash, error)
- func (t *Table) HasConflicts(ctx context.Context) (bool, error)
- func (t *Table) HashOf() (hash.Hash, error)
- func (t *Table) NumRowsInConflict(ctx context.Context) (uint64, error)
- func (t *Table) RenameIndexRowData(ctx context.Context, oldIndexName, newIndexName string) (*Table, error)
- func (t *Table) ResolveConflicts(ctx context.Context, pkTuples []types.Value) (invalid, notFound []types.Value, tbl *Table, err error)
- func (t *Table) SetAutoIncrementValue(ctx context.Context, val uint64) (*Table, error)
- func (t *Table) SetConflicts(ctx context.Context, schemas conflict.ConflictSchema, ...) (*Table, error)
- func (t *Table) SetConstraintViolations(ctx context.Context, violationsMap types.Map) (*Table, error)
- func (t *Table) SetIndexRows(ctx context.Context, indexName string, idx durable.Index) (*Table, error)
- func (t *Table) SetIndexSet(ctx context.Context, indexes durable.IndexSet) (*Table, error)
- func (t *Table) SetNomsIndexRows(ctx context.Context, indexName string, idx types.Map) (*Table, error)
- func (t *Table) UpdateNomsRows(ctx context.Context, updatedRows types.Map) (*Table, error)
- func (t *Table) UpdateRows(ctx context.Context, updatedRows durable.Index) (*Table, error)
- func (t *Table) UpdateSchema(ctx context.Context, sch schema.Schema) (*Table, error)
- func (t *Table) ValueReadWriter() types.ValueReadWriter
- func (t *Table) VerifyIndexRowData(ctx context.Context, indexName string) error
- type Tag
- type TagWithHash
- type UnresolvedFKDetails
- type WorkingSet
- func (ws WorkingSet) AbortMerge() *WorkingSet
- func (ws WorkingSet) ClearMerge() *WorkingSet
- func (ws *WorkingSet) HashOf() (hash.Hash, error)
- func (ws *WorkingSet) MergeActive() bool
- func (ws *WorkingSet) MergeState() *MergeState
- func (ws WorkingSet) Meta() *datas.WorkingSetMeta
- func (ws *WorkingSet) Ref() ref.WorkingSetRef
- func (ws *WorkingSet) StagedRoot() *RootValue
- func (ws WorkingSet) StartMerge(commit *Commit) *WorkingSet
- func (ws WorkingSet) WithMergeState(mergeState *MergeState) *WorkingSet
- func (ws WorkingSet) WithStagedRoot(stagedRoot *RootValue) *WorkingSet
- func (ws WorkingSet) WithWorkingRoot(workingRoot *RootValue) *WorkingSet
- func (ws *WorkingSet) WorkingRoot() *RootValue
Constants ¶
const ( // DocTableName is the name of the dolt table containing documents such as the license and readme DocTableName = "dolt_docs" // DocPkColumnName is the name of the pk column in the docs table DocPkColumnName = "doc_name" //DocTextColumnName is the name of the column containing the document contents in the docs table DocTextColumnName = "doc_text" )
const ( // DoltQueryCatalogTableName is the name of the query catalog table DoltQueryCatalogTableName = "dolt_query_catalog" // QueryCatalogIdCol is the name of the primary key column of the query catalog table QueryCatalogIdCol = "id" // QueryCatalogOrderCol is the column containing the order of the queries in the catalog QueryCatalogOrderCol = "display_order" // QueryCatalogNameCol is the name of the column containing the name of a query in the catalog QueryCatalogNameCol = "name" // QueryCatalogQueryCol is the name of the column containing the query of a catalog entry QueryCatalogQueryCol = "query" // QueryCatalogDescriptionCol is the name of the column containing the description of a query in the catalog QueryCatalogDescriptionCol = "description" )
const ( // SchemasTableName is the name of the dolt schema fragment table SchemasTableName = "dolt_schemas" // SchemasTablesIdCol is an incrementing integer that represents the insertion index. SchemasTablesIdCol = "id" // Currently: `view` or `trigger`. SchemasTablesTypeCol = "type" // The name of the database entity. SchemasTablesNameCol = "name" // The schema fragment associated with the database entity. // For example, the SELECT statement for a CREATE VIEW. SchemasTablesFragmentCol = "fragment" // The extra information for schema; currently contains creation time for triggers and views SchemasTablesExtraCol = "extra" // The name of the index that is on the table. SchemasTablesIndexName = "fragment_name" )
const ( // DoltBlameViewPrefix is the prefix assigned to all the generated blame tables DoltBlameViewPrefix = "dolt_blame_" // DoltHistoryTablePrefix is the prefix assigned to all the generated history tables DoltHistoryTablePrefix = "dolt_history_" // DoltDiffTablePrefix is the prefix assigned to all the generated diff tables DoltDiffTablePrefix = "dolt_diff_" // DoltCommitDiffTablePrefix is the prefix assigned to all the generated commit diff tables DoltCommitDiffTablePrefix = "dolt_commit_diff_" // DoltConfTablePrefix is the prefix assigned to all the generated conflict tables DoltConfTablePrefix = "dolt_conflicts_" // DoltConstViolTablePrefix is the prefix assigned to all the generated constraint violation tables DoltConstViolTablePrefix = "dolt_constraint_violations_" )
const ( // LogTableName is the log system table name LogTableName = "dolt_log" // DiffTableName is the name of the table with a map of commits to tables changed DiffTableName = "dolt_diff" // TableOfTablesInConflictName is the conflicts system table name TableOfTablesInConflictName = "dolt_conflicts" // TableOfTablesWithViolationsName is the constraint violations system table name TableOfTablesWithViolationsName = "dolt_constraint_violations" // BranchesTableName is the branches system table name BranchesTableName = "dolt_branches" // RemotesTableName is the remotes system table name RemotesTableName = "dolt_remotes" // CommitsTableName is the commits system table name CommitsTableName = "dolt_commits" // CommitAncestorsTableName is the commit_ancestors system table name CommitAncestorsTableName = "dolt_commit_ancestors" // StatusTableName is the status system table name. StatusTableName = "dolt_status" )
const ( // ProceduresTableName is the name of the dolt stored procedures table. ProceduresTableName = "dolt_procedures" // ProceduresTableNameCol is the name of the stored procedure. Using CREATE PROCEDURE, will always be lowercase. ProceduresTableNameCol = "name" // ProceduresTableCreateStmtCol is the CREATE PROCEDURE statement for this stored procedure. ProceduresTableCreateStmtCol = "create_stmt" // ProceduresTableCreatedAtCol is the time that the stored procedure was created at, in UTC. ProceduresTableCreatedAtCol = "created_at" // ProceduresTableModifiedAtCol is the time that the stored procedure was last modified, in UTC. ProceduresTableModifiedAtCol = "modified_at" )
const ( // TableNameRegexStr is the regular expression that valid tables must match. TableNameRegexStr = `^[a-zA-Z]{1}$|^[a-zA-Z_]+[-_0-9a-zA-Z]*[0-9a-zA-Z]+$` // ForeignKeyNameRegexStr is the regular expression that valid foreign keys must match. // From the unquoted identifiers: https://dev.mysql.com/doc/refman/8.0/en/identifiers.html // We also allow the '-' character from quoted identifiers. ForeignKeyNameRegexStr = `^[-$_0-9a-zA-Z]+$` // IndexNameRegexStr is the regular expression that valid indexes must match. // From the unquoted identifiers: https://dev.mysql.com/doc/refman/8.0/en/identifiers.html // We also allow the '-' character from quoted identifiers. IndexNameRegexStr = `^[-$_0-9a-zA-Z]+$` )
const (
// DoltNamespace is the name prefix of dolt system tables. We reserve all tables that begin with dolt_ for system use.
DoltNamespace = "dolt"
)
Variables ¶
var ErrAlreadyOnBranch = errors.New("Already on branch")
var ErrAlreadyOnWorkspace = errors.New("Already on workspace")
var ErrBranchNotFound = errors.New("branch not found")
var ErrCannotDeleteLastBranch = errors.New("cannot delete the last branch")
var ErrFoundHashNotACommit = errors.New("the value retrieved for this hash is not a commit")
var ErrHashNotFound = errors.New("could not find a value for this hash")
var ErrInvBranchName = errors.New("not a valid user branch name")
var ErrInvHash = errors.New("not a valid hash")
var ErrInvTableName = errors.New("not a valid table name")
var ErrInvTagName = errors.New("not a valid user tag name")
var ErrInvWorkspaceName = errors.New("not a valid user workspace name")
var ErrInvalidAncestorSpec = errors.New("invalid ancestor spec")
var ErrInvalidBranchOrHash = errors.New("string is not a valid branch or hash")
var ErrInvalidHash = errors.New("string is not a valid hash")
var ErrIsAhead = errors.New("current fast forward from a to b. a is ahead of b already")
var ErrIsBehind = errors.New("cannot reverse from b to a. b is a is behind a already")
var ErrMergeActive = errors.New("merging is not possible because you have not committed an active merge")
var ErrNoCommonAncestor = errors.New("no common ancestor")
var (
ErrNoConflictsResolved = errors.New("no conflicts resolved")
)
var ErrNoRootValAtHash = errors.New("there is no dolt root value at that hash")
var ErrNomsIO = errors.New("error reading from or writing to noms")
var ErrSystemTableCannotBeModified = errors.New("system tables cannot be dropped or altered")
var ErrTableExists = errors.New("table already exists")
var ErrTableNotFound = errors.New("table not found")
var ErrTagNotFound = errors.New("tag not found")
var ErrUnresolvedConflicts = errors.New("merge has unresolved conflicts. please use the dolt_conflicts table to resolve")
var ErrUnresolvedConstraintViolations = errors.New("merge has unresolved constraint violations. please use the dolt_constraint_violations table to resolve")
var ErrUpToDate = errors.New("up to date")
var ErrWorkingSetNotFound = errors.New("working set not found")
var ErrWorkspaceNotFound = errors.New("workspace not found")
var InMemDoltDB = "mem://"
InMemDoltDB stores the DoltDB db in memory and is primarily used for testing
var LocalDirDoltDB = "file://./" + dbfactory.DoltDataDir
LocalDirDoltDB stores the db in the current directory
Functions ¶
func GetAllTableNames ¶
GetAllTableNames returns table names for all persisted and generated tables.
func GetGeneratedSystemTables ¶
GetGeneratedSystemTables returns table names of all generated system tables.
func GetNonSystemTableNames ¶
GetNonSystemTableNames gets non-system table names
func GetPersistedSystemTables ¶
GetPersistedSystemTables returns table names of all persisted system tables.
func GetRootValueSuperSchema ¶
GetRootValueSuperSchema creates a SuperSchema with every column in history of root.
func GetSystemTableNames ¶
GetSystemTableNames gets system table names
func GetUnreachableRootCause ¶
func HasDoltPrefix ¶
HasDoltPrefix returns a boolean whether or not the provided string is prefixed with the DoltNamespace. Users should not be able to create tables in this reserved namespace.
func IsInvalidFormatErr ¶
func IsNotACommit ¶
func IsNotFoundErr ¶
func IsReadOnlySystemTable ¶
IsReadOnlySystemTable returns whether the table name given is a system table that should not be included in command line output (e.g. dolt status) by default.
func IsRootValUnreachable ¶
func IsValidBranchRef ¶
IsValidBranchRef validates that a BranchRef doesn't violate naming constraints.
func IsValidCommitHash ¶
func IsValidForeignKeyName ¶
IsValidForeignKeyName returns true if the name matches the regular expression ForeignKeyNameRegexStr.
func IsValidIndexName ¶
IsValidIndexName returns true if the name matches the regular expression IndexNameRegexStr.
func IsValidTableName ¶
IsValidTableName returns true if the name matches the regular expression TableNameRegexStr. Table names must be composed of 1 or more letters and non-initial numerals, as well as the characters _ and -
func IsValidTagRef ¶
IsValidTagRef validates that a TagRef doesn't violate naming constraints.
func IsValidUserBranchName ¶
IsValidUserBranchName returns true if name isn't a valid commit hash, it is not named "head" and it matches the regular expression `[0-9a-z]+[-_0-9a-z]*[0-9a-z]+$`
func TodoWorkingSetMeta ¶
func TodoWorkingSetMeta() *datas.WorkingSetMeta
TodoWorkingSetMeta returns an incomplete WorkingSetMeta, suitable for methods that don't have the means to construct a real one. These should be considered temporary and cleaned up when possible, similar to Context.TODO
func UnionTableNames ¶
UnionTableNames returns an array of all table names in all roots passed as params.
Types ¶
type AncestorSpec ¶
type AncestorSpec struct { // SpecStr is string representation of the AncestorSpec SpecStr string // Instructions is a slice of parent indices. As you walk up the ancestor tree the first instruction is the index of // the parent that should be used. The second index is the index of that parents parent that should be used. etc. // When you've exhausted the instructions you've reached the referenced commit. Instructions []int }
AncestorSpec supports using ^, ^N, and ~N together to specify an ancestor of a commit.
^ after a commit spec means the first parent of that commit. ^<n> means the <n>th parent (i.e. <rev>^ is equivalent to <rev>^1). As a special rule. ~<n> after a commit spec means the commit object that is the <n>th generation grand-parent of the named commit object, following only the first parents. I.e. <rev>~3 is equivalent to <rev>^^^ which is equivalent to <rev>^1^1^1. See below for an illustration of the usage of this form.
func NewAncestorSpec ¶
func NewAncestorSpec(s string) (*AncestorSpec, error)
NewAncestorSpec takes an input string and validates it and converts it to a set of instructions used in walking up the ancestor tree
func SplitAncestorSpec ¶
func SplitAncestorSpec(s string) (string, *AncestorSpec, error)
SplitAncestorSpec takes a string that is a commit spec suffixed with an ancestor spec, and splits them apart. If there is no ancestor spec then only the commit spec will be returned and the ancestorSpec will have no empty.
type AsyncPushOnWriteHook ¶
type AsyncPushOnWriteHook struct {
// contains filtered or unexported fields
}
func NewAsyncPushOnWriteHook ¶
func NewAsyncPushOnWriteHook(bThreads *sql.BackgroundThreads, destDB *DoltDB, tmpDir string, logger io.Writer) (*AsyncPushOnWriteHook, error)
NewAsyncPushOnWriteHook creates a AsyncReplicateHook
func (*AsyncPushOnWriteHook) Execute ¶
func (ah *AsyncPushOnWriteHook) Execute(ctx context.Context, ds datas.Dataset, db datas.Database) error
Execute implements CommitHook, replicates head updates to the destDb field
func (*AsyncPushOnWriteHook) HandleError ¶
func (ah *AsyncPushOnWriteHook) HandleError(ctx context.Context, err error) error
HandleError implements CommitHook
type Commit ¶
type Commit struct {
// contains filtered or unexported fields
}
Commit contains information on a commit that was written to noms
func GetCommitAncestor ¶
func (*Commit) CanFastForwardTo ¶
func (*Commit) CanFastReverseTo ¶
func (*Commit) DatasParents ¶
DatasParents returns the []*datas.Commit of the commit parents.
func (*Commit) GetAncestor ¶
func (*Commit) GetCommitMeta ¶
GetCommitMeta gets the metadata associated with the commit
func (*Commit) GetRootValue ¶
GetRootValue gets the RootValue of the commit.
func (*Commit) NumParents ¶
NumParents gets the number of parents a commit has.
type CommitFilter ¶
CommitFilter is a function that returns true if a commit should be filtered out, and false if it should be kept
type CommitHook ¶
type CommitHook interface { // Execute is arbitrary read-only function whose arguments are new Dataset commit into a specific Database Execute(ctx context.Context, ds datas.Dataset, db datas.Database) error // HandleError is an bridge function to handle Execute errors HandleError(ctx context.Context, err error) error // SetLogger lets clients specify an output stream for HandleError SetLogger(ctx context.Context, wr io.Writer) error }
CommitHook is an abstraction for executing arbitrary commands after atomic database commits
type CommitItr ¶
type CommitItr interface { // Next returns the hash of the next commit, and a pointer to that commit. Implementations of Next must handle // making sure the list of commits returned are unique. When complete Next will return hash.Hash{}, nil, io.EOF Next(ctx context.Context) (hash.Hash, *Commit, error) // Reset the commit iterator back to the start Reset(ctx context.Context) error }
CommitItr is an interface for iterating over a set of unique commits
func CommitItrForAllBranches ¶
CommitItrForAllBranches returns a CommitItr which will iterate over all commits in all branches in a DoltDB
func CommitItrForRoots ¶
CommitItrForRoots will return a CommitItr which will iterate over all ancestor commits of the provided rootCommits.
type CommitSpec ¶
type CommitSpec struct {
// contains filtered or unexported fields
}
CommitSpec handles three different types of string representations of commits. Commits can either be represented by the hash of the commit, a branch name, or using "head" to represent the latest commit of the current branch. An Ancestor spec can be appended to the end of any of these in order to reach commits that are in the ancestor tree of the referenced commit.
func NewCommitSpec ¶
func NewCommitSpec(cSpecStr string) (*CommitSpec, error)
NewCommitSpec parses a string specifying a commit using dolt commit spec syntax and returns a |*CommitSpec|. A commit spec has a base commit and an optional ancestor specification. The syntax admits three types of base commit references: * head -- the literal string HEAD specifies the HEAD reference of the current working set. * a commit hash, like 46m0aqr8c1vuv76ml33cdtr8722hsbhn -- a fully specified commit hash. * a ref -- referring to a branch or tag reference in the current dolt database. Examples of branch refs include `master`, `heads/master`, `refs/heads/master`, `origin/master`, `refs/remotes/origin/master`. Examples of tag refs include `v1.0`, `tags/v1.0`, `refs/tags/v1.0`, `origin/v1.0`, `refs/remotes/origin/v1.0`.
A commit spec has an optional ancestor specification, which describes a traversal of commit parents, starting at the base commit, in order to arrive at the actually specified commit. See |AncestorSpec|. Examples of |CommitSpec|s: * HEAD * master * HEAD~ * remotes/origin/master~~ * refs/heads/my-feature-branch^2~
Constructing a |CommitSpec| does not mean the specified branch or commit exists. This carries a description of how to find the specified commit. See |doltdb.Resolve| for resolving a |CommitSpec| to a |Commit|.
type DoltDB ¶
type DoltDB struct {
// contains filtered or unexported fields
}
DoltDB wraps access to the underlying noms database and hides some of the details of the underlying storage. Additionally the noms codebase uses panics in a way that is non idiomatic and We've opted to recover and return errors in many cases.
func DoltDBFromCS ¶
func DoltDBFromCS(cs chunks.ChunkStore) *DoltDB
DoltDBFromCS creates a DoltDB from a noms chunks.ChunkStore
func LoadDoltDB ¶
func LoadDoltDB(ctx context.Context, nbf *types.NomsBinFormat, urlStr string, fs filesys.Filesys) (*DoltDB, error)
LoadDoltDB will acquire a reference to the underlying noms db. If the Location is InMemDoltDB then a reference to a newly created in memory database will be used. If the location is LocalDirDoltDB, the directory must exist or this returns nil.
func LoadDoltDBWithParams ¶
func (*DoltDB) CSMetricsSummary ¶
func (*DoltDB) CanFastForward ¶
func (ddb *DoltDB) CanFastForward(ctx context.Context, branch ref.DoltRef, new *Commit) (bool, error)
CanFastForward returns whether the given branch can be fast-forwarded to the commit given.
func (*DoltDB) Commit ¶
func (ddb *DoltDB) Commit(ctx context.Context, valHash hash.Hash, dref ref.DoltRef, cm *datas.CommitMeta) (*Commit, error)
Commit will update a branch's head value to be that of a previously committed root value hash
func (*DoltDB) CommitDanglingWithParentCommits ¶
func (ddb *DoltDB) CommitDanglingWithParentCommits(ctx context.Context, valHash hash.Hash, parentCommits []*Commit, cm *datas.CommitMeta) (*Commit, error)
dangling commits are unreferenced by any branch or ref. They are created in the course of programmatic updates such as rebase. You must create a ref to a dangling commit for it to be reachable
func (*DoltDB) CommitRoot ¶
CommitRoot executes a chunkStore commit, atomically swapping the root hash of the database manifest
func (*DoltDB) CommitWithParentCommits ¶
func (*DoltDB) CommitWithParentSpecs ¶
func (ddb *DoltDB) CommitWithParentSpecs(ctx context.Context, valHash hash.Hash, dref ref.DoltRef, parentCmSpecs []*CommitSpec, cm *datas.CommitMeta) (*Commit, error)
CommitWithParentSpecs commits the value hash given to the branch given, using the list of parent hashes given. Returns an error if the value or any parents can't be resolved, or if anything goes wrong accessing the underlying storage.
func (*DoltDB) CommitWithWorkingSet ¶
func (ddb *DoltDB) CommitWithWorkingSet( ctx context.Context, headRef ref.DoltRef, workingSetRef ref.WorkingSetRef, commit *PendingCommit, workingSet *WorkingSet, prevHash hash.Hash, meta *datas.WorkingSetMeta, ) (*Commit, error)
CommitWithWorkingSet combines the functionality of CommitWithParents with UpdateWorking set, and takes a combination of their parameters. It's a way to update the working set and current HEAD in the same atomic transaction. It commits to disk a pending commit value previously created with NewPendingCommit, asserting that the working set hash given is still current for that HEAD.
func (*DoltDB) CopyWorkingSet ¶
func (ddb *DoltDB) CopyWorkingSet(ctx context.Context, fromWSRef ref.WorkingSetRef, toWSRef ref.WorkingSetRef, force bool) error
CopyWorkingSet copies a WorkingSetRef from one ref to another. If `force` is true, will overwrite any existing value in the destination ref. Otherwise will fail if the destination ref exists.
If fromWSRef does not exist, this method does not return an error, but returns `nil`. In that case, the destination ref is left alone.
func (*DoltDB) DeleteBranch ¶
DeleteBranch deletes the branch given, returning an error if it doesn't exist.
func (*DoltDB) DeleteWorkingSet ¶
DeleteWorkingSet deletes the working set given
func (*DoltDB) DeleteWorkspace ¶
func (*DoltDB) ExecuteCommitHooks ¶
func (*DoltDB) FastForward ¶
FastForward fast-forwards the branch given to the commit given.
func (*DoltDB) Format ¶
func (ddb *DoltDB) Format() *types.NomsBinFormat
func (*DoltDB) GC ¶
GC performs garbage collection on this ddb. Values passed in |uncommitedVals| will be temporarily saved during gc.
func (*DoltDB) GetBranches ¶
GetBranches returns a list of all branches in the database.
func (*DoltDB) GetBranchesWithHashes ¶
func (ddb *DoltDB) GetBranchesWithHashes(ctx context.Context) ([]BranchWithHash, error)
func (*DoltDB) GetHeadRefs ¶
GetHeadRefs returns a list of all refs that point to a Commit
func (*DoltDB) GetRefsOfType ¶
func (*DoltDB) GetRemoteRefs ¶
GetRemoteRefs returns a list of all remotes in the database.
func (*DoltDB) GetRemotesWithHashes ¶
func (ddb *DoltDB) GetRemotesWithHashes(ctx context.Context) ([]RemoteWithHash, error)
func (*DoltDB) GetTagsWithHashes ¶
func (ddb *DoltDB) GetTagsWithHashes(ctx context.Context) ([]TagWithHash, error)
GetTagsWithHashes returns a list of objects containing TagRefs with their associated Commit's hash
func (*DoltDB) GetWorkspaces ¶
GetWorkspaces returns a list of all workspaces in the database.
func (*DoltDB) NewBranchAtCommit ¶
func (ddb *DoltDB) NewBranchAtCommit(ctx context.Context, branchRef ref.DoltRef, commit *Commit) error
NewBranchAtCommit creates a new branch with HEAD at the commit given. Branch names must pass IsValidUserBranchName.
func (*DoltDB) NewPendingCommit ¶
func (ddb *DoltDB) NewPendingCommit( ctx context.Context, roots Roots, headRef ref.DoltRef, parentCommits []*Commit, cm *datas.CommitMeta, ) (*PendingCommit, error)
NewPendingCommit returns a new PendingCommit object to be written with doltdb.CommitWithWorkingSet. |roots| are the current roots to include in the PendingCommit. roots.Staged is used as the new root to package in the commit, once written. |headRef| is the ref of the HEAD the commit will update |parentCommits| are any additional merge parents for this commit. The current HEAD commit is always considered a parent. |cm| is the metadata for the commit
func (*DoltDB) NewTagAtCommit ¶
func (ddb *DoltDB) NewTagAtCommit(ctx context.Context, tagRef ref.DoltRef, c *Commit, meta *datas.TagMeta) error
NewTagAtCommit create a new tag at the commit given.
func (*DoltDB) NewWorkspaceAtCommit ¶
NewWorkspaceAtCommit create a new workspace at the commit given.
func (*DoltDB) PullChunks ¶
func (ddb *DoltDB) PullChunks(ctx context.Context, tempDir string, srcDB *DoltDB, targetHash hash.Hash, progChan chan pull.PullProgress, statsCh chan pull.Stats) error
PullChunks initiates a pull into this database from the source database given, pulling all chunks reachable from the given targetHash. Pull progress is communicated over the provided channel.
func (*DoltDB) ReadRootValue ¶
ReadRootValue reads the RootValue associated with the hash given and returns it. Returns an error if the value cannot be read, or if the hash given doesn't represent a dolt RootValue.
func (*DoltDB) Rebase ¶
Rebase rebases the underlying db from disk, re-loading the manifest. Useful when another process might have made changes to the database we need to read.
func (*DoltDB) Resolve ¶
Resolve takes a CommitSpec and returns a Commit, or an error if the commit cannot be found. If the CommitSpec is HEAD, Resolve also needs the DoltRef of the current working branch.
func (*DoltDB) ResolveAllParents ¶
func (*DoltDB) ResolveCommitRef ¶
ResolveCommitRef takes a DoltRef and returns a Commit, or an error if the commit cannot be found. The ref given must point to a Commit.
func (*DoltDB) ResolveParent ¶
func (ddb *DoltDB) ResolveParent(ctx context.Context, commit *Commit, parentIdx int) (*Commit, error)
ResolveParent returns the n-th ancestor of a given commit (direct parent is index 0). error return value will be non-nil in the case that the commit cannot be resolved, there aren't as many ancestors as requested, or the underlying storage cannot be accessed.
func (*DoltDB) ResolveTag ¶
ResolveTag takes a TagRef and returns the corresponding Tag object.
func (*DoltDB) ResolveWorkingSet ¶
func (ddb *DoltDB) ResolveWorkingSet(ctx context.Context, workingSetRef ref.WorkingSetRef) (*WorkingSet, error)
ResolveWorkingSet takes a WorkingSetRef and returns the corresponding WorkingSet object.
func (*DoltDB) SetCommitHookLogger ¶
func (*DoltDB) SetCommitHooks ¶
func (ddb *DoltDB) SetCommitHooks(ctx context.Context, postHooks []CommitHook) *DoltDB
func (*DoltDB) SetHeadToCommit ¶
SetHeadToCommit sets the given ref to point at the given commit. It is used in the course of 'force' updates.
func (*DoltDB) UpdateWorkingSet ¶
func (ddb *DoltDB) UpdateWorkingSet( ctx context.Context, workingSetRef ref.WorkingSetRef, workingSet *WorkingSet, prevHash hash.Hash, meta *datas.WorkingSetMeta, ) error
UpdateWorkingSet updates the working set with the ref given to the root value given |prevHash| is the hash of the expected WorkingSet struct stored in the ref, not the hash of the RootValue there.
func (*DoltDB) ValueReadWriter ¶
func (ddb *DoltDB) ValueReadWriter() types.ValueReadWriter
ValueReadWriter returns the underlying noms database as a types.ValueReadWriter.
func (*DoltDB) VisitRefsOfType ¶
func (*DoltDB) WriteEmptyRepo ¶
WriteEmptyRepo will create initialize the given db with a master branch which points to a commit which has valid metadata for the creation commit, and an empty RootValue.
func (*DoltDB) WriteEmptyRepoWithCommitTime ¶
func (*DoltDB) WriteEmptyRepoWithCommitTimeAndDefaultBranch ¶
func (*DoltDB) WriteRootValue ¶
func (ddb *DoltDB) WriteRootValue(ctx context.Context, rv *RootValue) (*RootValue, hash.Hash, error)
WriteRootValue will write a doltdb.RootValue instance to the database. This value will not be associated with a commit and can be committed by hash at a later time. Returns an updated root value and the hash of the value written. This method is the primary place in doltcore that handles setting the FeatureVersion of root values to the current value, so all writes of RootValues should happen here.
type ErrClientOutOfDate ¶
type ErrClientOutOfDate struct { RepoVer FeatureVersion ClientVer FeatureVersion }
func (ErrClientOutOfDate) Error ¶
func (e ErrClientOutOfDate) Error() string
type FeatureVersion ¶
type FeatureVersion int64
var DoltFeatureVersion FeatureVersion = 3 // last bumped when storing creation time for triggers
DoltFeatureVersion is described in feature_version.md. only variable for testing.
type FilteringCommitItr ¶
type FilteringCommitItr struct {
// contains filtered or unexported fields
}
FilteringCommitItr is a CommitItr implementation that applies a filtering function to limit the commits returned
func NewFilteringCommitItr ¶
func NewFilteringCommitItr(itr CommitItr, filter CommitFilter) FilteringCommitItr
type ForeignKey ¶
type ForeignKey struct { Name string `noms:"name" json:"name"` TableName string `noms:"tbl_name" json:"tbl_name"` TableIndex string `noms:"tbl_index" json:"tbl_index"` TableColumns []uint64 `noms:"tbl_cols" json:"tbl_cols"` ReferencedTableName string `noms:"ref_tbl_name" json:"ref_tbl_name"` ReferencedTableIndex string `noms:"ref_tbl_index" json:"ref_tbl_index"` ReferencedTableColumns []uint64 `noms:"ref_tbl_cols" json:"ref_tbl_cols"` OnUpdate ForeignKeyReferentialAction `noms:"on_update" json:"on_update"` OnDelete ForeignKeyReferentialAction `noms:"on_delete" json:"on_delete"` UnresolvedFKDetails UnresolvedFKDetails `noms:"unres_fk,omitempty" json:"unres_fk,omitempty"` }
ForeignKey is the complete, internal representation of a Foreign Key.
func (ForeignKey) DeepEquals ¶
func (fk ForeignKey) DeepEquals(other ForeignKey) bool
DeepEquals compares all attributes of a foreign key to another, including name and table names.
func (ForeignKey) EqualDefs ¶
func (fk ForeignKey) EqualDefs(other ForeignKey) bool
EqualDefs returns whether two foreign keys have the same definition over the same column sets. It does not compare table names or foreign key names.
func (ForeignKey) HashOf ¶
func (fk ForeignKey) HashOf() hash.Hash
HashOf returns the Noms hash of a ForeignKey.
func (ForeignKey) IsResolved ¶
func (fk ForeignKey) IsResolved() bool
IsResolved returns whether the foreign key has been resolved.
func (ForeignKey) IsSelfReferential ¶
func (fk ForeignKey) IsSelfReferential() bool
IsSelfReferential returns whether the table declaring the foreign key is also referenced by the foreign key.
func (ForeignKey) ValidateData ¶
func (fk ForeignKey) ValidateData( ctx context.Context, childSch schema.Schema, childRowData, childIdxData, parentIdxData types.Map, childDef, parentDef schema.Index, vrw types.ValueReadWriter, ) error
ValidateData ensures that the foreign key is valid by comparing the index data from the given table against the index data from the referenced table. Returns an error for each violation.
func (ForeignKey) ValidateReferencedTableSchema ¶
func (fk ForeignKey) ValidateReferencedTableSchema(sch schema.Schema) error
ValidateReferencedTableSchema verifies that the given schema matches the expectation of the referenced table.
func (ForeignKey) ValidateTableSchema ¶
func (fk ForeignKey) ValidateTableSchema(sch schema.Schema) error
ValidateTableSchema verifies that the given schema matches the expectation of the declaring table.
type ForeignKeyCollection ¶
type ForeignKeyCollection struct {
// contains filtered or unexported fields
}
ForeignKeyCollection represents the collection of foreign keys for a root value.
func LoadForeignKeyCollection ¶
LoadForeignKeyCollection returns a new ForeignKeyCollection using the provided map returned previously by GetMap.
func NewForeignKeyCollection ¶
func NewForeignKeyCollection(keys ...ForeignKey) (*ForeignKeyCollection, error)
func (*ForeignKeyCollection) AddKeys ¶
func (fkc *ForeignKeyCollection) AddKeys(fks ...ForeignKey) error
AddKeys adds the given foreign key to the collection. Checks that the given name is unique in the collection, and that both column counts are equal. All other validation should occur before being added to the collection.
func (*ForeignKeyCollection) AllKeys ¶
func (fkc *ForeignKeyCollection) AllKeys() []ForeignKey
AllKeys returns a slice, sorted by name ascending, containing all of the foreign keys in this collection.
func (*ForeignKeyCollection) ColumnHasFkRelationship ¶
func (fkc *ForeignKeyCollection) ColumnHasFkRelationship(tag uint64) (ForeignKey, bool)
ColumnHasFkRelationship returns a foreign key that uses this tag. Returns n
func (*ForeignKeyCollection) Contains ¶
func (fkc *ForeignKeyCollection) Contains(foreignKeyName string) bool
Contains returns whether the given foreign key name already exists for this collection.
func (*ForeignKeyCollection) Count ¶
func (fkc *ForeignKeyCollection) Count() int
Count returns the number of indexes in this collection.
func (*ForeignKeyCollection) GetByNameCaseInsensitive ¶
func (fkc *ForeignKeyCollection) GetByNameCaseInsensitive(foreignKeyName string) (ForeignKey, bool)
GetByNameCaseInsensitive returns a ForeignKey with a matching case-insensitive name, and whether a match exists.
func (*ForeignKeyCollection) GetByTags ¶
func (fkc *ForeignKeyCollection) GetByTags(childTags, parentTags []uint64) (ForeignKey, bool)
GetByTags gets the ForeignKey defined over the parent and child columns corresponding to their tags.
func (*ForeignKeyCollection) GetMatchingKey ¶
func (fkc *ForeignKeyCollection) GetMatchingKey(fk ForeignKey, allSchemas map[string]schema.Schema) (ForeignKey, bool)
GetMatchingKey gets the ForeignKey defined over the parent and child columns. If the given foreign key is resolved, then both resolved and unresolved keys are checked for a match. If the given foreign key is unresolved, then ONLY unresolved keys may be found.
This discrepancy is due to the primary uses for this function. It is assumed that the ForeignKeyCollection is an ancestor collection compared to the collection that the given key comes from. Therefore, the key found in the ancestor will usually be the unresolved version of the given key, hence the comparison is valid. However, if the given key is unresolved, it is treated as a new key, which cannot be matched to a resolved key that previously existed.
The given schema map is keyed by table name, and is used in the event that the given key is resolved and any keys in the collection are unresolved. A "dirty resolution" is performed, which matches the column names to tags, and then a standard tag comparison is performed. If a table or column is not in the map, then the foreign key is ignored.
func (*ForeignKeyCollection) Iter ¶
func (fkc *ForeignKeyCollection) Iter(cb func(fk ForeignKey) (stop bool, err error)) error
func (*ForeignKeyCollection) KeysForTable ¶
func (fkc *ForeignKeyCollection) KeysForTable(tableName string) (declaredFk, referencedByFk []ForeignKey)
KeysForTable returns all foreign keys that reference the given table in some capacity. The returned array declaredFk contains all foreign keys in which this table declared the foreign key. The array referencedByFk contains all foreign keys in which this table is the referenced table. If the table contains a self-referential foreign key, it will be present in both declaresFk and referencedByFk. Each array is sorted by name ascending.
func (*ForeignKeyCollection) Map ¶
func (fkc *ForeignKeyCollection) Map(ctx context.Context, vrw types.ValueReadWriter) (types.Map, error)
Map returns the collection as a Noms Map for persistence.
func (*ForeignKeyCollection) RemoveAndUnresolveTables ¶
func (fkc *ForeignKeyCollection) RemoveAndUnresolveTables(ctx context.Context, root *RootValue, tables ...string) error
RemoveAndUnresolveTables removes all foreign keys associated with the given tables. If a parent is dropped without its child, then the foreign key goes to an unresolved state. The operation assumes that ALL tables to be removed are in a single call, as splitting tables into different calls may result in unintended errors.
func (*ForeignKeyCollection) RemoveKeyByName ¶
func (fkc *ForeignKeyCollection) RemoveKeyByName(foreignKeyName string) bool
RemoveKeyByName removes a foreign key from the collection. It does not remove the associated indexes from their respective tables. Returns true if the key was successfully removed.
func (*ForeignKeyCollection) RemoveKeys ¶
func (fkc *ForeignKeyCollection) RemoveKeys(fks ...ForeignKey)
RemoveKeys removes any Foreign Keys with matching column set from the collection.
func (*ForeignKeyCollection) RemoveTables ¶
func (fkc *ForeignKeyCollection) RemoveTables(ctx context.Context, tables ...string) error
RemoveTables removes all foreign keys associated with the given tables, if permitted. The operation assumes that ALL tables to be removed are in a single call, as splitting tables into different calls may result in unintended errors.
func (*ForeignKeyCollection) RenameTable ¶
func (fkc *ForeignKeyCollection) RenameTable(oldTableName, newTableName string)
RenameTable updates all foreign key entries in the collection with the updated table name. Does not check for name collisions. Additionally, any unresolved foreign keys will still update their referenced names as this matches MySQL's behavior.
func (*ForeignKeyCollection) Stage ¶
func (fkc *ForeignKeyCollection) Stage(ctx context.Context, fksToAdd []ForeignKey, fksToRemove []ForeignKey)
Stage takes the keys to add and remove and updates the current collection. Does not perform any key validation nor name uniqueness verification, as this is intended for use in commit staging. Adding a foreign key and updating (such as a table rename) an existing one are functionally the same.
func (*ForeignKeyCollection) Tables ¶
func (fkc *ForeignKeyCollection) Tables() map[string]struct{}
Tables returns the set of all tables that either declare a foreign key or are referenced by a foreign key.
type ForeignKeyReferentialAction ¶
type ForeignKeyReferentialAction byte
const ( ForeignKeyReferentialAction_DefaultAction ForeignKeyReferentialAction = iota ForeignKeyReferentialAction_Cascade ForeignKeyReferentialAction_NoAction ForeignKeyReferentialAction_Restrict ForeignKeyReferentialAction_SetNull )
func (ForeignKeyReferentialAction) ReducedString ¶
func (refOp ForeignKeyReferentialAction) ReducedString() string
ReducedString returns the SQL reference option in uppercase. All reference options are functionally equivalent to either RESTRICT, CASCADE, or SET NULL, therefore only one those three options are returned.
func (ForeignKeyReferentialAction) String ¶
func (refOp ForeignKeyReferentialAction) String() string
String returns the SQL reference option in uppercase.
type ForeignKeyViolationError ¶
type ForeignKeyViolationError struct { ForeignKey ForeignKey Schema schema.Schema ViolationRows []row.Row }
ForeignKeyViolationError represents a set of foreign key violations for a table.
func (*ForeignKeyViolationError) Error ¶
func (f *ForeignKeyViolationError) Error() string
Error implements the interface error.
type LogHook ¶
type LogHook struct {
// contains filtered or unexported fields
}
func NewLogHook ¶
NewLogHook is a noop that logs to a writer when invoked
func (*LogHook) HandleError ¶
HandleError implements CommitHook
type MergeState ¶
type MergeState struct {
// contains filtered or unexported fields
}
func MergeStateFromCommitAndWorking ¶
func MergeStateFromCommitAndWorking(commit *Commit, preMergeWorking *RootValue) *MergeState
MergeStateFromCommitAndWorking returns a new MergeState. Most clients should not construct MergeState objects directly, but instead use WorkingSet.StartMerge
func (MergeState) Commit ¶
func (m MergeState) Commit() *Commit
func (MergeState) PreMergeWorkingRoot ¶
func (m MergeState) PreMergeWorkingRoot() *RootValue
type PendingCommit ¶
type PendingCommit struct { Roots Roots Val types.Value CommitOptions datas.CommitOptions }
PendingCommit represents a commit that hasn't yet been written to storage. It contains a root value and options to use when committing it. Use a PendingCommit when it's important to update the working set and HEAD together atomically, via doltdb.CommitWithWorkingSet
type PushOnWriteHook ¶
type PushOnWriteHook struct {
// contains filtered or unexported fields
}
func NewPushOnWriteHook ¶
func NewPushOnWriteHook(destDB *DoltDB, tmpDir string) *PushOnWriteHook
NewPushOnWriteHook creates a ReplicateHook, parameterizaed by the backup database and a local tempfile for pushing
func (*PushOnWriteHook) Execute ¶
Execute implements CommitHook, replicates head updates to the destDb field
func (*PushOnWriteHook) HandleError ¶
func (ph *PushOnWriteHook) HandleError(ctx context.Context, err error) error
HandleError implements CommitHook
type RootTypeSet ¶
type RootTypeSet map[RootType]struct{}
func NewRootTypeSet ¶
func NewRootTypeSet(rts ...RootType) RootTypeSet
func (RootTypeSet) Contains ¶
func (rts RootTypeSet) Contains(rt RootType) bool
func (RootTypeSet) First ¶
func (rts RootTypeSet) First(rtList []RootType) RootType
func (RootTypeSet) IsEmpty ¶
func (rts RootTypeSet) IsEmpty() bool
type RootValue ¶
type RootValue struct {
// contains filtered or unexported fields
}
RootValue is the value of the Database and is the committed value in every Dolt commit.
func EmptyRootValue ¶
func (*RootValue) CreateEmptyTable ¶
func (root *RootValue) CreateEmptyTable(ctx context.Context, tName string, sch schema.Schema) (*RootValue, error)
CreateEmptyTable creates an empty table in this root with the name and schema given, returning the new root value.
func (*RootValue) DebugString ¶
DebugString returns a human readable string with the contents of this root. If |transitive| is true, row data from all tables is also included. This method is very expensive for large root values, so |transitive| should only be used when debugging tests.
func (*RootValue) GenerateTagsForNewColColl ¶
func (root *RootValue) GenerateTagsForNewColColl(ctx context.Context, tableName string, cc *schema.ColCollection) (*schema.ColCollection, error)
func (*RootValue) GenerateTagsForNewColumns ¶
func (root *RootValue) GenerateTagsForNewColumns( ctx context.Context, tableName string, newColNames []string, newColKinds []types.NomsKind, headRoot *RootValue, ) ([]uint64, error)
GenerateTagsForNewColumns deterministically generates a slice of new tags that are unique within the history of this root. The names and NomsKinds of the new columns are used to see the tag generator.
func (*RootValue) GetAllSchemas ¶
func (*RootValue) GetFeatureVersion ¶
func (root *RootValue) GetFeatureVersion(ctx context.Context) (ver FeatureVersion, ok bool, err error)
GetFeatureVersion returns the feature version of this root, if one is written
func (*RootValue) GetForeignKeyCollection ¶
func (root *RootValue) GetForeignKeyCollection(ctx context.Context) (*ForeignKeyCollection, error)
GetForeignKeyCollection returns the ForeignKeyCollection for this root. As collections are meant to be modified in-place, each returned collection may freely be altered without affecting future returned collections from this root.
func (*RootValue) GetForeignKeyCollectionMap ¶
GetForeignKeyCollectionMap returns the persisted noms Map of the foreign key collection on this root. If the intent is to retrieve a ForeignKeyCollection in particular, it is advised to call GetForeignKeyCollection as it caches the result for performance.
func (*RootValue) GetSuperSchema ¶
func (root *RootValue) GetSuperSchema(ctx context.Context, tName string) (*schema.SuperSchema, bool, error)
GetSuperSchema returns the SuperSchema for the table name specified if that table exists.
func (*RootValue) GetSuperSchemaMap ¶
GerSuperSchemaMap returns the Noms map that tracks SuperSchemas, used to create new RootValues on checkout branch.
func (*RootValue) GetTableByColTag ¶
func (root *RootValue) GetTableByColTag(ctx context.Context, tag uint64) (tbl *Table, name string, found bool, err error)
GetTableByColTag looks for the table containing the given column tag. It returns false if no table exists in the history. If the table containing the given tag previously existed and was deleted, it will return its name and a nil pointer.
func (*RootValue) GetTableHash ¶
func (*RootValue) GetTableInsensitive ¶
func (root *RootValue) GetTableInsensitive(ctx context.Context, tName string) (*Table, string, bool, error)
GetTableInsensitive will retrieve a table by its case-insensitive name.
func (*RootValue) GetTableNames ¶
GetTableNames retrieves the lists of all tables for a RootValue
func (*RootValue) HasConflicts ¶
func (*RootValue) HasConstraintViolations ¶
HasConstraintViolations returns whether any tables have constraint violations.
func (*RootValue) IterTables ¶
func (root *RootValue) IterTables(ctx context.Context, cb func(name string, table *Table, sch schema.Schema) (stop bool, err error)) error
IterTables calls the callback function cb on each table in this RootValue.
func (*RootValue) MapTableHashes ¶
MapTableHashes returns a map of each table name and hash.
func (*RootValue) PutForeignKeyCollection ¶
func (root *RootValue) PutForeignKeyCollection(ctx context.Context, fkc *ForeignKeyCollection) (*RootValue, error)
PutForeignKeyCollection returns a new root with the given foreign key collection.
func (*RootValue) PutSuperSchema ¶
func (root *RootValue) PutSuperSchema(ctx context.Context, tName string, ss *schema.SuperSchema) (*RootValue, error)
PutSuperSchema writes a new map entry for the table name and super schema supplied, it will overwrite an existing entry.
func (*RootValue) PutTable ¶
func (root *RootValue) PutTable(ctx context.Context, tName string, table *Table) (*RootValue, error)
PutTable inserts a table by name into the map of tables. If a table already exists with that name it will be replaced
func (*RootValue) RemoveTables ¶
func (*RootValue) RenameTable ¶
func (root *RootValue) RenameTable(ctx context.Context, oldName, newName string) (*RootValue, error)
RenameTable renames a table by changing its string key in the RootValue's table map. In order to preserve column tag information, use this method instead of a table drop + add.
func (*RootValue) ResolveTableName ¶
ResolveTableName resolves a case-insensitive name to the exact name as stored in Dolt. Returns false if no matching name was found.
func (*RootValue) SetTableHash ¶
func (*RootValue) TablesInConflict ¶
func (*RootValue) TablesWithConstraintViolations ¶
TablesWithConstraintViolations returns all tables that have constraint violations.
func (*RootValue) UpdateSuperSchemasFromOther ¶
func (root *RootValue) UpdateSuperSchemasFromOther(ctx context.Context, tblNames []string, other *RootValue) (*RootValue, error)
UpdateSuperSchemasFromOther updates SuperSchemas of tblNames using SuperSchemas from other.
func (*RootValue) VRW ¶
func (root *RootValue) VRW() types.ValueReadWriter
func (*RootValue) ValidateForeignKeysOnSchemas ¶
ValidateForeignKeysOnSchemas ensures that all foreign keys' tables are present, removing any foreign keys where the declared table is missing, and returning an error if a key is in an invalid state or a referenced table is missing. Does not check any tables' row data.
type RootValueUnreadable ¶
func (RootValueUnreadable) Error ¶
func (rvu RootValueUnreadable) Error() string
type Roots ¶
Roots is a convenience struct to package up the three roots that most library functions will need to inspect and modify the working set. This struct is designed to be passed by value always: functions should take a Roots as a param and return a modified one.
It contains three root values: Head: The root of the head of the current working branch Working: The root of the current working set Staged: The root of the staged value
See doltEnvironment.Roots(context.Context)
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table is a struct which holds row data, as well as a reference to its schema.
func NewNomsTable ¶
func NewNomsTable(ctx context.Context, vrw types.ValueReadWriter, sch schema.Schema, rows types.Map, indexes durable.IndexSet, autoIncVal types.Value) (*Table, error)
NewNomsTable creates a noms Struct which stores row data, index data, and schema.
func NewTable ¶
func NewTable(ctx context.Context, vrw types.ValueReadWriter, sch schema.Schema, rows durable.Index, indexes durable.IndexSet, autoIncVal types.Value) (*Table, error)
NewTable creates a durable object which stores row data, index data, and schema.
func (*Table) AddColumnToRows ¶
func (t *Table) AddColumnToRows(ctx context.Context, newCol string, newSchema schema.Schema) (*Table, error)
AddColumnToRows adds the column named to row data as necessary and returns the resulting table.
func (*Table) ClearConflicts ¶
ClearConflicts deletes all merge conflicts for this table.
func (*Table) DeleteIndexRowData ¶
DeleteIndexRowData removes the underlying map of an index, along with its key entry. This should only be used when removing an index altogether. If the intent is to clear an index's data, then use SetNomsIndexRows with an empty map.
func (*Table) Format ¶
func (t *Table) Format() *types.NomsBinFormat
Format returns the NomsBinFormat for this table.
func (*Table) GetAutoIncrementValue ¶
GetAutoIncrementValue returns the current AUTO_INCREMENT value for this table.
func (*Table) GetConflictSchemas ¶
func (t *Table) GetConflictSchemas(ctx context.Context) (base, sch, mergeSch schema.Schema, err error)
GetConflictSchemas returns the merge conflict schemas for this table.
func (*Table) GetConflicts ¶
func (t *Table) GetConflicts(ctx context.Context) (conflict.ConflictSchema, durable.ConflictIndex, error)
GetConflicts returns a map built from ValueReadWriter when there are no conflicts in table.
func (*Table) GetConstraintViolations ¶
GetConstraintViolations returns a map of all constraint violations for this table, along with a bool indicating whether the table has any violations.
func (*Table) GetConstraintViolationsSchema ¶
GetConstraintViolationsSchema returns this table's dolt_constraint_violations system table schema.
func (*Table) GetIndexRowData ¶
GetIndexRowData retrieves the underlying map of an index, in which the primary key consists of all indexed columns.
func (*Table) GetIndexSet ¶
GetIndexSet returns the internal index map which goes from index name to a ref of the row data map.
func (*Table) GetNomsIndexRowData ¶
GetNomsIndexRowData retrieves the underlying map of an index, in which the primary key consists of all indexed columns.
func (*Table) GetNomsRowData ¶
GetNomsRowData retrieves the underlying map which is a map from a primary key to a list of field values.
func (*Table) GetRowData ¶
GetRowData retrieves the underlying map which is a map from a primary key to a list of field values.
func (*Table) GetSchema ¶
GetSchema will retrieve the schema being referenced from the table in noms and unmarshal it.
func (*Table) GetSchemaHash ¶
GetSchemaHash returns the hash of this table's schema.
func (*Table) HasConflicts ¶
HasConflicts returns true if this table contains merge conflicts.
func (*Table) NumRowsInConflict ¶
NumRowsInConflict returns the number of rows with merge conflicts for this table.
func (*Table) RenameIndexRowData ¶
func (t *Table) RenameIndexRowData(ctx context.Context, oldIndexName, newIndexName string) (*Table, error)
RenameIndexRowData changes the name for the index data. Does not verify that the new name is unoccupied. If the old name does not exist, then this returns the called table without error.
func (*Table) ResolveConflicts ¶
func (t *Table) ResolveConflicts(ctx context.Context, pkTuples []types.Value) (invalid, notFound []types.Value, tbl *Table, err error)
ResolveConflicts resolves conflicts for this table.
func (*Table) SetAutoIncrementValue ¶
SetAutoIncrementValue sets the current AUTO_INCREMENT value for this table.
func (*Table) SetConflicts ¶
func (t *Table) SetConflicts(ctx context.Context, schemas conflict.ConflictSchema, conflictData durable.ConflictIndex) (*Table, error)
SetConflicts sets the merge conflicts for this table.
func (*Table) SetConstraintViolations ¶
func (t *Table) SetConstraintViolations(ctx context.Context, violationsMap types.Map) (*Table, error)
SetConstraintViolations sets this table's violations to the given map. If the map is empty, then the constraint violations entry on the embedded struct is removed.
func (*Table) SetIndexRows ¶
func (t *Table) SetIndexRows(ctx context.Context, indexName string, idx durable.Index) (*Table, error)
SetIndexRows replaces the current row data for the given index and returns an updated Table.
func (*Table) SetIndexSet ¶
SetIndexSet replaces the current internal index map, and returns an updated Table.
func (*Table) SetNomsIndexRows ¶
func (t *Table) SetNomsIndexRows(ctx context.Context, indexName string, idx types.Map) (*Table, error)
SetNomsIndexRows replaces the current row data for the given index and returns an updated Table.
func (*Table) UpdateNomsRows ¶
UpdateNomsRows replaces the current row data and returns and updated Table. Calls to UpdateNomsRows will not be written to the database. The root must be updated with the updated table, and the root must be committed or written.
func (*Table) UpdateRows ¶
UpdateRows replaces the current row data and returns and updated Table. Calls to UpdateRows will not be written to the database. The root must be updated with the updated table, and the root must be committed or written.
func (*Table) UpdateSchema ¶
UpdateSchema updates the table with the schema given and returns the updated table. The original table is unchanged. This method only updates the schema of a table; the row data is unchanged. Schema alterations that require rebuilding the table (e.g. adding a column in the middle, adding a new non-null column, adding a column in the middle of a schema) must account for these changes separately.
func (*Table) ValueReadWriter ¶
func (t *Table) ValueReadWriter() types.ValueReadWriter
ValueReadWriter returns the ValueReadWriter for this table.
type Tag ¶
type Tag struct { Name string Meta *datas.TagMeta Commit *Commit // contains filtered or unexported fields }
func NewTag ¶
func NewTag(ctx context.Context, name string, ds datas.Dataset, vrw types.ValueReadWriter) (*Tag, error)
NewTag creates a new Tag object.
func (*Tag) GetDoltRef ¶
GetDoltRef returns a DoltRef for this Tag.
type UnresolvedFKDetails ¶
type UnresolvedFKDetails struct { TableColumns []string `noms:"x_tbl_cols" json:"x_tbl_cols"` ReferencedTableColumns []string `noms:"x_ref_tbl_cols" json:"x_ref_tbl_cols"` }
UnresolvedFKDetails contains any details necessary for an unresolved foreign key to resolve to a valid foreign key.
type WorkingSet ¶
type WorkingSet struct { Name string // contains filtered or unexported fields }
func EmptyWorkingSet ¶
func EmptyWorkingSet(wsRef ref.WorkingSetRef) *WorkingSet
TODO: remove this, require working and staged
func NewWorkingSet ¶
func NewWorkingSet(ctx context.Context, name string, vrw types.ValueReadWriter, ds datas.Dataset) (*WorkingSet, error)
NewWorkingSet creates a new WorkingSet object.
func (WorkingSet) AbortMerge ¶
func (ws WorkingSet) AbortMerge() *WorkingSet
func (WorkingSet) ClearMerge ¶
func (ws WorkingSet) ClearMerge() *WorkingSet
func (*WorkingSet) HashOf ¶
func (ws *WorkingSet) HashOf() (hash.Hash, error)
HashOf returns the hash of the workingset struct, which is not the same as the hash of the root value stored in the working set. This value is used for optimistic locking when updating a working set for a head ref.
func (*WorkingSet) MergeActive ¶
func (ws *WorkingSet) MergeActive() bool
func (*WorkingSet) MergeState ¶
func (ws *WorkingSet) MergeState() *MergeState
func (WorkingSet) Meta ¶
func (ws WorkingSet) Meta() *datas.WorkingSetMeta
func (*WorkingSet) Ref ¶
func (ws *WorkingSet) Ref() ref.WorkingSetRef
Ref returns a WorkingSetRef for this WorkingSet.
func (*WorkingSet) StagedRoot ¶
func (ws *WorkingSet) StagedRoot() *RootValue
func (WorkingSet) StartMerge ¶
func (ws WorkingSet) StartMerge(commit *Commit) *WorkingSet
func (WorkingSet) WithMergeState ¶
func (ws WorkingSet) WithMergeState(mergeState *MergeState) *WorkingSet
func (WorkingSet) WithStagedRoot ¶
func (ws WorkingSet) WithStagedRoot(stagedRoot *RootValue) *WorkingSet
func (WorkingSet) WithWorkingRoot ¶
func (ws WorkingSet) WithWorkingRoot(workingRoot *RootValue) *WorkingSet
func (*WorkingSet) WorkingRoot ¶
func (ws *WorkingSet) WorkingRoot() *RootValue