Documentation
¶
Index ¶
- Constants
- Variables
- func GetAbsRemoteUrl(fs filesys2.Filesys, cfg config.ReadableConfig, urlArg string) (string, string, error)
- func GetCurrentUserHomeDir() (string, error)
- func GetDefaultBranch(dEnv *DoltEnv, branches []ref.DoltRef) string
- func GetDefaultInitBranch(cfg config.ReadableConfig) string
- func GetGCKeepers(ctx context.Context, env *DoltEnv) ([]hash.Hash, error)
- func GetNameAndEmail(cfg config.ReadableConfig) (string, string, error)
- func GetRefSpecs(rsr RepoStateReader, remoteName string) ([]ref.RemoteRefSpec, error)
- func GetStringOrDefault(cfg config.ReadableConfig, key, defStr string) string
- func GetTrackingRef(branchRef ref.DoltRef, remote Remote) (ref.DoltRef, error)
- func IsEmptyRemote(r Remote) bool
- func NewMemoryDoltDB(ctx context.Context, initBranch string) (*doltdb.DoltDB, error)
- func ParseRSFromArgs(remName string, args []string) ([]ref.RemoteRefSpec, error)
- func WorkingSet(ctx context.Context, ddb *doltdb.DoltDB, rsr RepoStateReader) (*doltdb.WorkingSet, error)
- type BranchConfig
- type ConfigScope
- type DbData
- type DocsReadWriter
- type DoltCliConfig
- func (dcc *DoltCliConfig) CreateLocalConfig(vals map[string]string) error
- func (dcc *DoltCliConfig) GetConfig(element ConfigScope) (config.ReadWriteConfig, bool)
- func (dcc *DoltCliConfig) GetStringOrDefault(key, defStr string) string
- func (dcc *DoltCliConfig) IfEmptyUseConfig(val, key string) string
- func (dcc DoltCliConfig) SetFailsafes(cfg map[string]string)
- func (dcc *DoltCliConfig) WriteableConfig() config.ReadWriteConfig
- type DoltEnv
- func (dEnv *DoltEnv) AbortMerge(ctx context.Context) error
- func (dEnv *DoltEnv) AddBackup(name string, url string, fetchSpecs []string, params map[string]string) error
- func (dEnv *DoltEnv) AddRemote(name string, url string, fetchSpecs []string, params map[string]string) error
- func (dEnv *DoltEnv) BulkDbEaFactory() editor.DbEaFactory
- func (dEnv *DoltEnv) ClearMerge(ctx context.Context) error
- func (dEnv *DoltEnv) CredsDir() (string, error)
- func (dEnv *DoltEnv) DbData() DbData
- func (dEnv *DoltEnv) DbEaFactory() editor.DbEaFactory
- func (dEnv *DoltEnv) DocsReadWriter() DocsReadWriter
- func (dEnv *DoltEnv) FindCreds(credsDir, pubKeyOrId string) (string, error)
- func (dEnv *DoltEnv) FindRef(ctx context.Context, refStr string) (ref.DoltRef, error)
- func (dEnv *DoltEnv) GetBackups() (map[string]Remote, error)
- func (dEnv *DoltEnv) GetBranches() (map[string]BranchConfig, error)
- func (dEnv *DoltEnv) GetDoltDir() string
- func (dEnv *DoltEnv) GetGRPCDialParams(config grpcendpoint.Config) (string, []grpc.DialOption, error)
- func (dEnv *DoltEnv) GetRemotes() (map[string]Remote, error)
- func (dEnv *DoltEnv) GetTablesWithConflicts(ctx context.Context) ([]string, error)
- func (dEnv *DoltEnv) GetUserHomeDir() (string, error)
- func (dEnv *DoltEnv) HasDoltDataDir() bool
- func (dEnv *DoltEnv) HasDoltDir() bool
- func (dEnv *DoltEnv) HasDoltTempTableDir() bool
- func (dEnv *DoltEnv) HasLocalConfig() bool
- func (dEnv *DoltEnv) HeadRoot(ctx context.Context) (*doltdb.RootValue, error)
- func (dEnv *DoltEnv) InitDBAndRepoState(ctx context.Context, nbf *types.NomsBinFormat, name, email, branchName string, ...) error
- func (dEnv *DoltEnv) InitDBWithTime(ctx context.Context, nbf *types.NomsBinFormat, name, email, branchName string, ...) error
- func (dEnv *DoltEnv) InitRepo(ctx context.Context, nbf *types.NomsBinFormat, name, email, branchName string) error
- func (dEnv *DoltEnv) InitRepoWithNoData(ctx context.Context, nbf *types.NomsBinFormat) error
- func (dEnv *DoltEnv) InitRepoWithTime(ctx context.Context, nbf *types.NomsBinFormat, name, email, branchName string, ...) error
- func (dEnv *DoltEnv) InitializeRepoState(ctx context.Context, branchName string) error
- func (dEnv *DoltEnv) IsMergeActive(ctx context.Context) (bool, error)
- func (dEnv *DoltEnv) NewWorkingSetMeta(message string) *datas.WorkingSetMeta
- func (dEnv *DoltEnv) RecoveryRoots(ctx context.Context) (doltdb.Roots, error)
- func (dEnv *DoltEnv) RemoveBackup(ctx context.Context, name string) error
- func (dEnv *DoltEnv) RemoveRemote(ctx context.Context, name string) error
- func (dEnv *DoltEnv) RepoStateReader() RepoStateReader
- func (dEnv *DoltEnv) RepoStateWriter() RepoStateWriter
- func (dEnv *DoltEnv) Roots(ctx context.Context) (doltdb.Roots, error)
- func (dEnv *DoltEnv) StagedRoot(ctx context.Context) (*doltdb.RootValue, error)
- func (dEnv *DoltEnv) StartMerge(ctx context.Context, commit *doltdb.Commit) error
- func (dEnv *DoltEnv) TempTableFilesDir() string
- func (dEnv *DoltEnv) UpdateBranch(name string, new BranchConfig) error
- func (dEnv *DoltEnv) UpdateRoots(ctx context.Context, roots doltdb.Roots) error
- func (dEnv *DoltEnv) UpdateStagedRoot(ctx context.Context, newRoot *doltdb.RootValue) error
- func (dEnv *DoltEnv) UpdateWorkingRoot(ctx context.Context, newRoot *doltdb.RootValue) error
- func (dEnv *DoltEnv) UpdateWorkingSet(ctx context.Context, ws *doltdb.WorkingSet) error
- func (dEnv *DoltEnv) UserRPCCreds() (creds.DoltCreds, bool, error)
- func (dEnv *DoltEnv) Valid() bool
- func (dEnv *DoltEnv) WorkingRoot(ctx context.Context) (*doltdb.RootValue, error)
- func (dEnv *DoltEnv) WorkingSet(ctx context.Context) (*doltdb.WorkingSet, error)
- type EnvNameAndPath
- type HomeDirProvider
- type MemoryRepoState
- func (m MemoryRepoState) AddBackup(name string, url string, fetchSpecs []string, params map[string]string) error
- func (m MemoryRepoState) AddRemote(name string, url string, fetchSpecs []string, params map[string]string) error
- func (m MemoryRepoState) CWBHeadRef() ref.DoltRef
- func (m MemoryRepoState) CWBHeadSpec() *doltdb.CommitSpec
- func (m MemoryRepoState) GetBackups() (map[string]Remote, error)
- func (m MemoryRepoState) GetBranches() (map[string]BranchConfig, error)
- func (m MemoryRepoState) GetDocsOnDisk(docNames ...string) (doltdocs.Docs, error)
- func (m MemoryRepoState) GetRemotes() (map[string]Remote, error)
- func (m MemoryRepoState) RemoveBackup(ctx context.Context, name string) error
- func (m MemoryRepoState) RemoveRemote(ctx context.Context, name string) error
- func (m MemoryRepoState) SetCWBHeadRef(_ context.Context, r ref.MarshalableRef) (err error)
- func (m MemoryRepoState) TempTableFilesDir() string
- func (m MemoryRepoState) UpdateBranch(name string, new BranchConfig) error
- func (m MemoryRepoState) UpdateStagedRoot(ctx context.Context, newRoot *doltdb.RootValue) error
- func (m MemoryRepoState) UpdateWorkingRoot(ctx context.Context, newRoot *doltdb.RootValue) error
- func (m MemoryRepoState) WorkingSet(ctx context.Context) (*doltdb.WorkingSet, error)
- func (m MemoryRepoState) WriteDocsToDisk(docs doltdocs.Docs) error
- type MultiRepoEnv
- func DoltEnvAsMultiEnv(ctx context.Context, dEnv *DoltEnv) (*MultiRepoEnv, error)
- func LoadMultiEnv(ctx context.Context, hdp HomeDirProvider, cfg config.ReadWriteConfig, ...) (*MultiRepoEnv, error)
- func LoadMultiEnvFromDir(ctx context.Context, hdp HomeDirProvider, cfg config.ReadWriteConfig, ...) (*MultiRepoEnv, error)
- func MultiEnvForDirectory(ctx context.Context, config config.ReadWriteConfig, fs filesys.Filesys, ...) (*MultiRepoEnv, error)
- func (mrEnv *MultiRepoEnv) AddEnv(name string, dEnv *DoltEnv)
- func (mrEnv *MultiRepoEnv) Config() config.ReadWriteConfig
- func (mrEnv *MultiRepoEnv) FileSystem() filesys.Filesys
- func (mrEnv *MultiRepoEnv) GetEnv(name string) *DoltEnv
- func (mrEnv *MultiRepoEnv) GetWorkingRoots(ctx context.Context) (map[string]*doltdb.RootValue, error)
- func (mrEnv *MultiRepoEnv) Iter(cb func(name string, dEnv *DoltEnv) (stop bool, err error)) error
- type NamedEnv
- type PullSpec
- type PushOpts
- type Remote
- func (r *Remote) GetParam(pName string) (string, bool)
- func (r *Remote) GetParamOrDefault(pName, defVal string) string
- func (r *Remote) GetRemoteDB(ctx context.Context, nbf *types.NomsBinFormat) (*doltdb.DoltDB, error)
- func (r *Remote) GetRemoteDBWithoutCaching(ctx context.Context, nbf *types.NomsBinFormat) (*doltdb.DoltDB, error)
- type RepoState
- func (rs *RepoState) AddBackup(r Remote)
- func (rs *RepoState) AddRemote(r Remote)
- func (rs *RepoState) CWBHeadRef() ref.DoltRef
- func (rs *RepoState) CWBHeadSpec() *doltdb.CommitSpec
- func (rs *RepoState) RemoveBackup(r Remote)
- func (rs *RepoState) RemoveRemote(r Remote)
- func (rs RepoState) Save(fs filesys.ReadWriteFS) error
- type RepoStateReader
- type RepoStateWriter
- type RootsProvider
Constants ¶
const ( UserEmailKey = "user.email" UserNameKey = "user.name" // should be able to have remote specific creds? UserCreds = "user.creds" DoltEditor = "core.editor" InitBranchName = "init.defaultbranch" RemotesApiHostKey = "remotes.default_host" RemotesApiHostPortKey = "remotes.default_port" AddCredsUrlKey = "creds.add_url" DoltLabInsecureKey = "doltlab.insecure" MetricsDisabled = "metrics.disabled" MetricsHost = "metrics.host" MetricsPort = "metrics.port" MetricsInsecure = "metrics.insecure" )
const ( DefaultEmail = "doltuser@dolthub.com" DefaultName = "Dolt System Account" )
const ( DefaultInitBranch = "main" DefaultLoginUrl = "https://dolthub.com/settings/credentials" DefaultMetricsHost = "eventsapi.dolthub.com" DefaultMetricsPort = "443" DefaultRemotesApiHost = "doltremoteapi.dolthub.com" DefaultRemotesApiPort = "443" )
const (
// SqlServerGlobalsPrefix is config namespace accessible by the SQL engine (ex: sqlserver.global.key)
SqlServerGlobalsPrefix = "sqlserver.global"
)
Variables ¶
var DefaultFailsafeConfig = map[string]string{ UserEmailKey: DefaultEmail, UserNameKey: DefaultName, }
var ErrBackupAlreadyExists = errors.New("backup already exists")
var ErrBackupNotFound = errors.New("backup not found")
var ErrBranchDoesNotMatchUpstream = errors.New("the upstream branch of your current branch does not match the nane if your current branch")
var ErrCannotPushRef = errors.New("cannot push ref")
var ErrCannotSetUpstreamForTag = errors.New("cannot set upstream for tag")
var ErrCantDetermineDefault = errors.New("unable to determine the default remote")
var ErrFailedToDeleteBackup = errors.New("failed to delete backup")
var ErrFailedToDeleteRemote = errors.New("failed to delete remote")
var ErrFailedToReadDb = errors.New("failed to read from the db")
var ErrFailedToReadFromDb = errors.New("failed to read from db")
var ErrFailedToWriteRepoState = errors.New("failed to write repo state")
var ErrInvalidBackupName = errors.New("backup name invalid")
var ErrInvalidBackupURL = errors.New("backup URL invalid")
var ErrInvalidCredsFile = errors.New("invalid creds file")
var ErrInvalidFetchSpec = errors.New("invalid fetch spec")
var ErrInvalidRefSpecRemote = errors.New("refspec refers to different remote")
var ErrInvalidRemoteName = errors.New("remote name invalid")
var ErrInvalidRemoteURL = errors.New("remote URL invalid")
var ErrInvalidSetUpstreamArgs = errors.New("invalid set-upstream arguments")
var ErrMarshallingSchema = errors.New("error marshalling schema")
var ErrNoRefSpecForRemote = errors.New("no refspec for remote")
var ErrNoRemote = errors.New("no remote")
var ErrNoUpstreamForBranch = errors.New("the current branch has no upstream branch")
var ErrNotACred = errors.New("not a valid credential key id or public key")
var ErrPreexistingDoltDir = errors.New(".dolt dir already exists")
var ErrRemoteAddressConflict = errors.New("address conflict with a remote")
var ErrRemoteAlreadyExists = errors.New("remote already exists")
var ErrRemoteNotFound = errors.New("remote not found")
var ErrStateUpdate = errors.New("error updating local data repo state")
var ErrUnknownBranch = errors.New("unknown branch")
var ErrUnknownRemote = errors.New("unknown remote")
var ErrUpstreamBranchAlreadySet = errors.New("upstream branch already set")
var GlobalConfigWhitelist = set.NewStrSet([]string{UserNameKey, UserEmailKey})
var LocalConfigWhitelist = set.NewStrSet([]string{UserNameKey, UserEmailKey})
var NoRemote = Remote{}
Functions ¶
func GetAbsRemoteUrl ¶
func GetCurrentUserHomeDir ¶
GetCurrentUserHomeDir will return the current user's home directory by default. This directory is where global dolt state will be stored inside of the .dolt directory. The environment variable DOLT_ROOT_PATH can be used to provide a different directory where the root .dolt directory should be located and global state will be stored there.
func GetDefaultBranch ¶
GetDefaultBranch returns the default branch from among the branches given, returning the configs default config branch first, then init branch main, then the old init branch master, and finally the first lexicographical branch if none of the others are found
func GetDefaultInitBranch ¶
func GetDefaultInitBranch(cfg config.ReadableConfig) string
func GetGCKeepers ¶
GetGCKeepers returns the hashes of all the objects in the environment provided that should be perserved during GC. TODO: this should be unnecessary since we now store the working set in a noms dataset, remove it
func GetNameAndEmail ¶
func GetNameAndEmail(cfg config.ReadableConfig) (string, string, error)
GetNameAndEmail returns the name and email from the supplied config
func GetRefSpecs ¶
func GetRefSpecs(rsr RepoStateReader, remoteName string) ([]ref.RemoteRefSpec, error)
GetRefSpecs takes an optional remoteName and returns all refspecs associated with that remote. If "" is passed as the remoteName then the default remote is used.
func GetStringOrDefault ¶
func GetStringOrDefault(cfg config.ReadableConfig, key, defStr string) string
func GetTrackingRef ¶
func IsEmptyRemote ¶
func NewMemoryDoltDB ¶
func ParseRSFromArgs ¶
func ParseRSFromArgs(remName string, args []string) ([]ref.RemoteRefSpec, error)
func WorkingSet ¶
func WorkingSet(ctx context.Context, ddb *doltdb.DoltDB, rsr RepoStateReader) (*doltdb.WorkingSet, error)
Types ¶
type BranchConfig ¶
type BranchConfig struct { Merge ref.MarshalableRef `json:"head"` Remote string `json:"remote"` }
type ConfigScope ¶
type ConfigScope int
ConfigScope is an enum representing the elements that make up the ConfigHierarchy
const ( // LocalConfig is the repository's local config portion of the ConfigHierarchy LocalConfig ConfigScope = iota // GlobalConfig is the user's global config portion of the ConfigHierarchy GlobalConfig )
func (ConfigScope) String ¶
func (ce ConfigScope) String() string
String gives the string name of an element that was used when it was added to the ConfigHierarchy, which is the same name that is used to retrieve that element of the string hierarchy.
type DbData ¶
type DbData struct { Ddb *doltdb.DoltDB Rsw RepoStateWriter Rsr RepoStateReader Drw DocsReadWriter }
func NewMemoryDbData ¶
type DocsReadWriter ¶
type DocsReadWriter interface { // GetDocsOnDisk returns the docs in the filesytem optionally filtered by docNames. GetDocsOnDisk(docNames ...string) (doltdocs.Docs, error) // WriteDocsToDisk updates the documents stored in the filesystem with the contents in docs. WriteDocsToDisk(docs doltdocs.Docs) error }
type DoltCliConfig ¶
type DoltCliConfig struct { config.ReadableConfig // contains filtered or unexported fields }
DoltCliConfig is the config for the cli
func LoadDoltCliConfig ¶
func LoadDoltCliConfig(hdp HomeDirProvider, fs filesys.ReadWriteFS) (*DoltCliConfig, error)
func (*DoltCliConfig) CreateLocalConfig ¶
func (dcc *DoltCliConfig) CreateLocalConfig(vals map[string]string) error
CreateLocalConfig creates a new repository local config file. The current directory must have already been initialized as a data repository before a local config can be created.
func (*DoltCliConfig) GetConfig ¶
func (dcc *DoltCliConfig) GetConfig(element ConfigScope) (config.ReadWriteConfig, bool)
GetConfig retrieves a specific element of the config hierarchy.
func (*DoltCliConfig) GetStringOrDefault ¶
func (dcc *DoltCliConfig) GetStringOrDefault(key, defStr string) string
GetStringOrDefault retrieves a string from the config hierarchy and returns it if available. Otherwise it returns the default string value
func (*DoltCliConfig) IfEmptyUseConfig ¶
func (dcc *DoltCliConfig) IfEmptyUseConfig(val, key string) string
IfEmptyUseConfig looks at a strings value and if it is an empty string will try to return a value from the config hierarchy. If it is missing in the config a pointer to an empty string will be returned.
func (DoltCliConfig) SetFailsafes ¶
func (dcc DoltCliConfig) SetFailsafes(cfg map[string]string)
SetFailsafes sets the config values given as failsafes, i.e. values that will be returned as a last resort if they are not found elsewhere in the config hierarchy. The "failsafe" config can be written to in order to conform to the interface of ConfigHierarchy, but values will not persist beyond this session. Calling SetFailsafes more than once will overwrite any previous values. Should only be called after primary configuration of the config hierarchy has been completed.
func (*DoltCliConfig) WriteableConfig ¶
func (dcc *DoltCliConfig) WriteableConfig() config.ReadWriteConfig
WriteableConfig returns a ReadWriteConfig reading from this config hierarchy. The config will read from the hierarchy and write to the local config if it's available, or the global config otherwise.
type DoltEnv ¶
type DoltEnv struct { Version string Config *DoltCliConfig CfgLoadErr error RepoState *RepoState RSLoadErr error Docs doltdocs.Docs DocsLoadErr error DoltDB *doltdb.DoltDB DBLoadError error FS filesys.Filesys // contains filtered or unexported fields }
DoltEnv holds the state of the current environment used by the cli.
func Load ¶
func Load(ctx context.Context, hdp HomeDirProvider, fs filesys.Filesys, urlStr, version string) *DoltEnv
Load loads the DoltEnv for the current directory of the cli
func (*DoltEnv) BulkDbEaFactory ¶
func (dEnv *DoltEnv) BulkDbEaFactory() editor.DbEaFactory
func (*DoltEnv) DbEaFactory ¶
func (dEnv *DoltEnv) DbEaFactory() editor.DbEaFactory
func (*DoltEnv) DocsReadWriter ¶
func (dEnv *DoltEnv) DocsReadWriter() DocsReadWriter
func (*DoltEnv) GetBranches ¶
func (dEnv *DoltEnv) GetBranches() (map[string]BranchConfig, error)
func (*DoltEnv) GetDoltDir ¶
GetDoltDir returns the path to the .dolt directory
func (*DoltEnv) GetGRPCDialParams ¶
func (dEnv *DoltEnv) GetGRPCDialParams(config grpcendpoint.Config) (string, []grpc.DialOption, error)
func (*DoltEnv) GetTablesWithConflicts ¶
func (*DoltEnv) GetUserHomeDir ¶
GetUserHomeDir returns the user's home dir based on current filesys
func (*DoltEnv) HasDoltDataDir ¶
func (*DoltEnv) HasDoltDir ¶
HasDoltDir returns true if the .dolt directory exists and is a valid directory
func (*DoltEnv) HasDoltTempTableDir ¶
func (*DoltEnv) HasLocalConfig ¶
HasLocalConfig returns true if a repository local config file
func (*DoltEnv) InitDBAndRepoState ¶
func (dEnv *DoltEnv) InitDBAndRepoState(ctx context.Context, nbf *types.NomsBinFormat, name, email, branchName string, t time.Time) error
Inits the dolt DB of this environment with an empty commit at the time given and writes default docs to disk. Writes new repo state with a main branch and current root hash.
func (*DoltEnv) InitDBWithTime ¶
func (dEnv *DoltEnv) InitDBWithTime(ctx context.Context, nbf *types.NomsBinFormat, name, email, branchName string, t time.Time) error
Inits the dolt DB of this environment with an empty commit at the time given and writes default docs to disk. Does not update repo state.
func (*DoltEnv) InitRepo ¶
func (dEnv *DoltEnv) InitRepo(ctx context.Context, nbf *types.NomsBinFormat, name, email, branchName string) error
InitRepo takes an empty directory and initializes it with a .dolt directory containing repo state, uncommitted license and readme, and creates a noms database with dolt structure.
func (*DoltEnv) InitRepoWithNoData ¶
func (*DoltEnv) InitRepoWithTime ¶
func (*DoltEnv) InitializeRepoState ¶
InitializeRepoState writes a default repo state to disk, consisting of a main branch and current root hash value.
func (*DoltEnv) IsMergeActive ¶
func (*DoltEnv) NewWorkingSetMeta ¶
func (dEnv *DoltEnv) NewWorkingSetMeta(message string) *datas.WorkingSetMeta
func (*DoltEnv) RecoveryRoots ¶
RecoveryRoots returns the roots for this environment in the case that the currently checked out branch has been deleted or HEAD has been updated in a non-principled way to point to a branch that does not exist. This is used by `dolt checkout`, in particular, to go forward with a `dolt checkout` of an existing branch in the degraded state where the current branch was deleted.
func (*DoltEnv) RemoveBackup ¶
func (*DoltEnv) RemoveRemote ¶
func (*DoltEnv) RepoStateReader ¶
func (dEnv *DoltEnv) RepoStateReader() RepoStateReader
func (*DoltEnv) RepoStateWriter ¶
func (dEnv *DoltEnv) RepoStateWriter() RepoStateWriter
func (*DoltEnv) StagedRoot ¶
StagedRoot returns the staged root value in the current working set
func (*DoltEnv) StartMerge ¶
func (*DoltEnv) TempTableFilesDir ¶
func (*DoltEnv) UpdateBranch ¶
func (dEnv *DoltEnv) UpdateBranch(name string, new BranchConfig) error
func (*DoltEnv) UpdateRoots ¶
UpdateRoots updates the working and staged roots for this environment
func (*DoltEnv) UpdateStagedRoot ¶
UpdateStagedRoot updates the staged root for the current working branch. This can fail if multiple clients attempt to update at the same time.
func (*DoltEnv) UpdateWorkingRoot ¶
UpdateWorkingRoot updates the working root for the current working branch to the root value given. This method can fail if another client updates the working root at the same time.
func (*DoltEnv) UpdateWorkingSet ¶
UpdateWorkingSet updates the working set for the current working branch to the value given. This method can fail if another client updates the working set at the same time.
func (*DoltEnv) Valid ¶
Valid returns whether this environment has been properly initialized. This is useful because although every command gets a DoltEnv, not all of them require it, and we allow invalid dolt envs to be passed around for this reason.
func (*DoltEnv) WorkingRoot ¶
WorkingRoot returns the working root for the current working branch
func (*DoltEnv) WorkingSet ¶
type EnvNameAndPath ¶
type EnvNameAndPath struct { // Name is the name of the environment and is used as the identifier when accessing a given environment Name string // Path is the path on disk to where the environment lives Path string }
EnvNameAndPath is a simple tuple of the name of an environment and the path to where it is on disk
func DBNamesAndPathsFromDir ¶
func DBNamesAndPathsFromDir(fs filesys.Filesys, path string) ([]EnvNameAndPath, error)
type HomeDirProvider ¶
HomeDirProvider is a function that returns the users home directory. This is where global dolt state is stored for the current user
type MemoryRepoState ¶
func NewMemoryRepoState ¶
func (MemoryRepoState) CWBHeadRef ¶
func (m MemoryRepoState) CWBHeadRef() ref.DoltRef
func (MemoryRepoState) CWBHeadSpec ¶
func (m MemoryRepoState) CWBHeadSpec() *doltdb.CommitSpec
func (MemoryRepoState) GetBackups ¶
func (m MemoryRepoState) GetBackups() (map[string]Remote, error)
func (MemoryRepoState) GetBranches ¶
func (m MemoryRepoState) GetBranches() (map[string]BranchConfig, error)
func (MemoryRepoState) GetDocsOnDisk ¶
func (m MemoryRepoState) GetDocsOnDisk(docNames ...string) (doltdocs.Docs, error)
func (MemoryRepoState) GetRemotes ¶
func (m MemoryRepoState) GetRemotes() (map[string]Remote, error)
func (MemoryRepoState) RemoveBackup ¶
func (m MemoryRepoState) RemoveBackup(ctx context.Context, name string) error
func (MemoryRepoState) RemoveRemote ¶
func (m MemoryRepoState) RemoveRemote(ctx context.Context, name string) error
func (MemoryRepoState) SetCWBHeadRef ¶
func (m MemoryRepoState) SetCWBHeadRef(_ context.Context, r ref.MarshalableRef) (err error)
func (MemoryRepoState) TempTableFilesDir ¶
func (m MemoryRepoState) TempTableFilesDir() string
func (MemoryRepoState) UpdateBranch ¶
func (m MemoryRepoState) UpdateBranch(name string, new BranchConfig) error
func (MemoryRepoState) UpdateStagedRoot ¶
func (MemoryRepoState) UpdateWorkingRoot ¶
func (MemoryRepoState) WorkingSet ¶
func (m MemoryRepoState) WorkingSet(ctx context.Context) (*doltdb.WorkingSet, error)
func (MemoryRepoState) WriteDocsToDisk ¶
func (m MemoryRepoState) WriteDocsToDisk(docs doltdocs.Docs) error
type MultiRepoEnv ¶
type MultiRepoEnv struct {
// contains filtered or unexported fields
}
MultiRepoEnv is a type used to store multiple environments which can be retrieved by name
func DoltEnvAsMultiEnv ¶
func DoltEnvAsMultiEnv(ctx context.Context, dEnv *DoltEnv) (*MultiRepoEnv, error)
DoltEnvAsMultiEnv returns a MultiRepoEnv which wraps the DoltEnv and names it based on the directory DoltEnv refers to. If the env given doesn't contain a valid dolt database, creates a MultiEnvRepo from any databases found in the directory at the root of the filesystem and returns that.
func LoadMultiEnv ¶
func LoadMultiEnv( ctx context.Context, hdp HomeDirProvider, cfg config.ReadWriteConfig, fs filesys.Filesys, version string, envNamesAndPaths ...EnvNameAndPath, ) (*MultiRepoEnv, error)
LoadMultiEnv takes a variable list of EnvNameAndPath objects loads each of the environments, and returns a new MultiRepoEnv
func LoadMultiEnvFromDir ¶
func LoadMultiEnvFromDir( ctx context.Context, hdp HomeDirProvider, cfg config.ReadWriteConfig, fs filesys.Filesys, path, version string, ) (*MultiRepoEnv, error)
LoadMultiEnvFromDir looks at each subfolder of the given path as a Dolt repository and attempts to return a MultiRepoEnv with initialized environments for each of those subfolder data repositories. subfolders whose name starts with '.' are skipped.
func MultiEnvForDirectory ¶
func MultiEnvForDirectory( ctx context.Context, config config.ReadWriteConfig, fs filesys.Filesys, version string, ) (*MultiRepoEnv, error)
MultiEnvForDirectory returns a MultiRepoEnv for the directory rooted at the file system given
func (*MultiRepoEnv) AddEnv ¶
func (mrEnv *MultiRepoEnv) AddEnv(name string, dEnv *DoltEnv)
TODO: un export AddEnv adds an environment to the MultiRepoEnv by name
func (*MultiRepoEnv) Config ¶
func (mrEnv *MultiRepoEnv) Config() config.ReadWriteConfig
func (*MultiRepoEnv) FileSystem ¶
func (mrEnv *MultiRepoEnv) FileSystem() filesys.Filesys
func (*MultiRepoEnv) GetEnv ¶
func (mrEnv *MultiRepoEnv) GetEnv(name string) *DoltEnv
GetEnv returns the env with the name given, or nil if no such env exists
func (*MultiRepoEnv) GetWorkingRoots ¶
func (mrEnv *MultiRepoEnv) GetWorkingRoots(ctx context.Context) (map[string]*doltdb.RootValue, error)
GetWorkingRoots returns a map with entries for each environment name with a value equal to the working root for that environment
type PullSpec ¶
type PullSpec struct { Msg string Squash bool Noff bool Force bool RemoteName string Remote Remote RefSpecs []ref.RemoteRefSpec Branch ref.DoltRef }
func NewPullSpec ¶
type PushOpts ¶
type PushOpts struct { SrcRef ref.DoltRef DestRef ref.DoltRef RemoteRef ref.DoltRef Remote Remote Mode ref.UpdateMode SetUpstream bool }
func NewPushOpts ¶
type Remote ¶
type Remote struct { Name string `json:"name"` Url string `json:"url"` FetchSpecs []string `json:"fetch_specs"` Params map[string]string `json:"params"` // contains filtered or unexported fields }
func GetDefaultRemote ¶
func GetDefaultRemote(rsr RepoStateReader) (Remote, error)
GetDefaultRemote gets the default remote for the environment. Not fully implemented yet. Needs to support multiple repos and a configurable default.
func NewFetchOpts ¶
func NewFetchOpts(args []string, rsr RepoStateReader) (Remote, []ref.RemoteRefSpec, error)
func (*Remote) GetParamOrDefault ¶
func (*Remote) GetRemoteDB ¶
func (*Remote) GetRemoteDBWithoutCaching ¶
type RepoState ¶
type RepoState struct { Head ref.MarshalableRef `json:"head"` Remotes map[string]Remote `json:"remotes"` Backups map[string]Remote `json:"backups"` Branches map[string]BranchConfig `json:"branches"` // contains filtered or unexported fields }
func CloneRepoState ¶
func CloneRepoState(fs filesys.ReadWriteFS, r Remote) (*RepoState, error)
func CreateRepoState ¶
func CreateRepoState(fs filesys.ReadWriteFS, br string) (*RepoState, error)
func LoadRepoState ¶
func LoadRepoState(fs filesys.ReadWriteFS) (*RepoState, error)
LoadRepoState parses the repo state file from the file system given
func (*RepoState) CWBHeadRef ¶
func (*RepoState) CWBHeadSpec ¶
func (rs *RepoState) CWBHeadSpec() *doltdb.CommitSpec
func (*RepoState) RemoveBackup ¶
func (*RepoState) RemoveRemote ¶
type RepoStateReader ¶
type RepoStateWriter ¶
type RepoStateWriter interface { // TODO: get rid of this UpdateStagedRoot(ctx context.Context, newRoot *doltdb.RootValue) error // TODO: get rid of this UpdateWorkingRoot(ctx context.Context, newRoot *doltdb.RootValue) error SetCWBHeadRef(context.Context, ref.MarshalableRef) error AddRemote(name string, url string, fetchSpecs []string, params map[string]string) error AddBackup(name string, url string, fetchSpecs []string, params map[string]string) error RemoveRemote(ctx context.Context, name string) error RemoveBackup(ctx context.Context, name string) error TempTableFilesDir() string UpdateBranch(name string, new BranchConfig) error }