Skip to content

Rename Session.lastBookmark to Session.lastBookmarks #848

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 1 commit into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions packages/bolt-connection/src/bolt/bolt-protocol-v1.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import {
import { internal } from 'neo4j-driver-core'

const {
bookmark: { Bookmark },
bookmarks: { Bookmarks },
constants: { ACCESS_MODE_WRITE, BOLT_PROTOCOL_V1 },
logger: { Logger },
txConfig: { TxConfig }
Expand Down Expand Up @@ -140,7 +140,7 @@ export default class BoltProtocol {
/**
* Begin an explicit transaction.
* @param {Object} param
* @param {Bookmark} param.bookmark the bookmark.
* @param {Bookmarks} param.bookmarks the bookmarks.
* @param {TxConfig} param.txConfig the configuration.
* @param {string} param.database the target database name.
* @param {string} param.mode the access mode.
Expand All @@ -152,7 +152,7 @@ export default class BoltProtocol {
* @returns {StreamObserver} the stream observer that monitors the corresponding server response.
*/
beginTransaction ({
bookmark,
bookmarks,
txConfig,
database,
mode,
Expand All @@ -164,9 +164,9 @@ export default class BoltProtocol {
} = {}) {
return this.run(
'BEGIN',
bookmark ? bookmark.asBeginTransactionParameters() : {},
bookmarks ? bookmarks.asBeginTransactionParameters() : {},
{
bookmark: bookmark,
bookmarks: bookmarks,
txConfig: txConfig,
database,
mode,
Expand Down Expand Up @@ -201,7 +201,7 @@ export default class BoltProtocol {
'COMMIT',
{},
{
bookmark: Bookmark.empty(),
bookmarks: Bookmarks.empty(),
txConfig: TxConfig.empty(),
mode: ACCESS_MODE_WRITE,
beforeError,
Expand Down Expand Up @@ -233,7 +233,7 @@ export default class BoltProtocol {
'ROLLBACK',
{},
{
bookmark: Bookmark.empty(),
bookmarks: Bookmarks.empty(),
txConfig: TxConfig.empty(),
mode: ACCESS_MODE_WRITE,
beforeError,
Expand All @@ -249,7 +249,7 @@ export default class BoltProtocol {
* @param {string} query the cypher query.
* @param {Object} parameters the query parameters.
* @param {Object} param
* @param {Bookmark} param.bookmark the bookmark.
* @param {Bookmarks} param.bookmarks the bookmarks.
* @param {TxConfig} param.txConfig the transaction configuration.
* @param {string} param.database the target database name.
* @param {string} param.impersonatedUser the impersonated user
Expand All @@ -267,7 +267,7 @@ export default class BoltProtocol {
query,
parameters,
{
bookmark,
bookmarks,
txConfig,
database,
mode,
Expand Down Expand Up @@ -295,7 +295,7 @@ export default class BoltProtocol {
lowRecordWatermark
})

// bookmark and mode are ignored in this version of the protocol
// bookmarks and mode are ignored in this version of the protocol
assertTxConfigIsEmpty(txConfig, this._onProtocolError, observer)
// passing in a database name on this protocol version throws an error
assertDatabaseIsEmpty(database, this._onProtocolError, observer)
Expand Down
12 changes: 6 additions & 6 deletions packages/bolt-connection/src/bolt/bolt-protocol-v3.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
import { internal } from 'neo4j-driver-core'

const {
bookmark: { Bookmark },
bookmarks: { Bookmarks },
constants: { BOLT_PROTOCOL_V3 },
txConfig: { TxConfig }
} = internal
Expand Down Expand Up @@ -75,7 +75,7 @@ export default class BoltProtocol extends BoltProtocolV2 {
}

beginTransaction ({
bookmark,
bookmarks,
txConfig,
database,
impersonatedUser,
Expand All @@ -100,7 +100,7 @@ export default class BoltProtocol extends BoltProtocolV2 {
assertImpersonatedUserIsEmpty(impersonatedUser, this._onProtocolError, observer)

this.write(
RequestMessage.begin({ bookmark, txConfig, mode }),
RequestMessage.begin({ bookmarks, txConfig, mode }),
observer,
true
)
Expand Down Expand Up @@ -152,7 +152,7 @@ export default class BoltProtocol extends BoltProtocolV2 {
query,
parameters,
{
bookmark,
bookmarks,
txConfig,
database,
impersonatedUser,
Expand Down Expand Up @@ -187,7 +187,7 @@ export default class BoltProtocol extends BoltProtocolV2 {

this.write(
RequestMessage.runWithMetadata(query, parameters, {
bookmark,
bookmarks,
txConfig,
mode
}),
Expand All @@ -206,7 +206,7 @@ export default class BoltProtocol extends BoltProtocolV2 {
* @param {object} param.routingContext The routing context used to define the routing table.
* Multi-datacenter deployments is one of its use cases
* @param {string} param.databaseName The database name
* @param {Bookmark} params.sessionContext.bookmark The bookmark used for request the routing table
* @param {Bookmarks} params.sessionContext.bookmarks The bookmarks used for requesting the routing table
* @param {string} params.sessionContext.mode The session mode
* @param {string} params.sessionContext.database The database name used on the session
* @param {function()} params.sessionContext.afterComplete The session param used after the session closed
Expand Down
12 changes: 6 additions & 6 deletions packages/bolt-connection/src/bolt/bolt-protocol-v4x0.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
import { internal } from 'neo4j-driver-core'

const {
bookmark: { Bookmark },
bookmarks: { Bookmarks },
constants: { BOLT_PROTOCOL_V4_0, FETCH_ALL },
txConfig: { TxConfig }
} = internal
Expand All @@ -42,7 +42,7 @@ export default class BoltProtocol extends BoltProtocolV3 {
}

beginTransaction ({
bookmark,
bookmarks,
txConfig,
database,
impersonatedUser,
Expand All @@ -65,7 +65,7 @@ export default class BoltProtocol extends BoltProtocolV3 {
assertImpersonatedUserIsEmpty(impersonatedUser, this._onProtocolError, observer)

this.write(
RequestMessage.begin({ bookmark, txConfig, database, mode }),
RequestMessage.begin({ bookmarks, txConfig, database, mode }),
observer,
true
)
Expand All @@ -77,7 +77,7 @@ export default class BoltProtocol extends BoltProtocolV3 {
query,
parameters,
{
bookmark,
bookmarks,
txConfig,
database,
impersonatedUser,
Expand Down Expand Up @@ -117,7 +117,7 @@ export default class BoltProtocol extends BoltProtocolV3 {
const flushRun = reactive
this.write(
RequestMessage.runWithMetadata(query, parameters, {
bookmark,
bookmarks,
txConfig,
database,
mode
Expand Down Expand Up @@ -150,7 +150,7 @@ export default class BoltProtocol extends BoltProtocolV3 {
* @param {object} param.routingContext The routing context used to define the routing table.
* Multi-datacenter deployments is one of its use cases
* @param {string} param.databaseName The database name
* @param {Bookmark} params.sessionContext.bookmark The bookmark used for request the routing table
* @param {Bookmarks} params.sessionContext.bookmarks The bookmarks used for requesting the routing table
* @param {string} params.sessionContext.mode The session mode
* @param {string} params.sessionContext.database The database name used on the session
* @param {function()} params.sessionContext.afterComplete The session param used after the session closed
Expand Down
8 changes: 4 additions & 4 deletions packages/bolt-connection/src/bolt/bolt-protocol-v4x3.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { RouteObserver } from './stream-observers'
import { internal } from 'neo4j-driver-core'

const {
bookmark: { Bookmark },
bookmarks: { Bookmarks },
constants: { BOLT_PROTOCOL_V4_3 }
} = internal

Expand All @@ -39,7 +39,7 @@ export default class BoltProtocol extends BoltProtocolV42 {
* @param {object} param.routingContext The routing context used to define the routing table.
* Multi-datacenter deployments is one of its use cases
* @param {string} param.databaseName The database name
* @param {Bookmark} params.sessionContext.bookmark The bookmark used for request the routing table
* @param {Bookmarks} params.sessionContext.bookmarks The bookmarks used for requesting the routing table
* @param {function(err: Error)} param.onError
* @param {function(RawRoutingTable)} param.onCompleted
* @returns {RouteObserver} the route observer
Expand All @@ -56,9 +56,9 @@ export default class BoltProtocol extends BoltProtocolV42 {
onError,
onCompleted
})
const bookmark = sessionContext.bookmark || Bookmark.empty()
const bookmarks = sessionContext.bookmarks || Bookmarks.empty()
this.write(
RequestMessage.route(routingContext, bookmark.values(), databaseName),
RequestMessage.route(routingContext, bookmarks.values(), databaseName),
observer,
true
)
Expand Down
16 changes: 8 additions & 8 deletions packages/bolt-connection/src/bolt/bolt-protocol-v4x4.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { RouteObserver, ResultStreamObserver } from './stream-observers'

const {
constants: { BOLT_PROTOCOL_V4_4, FETCH_ALL },
bookmark: { Bookmark },
bookmarks: { Bookmarks },
} = internal

export default class BoltProtocol extends BoltProtocolV43 {
Expand All @@ -39,7 +39,7 @@ export default class BoltProtocol extends BoltProtocolV43 {
* @param {object} param.routingContext The routing context used to define the routing table.
* Multi-datacenter deployments is one of its use cases
* @param {string} param.databaseName The database name
* @param {Bookmark} params.sessionContext.bookmark The bookmark used for request the routing table
* @param {Bookmarks} params.sessionContext.bookmarks The bookmarks used for requesting the routing table
* @param {function(err: Error)} param.onError
* @param {function(RawRoutingTable)} param.onCompleted
* @returns {RouteObserver} the route observer
Expand All @@ -57,9 +57,9 @@ export default class BoltProtocol extends BoltProtocolV43 {
onError,
onCompleted
})
const bookmark = sessionContext.bookmark || Bookmark.empty()
const bookmarks = sessionContext.bookmarks || Bookmarks.empty()
this.write(
RequestMessage.routeV4x4(routingContext, bookmark.values(), { databaseName, impersonatedUser }),
RequestMessage.routeV4x4(routingContext, bookmarks.values(), { databaseName, impersonatedUser }),
observer,
true
)
Expand All @@ -71,7 +71,7 @@ export default class BoltProtocol extends BoltProtocolV43 {
query,
parameters,
{
bookmark,
bookmarks,
txConfig,
database,
mode,
Expand Down Expand Up @@ -108,7 +108,7 @@ export default class BoltProtocol extends BoltProtocolV43 {
const flushRun = reactive
this.write(
RequestMessage.runWithMetadata(query, parameters, {
bookmark,
bookmarks,
txConfig,
database,
mode,
Expand All @@ -126,7 +126,7 @@ export default class BoltProtocol extends BoltProtocolV43 {
}

beginTransaction ({
bookmark,
bookmarks,
txConfig,
database,
mode,
Expand All @@ -146,7 +146,7 @@ export default class BoltProtocol extends BoltProtocolV43 {
observer.prepareToHandleSingleResponse()

this.write(
RequestMessage.begin({ bookmark, txConfig, database, mode, impersonatedUser }),
RequestMessage.begin({ bookmarks, txConfig, database, mode, impersonatedUser }),
observer,
true
)
Expand Down
24 changes: 12 additions & 12 deletions packages/bolt-connection/src/bolt/request-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,15 +120,15 @@ export default class RequestMessage {

/**
* Create a new BEGIN message.
* @param {Bookmark} bookmark the bookmark.
* @param {Bookmarks} bookmarks the bookmarks.
* @param {TxConfig} txConfig the configuration.
* @param {string} database the database name.
* @param {string} mode the access mode.
* @param {string} impersonatedUser the impersonated user.
* @return {RequestMessage} new BEGIN message.
*/
static begin ({ bookmark, txConfig, database, mode, impersonatedUser } = {}) {
const metadata = buildTxMetadata(bookmark, txConfig, database, mode, impersonatedUser)
static begin ({ bookmarks, txConfig, database, mode, impersonatedUser } = {}) {
const metadata = buildTxMetadata(bookmarks, txConfig, database, mode, impersonatedUser)
return new RequestMessage(
BEGIN,
[metadata],
Expand Down Expand Up @@ -156,7 +156,7 @@ export default class RequestMessage {
* Create a new RUN message with additional metadata.
* @param {string} query the cypher query.
* @param {Object} parameters the query parameters.
* @param {Bookmark} bookmark the bookmark.
* @param {Bookmarks} bookmarks the bookmarks.
* @param {TxConfig} txConfig the configuration.
* @param {string} database the database name.
* @param {string} mode the access mode.
Expand All @@ -166,9 +166,9 @@ export default class RequestMessage {
static runWithMetadata (
query,
parameters,
{ bookmark, txConfig, database, mode, impersonatedUser } = {}
{ bookmarks, txConfig, database, mode, impersonatedUser } = {}
) {
const metadata = buildTxMetadata(bookmark, txConfig, database, mode, impersonatedUser)
const metadata = buildTxMetadata(bookmarks, txConfig, database, mode, impersonatedUser)
return new RequestMessage(
RUN,
[query, parameters, metadata],
Expand Down Expand Up @@ -225,7 +225,7 @@ export default class RequestMessage {
* Generate the ROUTE message, this message is used to fetch the routing table from the server
*
* @param {object} routingContext The routing context used to define the routing table. Multi-datacenter deployments is one of its use cases
* @param {string[]} bookmarks The list of the bookmark should be used
* @param {string[]} bookmarks The list of the bookmarks should be used
* @param {string} databaseName The name of the database to get the routing table for.
* @return {RequestMessage} the ROUTE message.
*/
Expand All @@ -244,7 +244,7 @@ export default class RequestMessage {
* Generate the ROUTE message, this message is used to fetch the routing table from the server
*
* @param {object} routingContext The routing context used to define the routing table. Multi-datacenter deployments is one of its use cases
* @param {string[]} bookmarks The list of the bookmark should be used
* @param {string[]} bookmarks The list of the bookmarks should be used
* @param {object} databaseContext The context inforamtion of the database to get the routing table for.
* @param {string} databaseContext.databaseName The name of the database to get the routing table.
* @param {string} databaseContext.impersonatedUser The name of the user to impersonation when getting the routing table.
Expand Down Expand Up @@ -274,17 +274,17 @@ export default class RequestMessage {

/**
* Create an object that represent transaction metadata.
* @param {Bookmark} bookmark the bookmark.
* @param {Bookmarks} bookmarks the bookmarks.
* @param {TxConfig} txConfig the configuration.
* @param {string} database the database name.
* @param {string} mode the access mode.
* @param {string} impersonatedUser the impersonated user mode.
* @return {Object} a metadata object.
*/
function buildTxMetadata (bookmark, txConfig, database, mode, impersonatedUser) {
function buildTxMetadata (bookmarks, txConfig, database, mode, impersonatedUser) {
const metadata = {}
if (!bookmark.isEmpty()) {
metadata.bookmarks = bookmark.values()
if (!bookmarks.isEmpty()) {
metadata.bookmarks = bookmarks.values()
}
if (txConfig.timeout !== null) {
metadata.tx_timeout = txConfig.timeout
Expand Down
Loading