-
Notifications
You must be signed in to change notification settings - Fork 151
Home Database Cache : Stripped Back Solution #1235
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
Merged
Merged
Changes from all commits
Commits
Show all changes
84 commits
Select commit
Hold shift + click to select a range
0ea5012
Migrating work from old branch
MaxAake c62cdaa
function with driver auth tokens as well as session auth
MaxAake 6e9b495
minor fixes to integration and unit tests
MaxAake c307fb8
Update driver.test.js
MaxAake 24cf859
expanded callback usage and fixed tests for old servers
MaxAake 9066f24
change checks for when to update cache
MaxAake ca50142
Save round trip when running transactions too
MaxAake 886b90a
update to homedbtable
MaxAake b4b1a48
deno
MaxAake f38a5df
Continued work, hard to clear cache on error :/
MaxAake 195f05f
continued work, requires server side fix to commit success message
MaxAake 317e282
deno
MaxAake d075328
logic to turn off and on caching using connection hints
MaxAake 81a4924
deno
MaxAake ac11804
change back to caching database name
MaxAake 458a493
bolt 5.8 plus reworks
MaxAake 6b238fa
deno and minor fix
MaxAake 936233f
remove debug log and fix minor issue
MaxAake a84543e
many small rewrites, test updates
MaxAake ced7c46
deno and removal off cachekey in hello
MaxAake fafde75
remove cachekey from logon and init
MaxAake b8633aa
protect from undefined callback
MaxAake 2cc2e89
Update index.js
MaxAake 050efaa
Update auth.test.js
MaxAake 19e4f36
move hash function to allow imports
MaxAake dfbdeb4
deno
MaxAake a8a675f
small rework
MaxAake ae82924
add bolt 5x8 feature
MaxAake fde547f
cleanup and fixing for testkit tests
MaxAake ed2b494
deno
MaxAake 22c795b
fixing silly self-sabotage
MaxAake 0a39014
deno
MaxAake 428d716
remove lingering debug log and fix unit test
MaxAake aab842c
Update index.test.ts
MaxAake ab44877
identify scheme in cache key to ensure default key is unique
MaxAake c3dbbc3
deno
MaxAake d32cd01
capped homedb cache size
MaxAake 7bdcdd1
deno
MaxAake 6838806
add parameters to cachekey
MaxAake dc90e16
deno
MaxAake 3de0474
Update auth.test.ts
MaxAake 28d3d8f
create Cache class and refine pruning logic
MaxAake 521836c
refine lastdate and fix test
MaxAake 9e92450
remove debug logging
MaxAake 06db084
some test fixes
MaxAake 5786c29
expansion of unit tests
MaxAake 0ef51c0
integration tests on driver, session and impersonated auth
MaxAake 8d75497
check for community edition in test
MaxAake 64a3bd1
better check for impersonation and correct protocol version
MaxAake ab87195
fix typo in tests
MaxAake a5e97a8
Update driver.test.js
MaxAake 432a34b
improved documentation
MaxAake cdb6778
deno
MaxAake 968b449
clean up
MaxAake d40daf8
post-cleanup denobuild
MaxAake 47429aa
correction
MaxAake ca2fef3
Update testkit.json
MaxAake 38e2838
remove failures for read fails, add testkit flag
MaxAake 734ed23
addressing comments on the PR
MaxAake 600f028
continued addressing of reviews
MaxAake 837ba63
unit tests and renamed auth-util file
MaxAake 451714f
deno
MaxAake 27c9711
import issue in unit tests
MaxAake e404900
remove removeFailureFromCache callback
MaxAake f7df396
restrict onDb callback to only bolt 5.8 run success
MaxAake b3c7e9e
upgrade cacheKey function to implement impersonation and default key
MaxAake 4f33599
deno
MaxAake 452a09e
fixing issue with correctly identifying the lack of an impersonated user
MaxAake 718e4cd
fallback logic for missing ssr hint on new connection
MaxAake 09f5377
skips timeout test and adds HomeDatabaseCache flag
MaxAake 6192d6e
Update testkit.json
MaxAake 7148dda
remove some unnecessary checks
MaxAake 0a96302
deno
MaxAake 254ae4d
correct bolt agent numbering
MaxAake 0e47227
Update bolt-protocol-v5x8.test.js
MaxAake f7de064
minor fixes and collision free cachekeys
MaxAake 7c0eee0
deno
MaxAake 22b4a75
better solution
MaxAake ef3add5
deno
MaxAake 5e66a89
switch to prewritten stringify
MaxAake 4c3a739
correct expect-error-message
MaxAake 18b3860
Moves sorting of JSON elements to stringify function.
MaxAake 4331f70
deno
MaxAake e034313
formatting change
MaxAake File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
104 changes: 104 additions & 0 deletions
104
packages/bolt-connection/src/bolt/bolt-protocol-v5x8.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
/** | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [https://neo4j.com] | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
import BoltProtocolV5x7 from './bolt-protocol-v5x7' | ||
|
||
import transformersFactories from './bolt-protocol-v5x8.transformer' | ||
import Transformer from './transformer' | ||
import RequestMessage from './request-message' | ||
import { ResultStreamObserver } from './stream-observers' | ||
|
||
import { internal } from 'neo4j-driver-core' | ||
|
||
const { | ||
constants: { BOLT_PROTOCOL_V5_8, FETCH_ALL } | ||
} = internal | ||
|
||
export default class BoltProtocol extends BoltProtocolV5x7 { | ||
get version () { | ||
return BOLT_PROTOCOL_V5_8 | ||
} | ||
|
||
get transformer () { | ||
if (this._transformer === undefined) { | ||
this._transformer = new Transformer(Object.values(transformersFactories).map(create => create(this._config, this._log))) | ||
} | ||
return this._transformer | ||
} | ||
|
||
run ( | ||
query, | ||
parameters, | ||
{ | ||
bookmarks, | ||
txConfig, | ||
database, | ||
mode, | ||
impersonatedUser, | ||
notificationFilter, | ||
beforeKeys, | ||
afterKeys, | ||
beforeError, | ||
afterError, | ||
beforeComplete, | ||
afterComplete, | ||
flush = true, | ||
reactive = false, | ||
fetchSize = FETCH_ALL, | ||
highRecordWatermark = Number.MAX_VALUE, | ||
lowRecordWatermark = Number.MAX_VALUE, | ||
onDb | ||
} = {} | ||
) { | ||
const observer = new ResultStreamObserver({ | ||
server: this._server, | ||
reactive, | ||
fetchSize, | ||
moreFunction: this._requestMore.bind(this), | ||
discardFunction: this._requestDiscard.bind(this), | ||
beforeKeys, | ||
afterKeys, | ||
beforeError, | ||
afterError, | ||
beforeComplete, | ||
afterComplete, | ||
highRecordWatermark, | ||
lowRecordWatermark, | ||
enrichMetadata: this._enrichMetadata, | ||
onDb | ||
}) | ||
|
||
const flushRun = reactive | ||
this.write( | ||
RequestMessage.runWithMetadata5x5(query, parameters, { | ||
bookmarks, | ||
txConfig, | ||
database, | ||
mode, | ||
impersonatedUser, | ||
notificationFilter | ||
}), | ||
observer, | ||
flushRun && flush | ||
) | ||
|
||
if (!reactive) { | ||
this.write(RequestMessage.pull({ n: fetchSize }), observer, flush) | ||
} | ||
|
||
return observer | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
packages/bolt-connection/src/bolt/bolt-protocol-v5x8.transformer.js
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* Copyright (c) "Neo4j" | ||
* Neo4j Sweden AB [https://neo4j.com] | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
import v5x7 from './bolt-protocol-v5x7.transformer' | ||
|
||
export default { | ||
...v5x7 | ||
} |
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.