Skip to content
This repository was archived by the owner on Nov 6, 2019. It is now read-only.

Implement Datastore class#371

Merged
sccolbert merged 18 commits intophosphorjs:feature-tables3from
vidartf:feature-tables3
Jun 8, 2019
Merged

Implement Datastore class#371
sccolbert merged 18 commits intophosphorjs:feature-tables3from
vidartf:feature-tables3

Conversation

@vidartf
Copy link
Copy Markdown
Contributor

@vidartf vidartf commented Feb 6, 2019

  • Implements the Datastore class.
  • Removes the datastore server adapter. This is better put in an example (will submit in a separate PR if this gets an OK).

@vidartf
Copy link
Copy Markdown
Contributor Author

vidartf commented Feb 6, 2019

One possible change to this PR, that would probably make sense would be to make the transactionBroadcastHandler of the datastore a mandatory constructor argument. I'd love some input on that.

Copy link
Copy Markdown
Member

@sccolbert sccolbert left a comment

Choose a reason for hiding this comment

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

Initial review done. Will do round two after these changes are made.

Thanks!

Comment thread packages/datastore/package.json Outdated
Comment thread packages/datastore/package.json
Comment thread packages/datastore/src/datastore.ts Outdated
Comment thread packages/datastore/src/datastore.ts
Comment thread packages/datastore/src/datastore.ts Outdated
Comment thread packages/datastore/src/datastore.ts Outdated
Comment thread packages/datastore/src/datastore.ts Outdated
Comment thread packages/datastore/src/datastore.ts
Comment thread packages/datastore/src/datastore.ts Outdated
Comment thread packages/datastore/src/datastore.ts
- Match TS version to that in master
- Validate schemas on datastore creation
- Have tables collection be a BPlusTree
- Throw error / log warning for missing tables.
- Implement IMessageHandler instead of `apply()`.
- Require broadcastHandler arg on creation.
- Store current transaction id on schema.
- Make broadcastHandler optional again, but still readonly.
- Add an option transactionIdFactory to override createDuplexId.
@vidartf
Copy link
Copy Markdown
Contributor Author

vidartf commented Feb 12, 2019

Thanks for the review. I pushed some fixes to most of the points. Will still need to take them for a test to see that they work as intended, but they are mostly there. The only point I was unsure about is the version number:

Why does the version number need to be communicated among the stores? Given the asynchronous nature of the broadcasting, there is likely to be transactions that are created simultaneously from identical versions.

@vidartf
Copy link
Copy Markdown
Contributor Author

vidartf commented Feb 12, 2019

PS: While I did make the broadcast handler a readonly argument, I kept it as optional. This will allow it to be used as a local (undoable) datastore when offline as a fallback. Not committed to that feature though.

@vidartf
Copy link
Copy Markdown
Contributor Author

vidartf commented Feb 19, 2019

Why does the version number need to be communicated among the stores?

To answer my own question, it is used to determine concurrent changes in peers (same version for two changes implies concurrent changes).

@vidartf
Copy link
Copy Markdown
Contributor Author

vidartf commented Mar 1, 2019

@sccolbert I've addressed all the points of the current review, so it should be ready for another look.

@sccolbert sccolbert merged commit 43a52e4 into phosphorjs:feature-tables3 Jun 8, 2019
@vidartf vidartf deleted the feature-tables3 branch June 8, 2019 19:45
* order to guarantee stability. E.g. a transaction that removes some text
* must be delivered *after* the transaction that adds that text. Any
* deviation from this will *not* raise an error, but can lead to
* diverging state between peers.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@sccolbert Regarding this comment: As far as I read the textfield logic (and saw it in action), any attempt to remove text that has not yet been added will be discarded, and the text will remain in the value. Maybe that is because the cemetery attribute of the textfield metadata is not in use? I'll see if I can create an MWE on Monday, so we have something specific to discuss, but I thought I would leave this note for now.

@sccolbert
Copy link
Copy Markdown
Member

sccolbert commented Jun 14, 2019 via email

@sccolbert
Copy link
Copy Markdown
Member

sccolbert commented Jun 14, 2019 via email

@vidartf vidartf mentioned this pull request Aug 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants