Define server plugin interface, move Agent queries code into a built-in plugin#353
Draft
ericyhwang wants to merge 1 commit intomasterfrom
Draft
Define server plugin interface, move Agent queries code into a built-in plugin#353ericyhwang wants to merge 1 commit intomasterfrom
ericyhwang wants to merge 1 commit intomasterfrom
Conversation
alecgibson
reviewed
Mar 20, 2020
Collaborator
alecgibson
left a comment
There was a problem hiding this comment.
Looks like a good change!
| if (errMessage) return callback(new ShareDBError(ERROR_CODE.ERR_MESSAGE_BADLY_FORMED, errMessage)); | ||
| if (plugin) { | ||
| try { | ||
| plugin.checkRequest(request); |
Collaborator
There was a problem hiding this comment.
Maybe this method should be optional? Or do we want to enforce that all plugins validate requests?
| }; | ||
| } | ||
|
|
||
| QueryServerPlugin.prototype.close = function(callback) { |
Collaborator
There was a problem hiding this comment.
Should this also be optional?
ericyhwang
commented
Mar 25, 2020
Contributor
Author
ericyhwang
left a comment
There was a problem hiding this comment.
From Alec:
- Consider inverting so that plugins store a map of per-agent states, instead of storing state on the agent.
I'm going to merge this and other plugin PRs into a feature branch, in case we want to publish small bugfixes while this is under development.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We want to develop support for ShareDB plugins that can add support for new actions on top of ShareDB's functionality - #337
This is one part of that work, adding the ability for the server
Agent#_handleMessageto call message handling functions in registered plugins.As a feasibility check, this PR moves the core query code from the server Agent class into a built-in server plugin, QueryServerPlugin, with no functionality changes. There are also no changes to client code in this PR.
Things that I would like to add: