-
-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create Dolt Database #2131
Create Dolt Database #2131
Conversation
…ovide initial state to session
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love it, but fine moving forward with this for now.
Particularly, the coupling of repo state and creation of in-memory databases is pretty nasty, should clean that up soon
pro := dsqle.NewDoltDatabaseProvider(dbs...) | ||
cat := sql.NewCatalogWithDbProvider(pro) | ||
|
||
infoDB := information_schema.NewInformationSchemaDatabase() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Past time to clean this up, no reason to make the integrator add this thing.
This should be available all the time based on databases provided to the engine.
Add a TODO?
ctx context.Context, | ||
name, email string, | ||
t time.Time, | ||
def ref.BranchRef, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def?
"github.com/dolthub/dolt/go/libraries/doltcore/ref" | ||
) | ||
|
||
func NewMemoryDbData(ctx context.Context) (DbData, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this in the env package?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean all these functions, not just this one
return spec | ||
} | ||
|
||
func (m MemoryRepoState) UpdateStagedRoot(ctx context.Context, newRoot *doltdb.RootValue) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mind adding a TODO to this and the other root update method? I'm in the middle of killing them in the interface, want to make sure to get them here too
} | ||
|
||
func (m MemoryRepoState) UpdateBranch(name string, new BranchConfig) error { | ||
return nil |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should throw an error
@@ -140,6 +153,41 @@ func NewDatabase(name string, dbData env.DbData, editOpts editor.Options) Databa | |||
} | |||
} | |||
|
|||
// GetInitialDBState returns the InitialDbState for |db|. | |||
func GetInitialDBState(ctx context.Context, db Database) (dsess.InitialDbState, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a note here that this is only to support the creation of in-memory databases.
The method of using repo state to initialize these things is pretty janky
@@ -26,7 +26,7 @@ defmodule SmokeTest do | |||
{:ok, result} = MyXQL.query(pid, "UPDATE test SET pk = pk where pk = 0") | |||
myTestFunc(result.num_rows, 1) | |||
|
|||
{:ok, result} = MyXQL.query(pid, "INSERT INTO test VALUES (0, 0) ON DUPLICATE KEY UPDATE value = value") | |||
{:ok, result} = MyXQL.query(pid, "INSERT INTO test VALUES (0, 0) ON DUPLICATE KEY UPDATE `value` = `value`") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a bad regression. File an issue?
This is pretty dope. Think the memory implementations will help new contributors a lot with understanding the fundamentals |
No description provided.