Skip to content

Commit 9ad9e33

Browse files
committed
Address review comments
1 parent 6d46519 commit 9ad9e33

File tree

5 files changed

+57
-0
lines changed

5 files changed

+57
-0
lines changed

src/internal/connection-provider-direct.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ export default class DirectConnectionProvider extends PooledConnectionProvider {
2727
this._address = address
2828
}
2929

30+
/**
31+
* See {@link ConnectionProvider} for more information about this method and
32+
* its arguments.
33+
*/
3034
acquireConnection ({ accessMode, database, bookmarks } = {}) {
3135
return this._connectionPool
3236
.acquire(this._address)

src/internal/connection-provider-routing.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,10 @@ export default class RoutingConnectionProvider extends PooledConnectionProvider
9696
)
9797
}
9898

99+
/**
100+
* See {@link ConnectionProvider} for more information about this method and
101+
* its arguments.
102+
*/
99103
async acquireConnection ({ accessMode, database, bookmark } = {}) {
100104
let name
101105
let address

src/internal/connection-provider-single.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ export default class SingleConnectionProvider extends ConnectionProvider {
2525
this._connection = connection
2626
}
2727

28+
/**
29+
* See {@link ConnectionProvider} for more information about this method and
30+
* its arguments.
31+
*/
2832
acquireConnection ({ accessMode, database, bookmarks } = {}) {
2933
const connection = this._connection
3034
this._connection = null

src/internal/connection-provider.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import Bookmark from './bookmark'
2+
13
/**
24
* Copyright (c) 2002-2019 "Neo4j,"
35
* Neo4j Sweden AB [http://neo4j.com]
@@ -18,10 +20,29 @@
1820
*/
1921

2022
export default class ConnectionProvider {
23+
/**
24+
* This method acquires a connection against the specified database.
25+
*
26+
* Access mode and Bookmarks only applies to routing driver. Access mode only
27+
* differentiates the target server for the connection, where WRITE selects a
28+
* WRITER server, whereas READ selects a READ server. Bookmarks, when specified,
29+
* is only passed to the routing discovery procedure, for the system database to
30+
* synchronize on creation of databases and is never used in direct drivers.
31+
*
32+
* @param {object} param - object parameter
33+
* @param {string} param.accessMode - the access mode for the to-be-acquired connection
34+
* @param {string} param.database - the target database for the to-be-acquired connection
35+
* @param {Bookmark} param.bookmarks - the bookmarks to send to routing discovery
36+
*/
2137
acquireConnection ({ accessMode, database, bookmarks } = {}) {
2238
throw new Error('not implemented')
2339
}
2440

41+
/**
42+
* Closes this connection provider along with its internals (connections, pools, etc.)
43+
*
44+
* @returns {Promise<void>}
45+
*/
2546
close () {
2647
throw new Error('not implemented')
2748
}

test/internal/bookmark.test.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,30 @@ describe('#unit Bookmark', () => {
9090
])
9191
})
9292

93+
it('should be possible to construct bookmark from nested arrays with null and undefined elements', () => {
94+
const bookmark = new Bookmark([
95+
'neo4j:bookmark:v1:tx1',
96+
null,
97+
undefined,
98+
['neo4j:bookmark:v1:tx2'],
99+
[undefined],
100+
[
101+
['neo4j:bookmark:v1:tx3', 'neo4j:bookmark:v1:tx4'],
102+
[undefined, 'neo4j:bookmark:v1:tx5', 'neo4j:bookmark:v1:tx6', null]
103+
]
104+
])
105+
106+
expect(bookmark.isEmpty()).toBeFalsy()
107+
expect(bookmark.values()).toEqual([
108+
'neo4j:bookmark:v1:tx1',
109+
'neo4j:bookmark:v1:tx2',
110+
'neo4j:bookmark:v1:tx3',
111+
'neo4j:bookmark:v1:tx4',
112+
'neo4j:bookmark:v1:tx5',
113+
'neo4j:bookmark:v1:tx6'
114+
])
115+
})
116+
93117
it('should not be possible to construct bookmark from object', () => {
94118
expect(() => new Bookmark({})).toThrowError(TypeError)
95119
expect(

0 commit comments

Comments
 (0)