Skip to content
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

Rename ExportAdapter to DatabaseController, start splitting Mongo specific logic. #698

Merged
merged 4 commits into from
Feb 29, 2016

Conversation

nlutsenko
Copy link
Contributor

This is a first PR that kickstarts the effort to move use away from Mongo-specific storage, and implement Postgres.

After playing with 3-5 different approaches, turns out that the best one is to reuse all the logic that we have right now in ExportAdapter, and then decouple piece by piece away from it. This still guarantees that we are not duplicating logic/names/classes/functions, but are moving into storage-independent future.

Now back to this PR:

  • Rename ExportAdapter to DatabaseController
  • Completely move mongo connection creation to Mongo adapter.
  • Move collection getting/creation completely to Mongo adapter.

Turns out that by doing all of this - we also can kill the requirement for calling connect() on the DatabaseController before any operation.

cc @lacker, @gfosco

@facebook-github-bot
Copy link

@nlutsenko updated the pull request.


// options can contain:
// collectionPrefix: the string to put in front of every collection name.
function ExportAdapter(mongoURI, options = {}) {
this.mongoURI = mongoURI;
function DatabaseController(adapter, { collectionPrefix } = {}) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may wanna use AdaptableController here as it ensures the prototype of the adapter matches the expected adapter prototype

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, a little bit later tho.

@drew-gross
Copy link
Contributor

One optional nit, otherwise looks good to me. The cleanup around connect looks especially nice.

@facebook-github-bot
Copy link

@nlutsenko updated the pull request.

nlutsenko added a commit that referenced this pull request Feb 29, 2016
Rename ExportAdapter to DatabaseController, start splitting Mongo specific logic.
@nlutsenko nlutsenko merged commit e9699b6 into master Feb 29, 2016
@nlutsenko nlutsenko deleted the nlutsenko.database.controller branch February 29, 2016 22:09
@flovilmart
Copy link
Contributor

more rebase madness for #627 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants