-
Notifications
You must be signed in to change notification settings - Fork 365
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
Add flush operation to KVAO #1206
Conversation
77748d7
to
7dbea89
Compare
Used to delete all keys (and values) associated to the current model.
7dbea89
to
f38709b
Compare
@slnode test please |
@slnode test please |
1 similar comment
@slnode test please |
Oracle is failing due to executing |
@superkhau I am rather unhappy that addition of a new API was landed without any peer review :( I personally find the new method name Quoting google result:
Can we use a better name please, for example one of Considering that @ritch thoughts? |
@@ -201,6 +201,12 @@ KeyValueMemoryConnector.prototype.disconnect = function(callback) { | |||
process.nextTick(callback); | |||
}; | |||
|
|||
KeyValueMemoryConnector.prototype.flush = | |||
function(modelName, options, callback) { | |||
this._store = Object.create(null); |
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 is duplicating the code from constructor, I am worried that these two places may get out of sync soon. Please extract a shared private method, e.g. KeyValueMemoryConnector.prototype._resetStore()
.
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 forgot to submit my comments yesterday. Based on our last discussion, this comment is no longer relevant, as flush
will be deleting only keys of a single model, i.e. the implementation will be different.
KeyValueMemoryConnector.prototype.flush = | ||
function(modelName, options, callback) { | ||
this._store = Object.create(null); | ||
callback(); |
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.
process.nextTick(callback)
?
|
||
module.exports = function(dataSourceFactory, connectorCapabilities) { | ||
var supportsFlushOperation = | ||
connectorCapabilities.supportsFlushOperation !== false; |
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.
The way how I envision connectorCapabilities
is to provide backwards compatibility, so that we don't have to upgrade all downstream connectors when we add a new operation to juggler. To achieve that, connectors must explicitly set supportsFlushOperation
to true
to enable this test suite.
var supportsFlushOperation =
!!connectorCapabilities.supportsFlushOperation;
As discussed with @bajtos over hangouts, the change was a blocker and needed landing to verify the other KV PRs (and he was on vacation and I didn't know when he was coming back). Anyways, it's resolved and we will be changing |
Used to delete all keys (and values) associated to the current model.
Connect to https://github.com/strongloop-internal/scrum-loopback/issues/1379
cc @bajtos