@google-cloud/spanner 9.0.0 → 9.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -16
- package/build/src/backup.js.map +1 -0
- package/build/src/batch-transaction.js +15 -12
- package/build/src/batch-transaction.js.map +1 -0
- package/build/src/codec.d.ts +6 -0
- package/build/src/codec.js +99 -34
- package/build/src/codec.js.map +1 -0
- package/build/src/common-grpc/service-object.js.map +1 -0
- package/build/src/common-grpc/service.js.map +1 -0
- package/build/src/common.d.ts +14 -0
- package/build/src/common.js +27 -1
- package/build/src/common.js.map +1 -0
- package/build/src/database.d.ts +31 -41
- package/build/src/database.js +122 -313
- package/build/src/database.js.map +1 -0
- package/build/src/helper.d.ts +12 -0
- package/build/src/helper.js +44 -0
- package/build/src/helper.js.map +1 -0
- package/build/src/index.d.ts +33 -8
- package/build/src/index.js +338 -134
- package/build/src/index.js.map +1 -0
- package/build/src/instance-config.js.map +1 -0
- package/build/src/instance.d.ts +15 -2
- package/build/src/instance.js +11 -2
- package/build/src/instance.js.map +1 -0
- package/build/src/instrument.d.ts +12 -1
- package/build/src/instrument.js +13 -0
- package/build/src/instrument.js.map +1 -0
- package/build/src/metrics/constants.d.ts +6 -0
- package/build/src/metrics/constants.js +6 -1
- package/build/src/metrics/constants.js.map +1 -0
- package/build/src/metrics/external-types.d.ts +9 -1
- package/build/src/metrics/external-types.js.map +1 -0
- package/build/src/metrics/interceptor.js +32 -28
- package/build/src/metrics/interceptor.js.map +1 -0
- package/build/src/metrics/metrics-tracer-factory.d.ts +24 -18
- package/build/src/metrics/metrics-tracer-factory.js +94 -77
- package/build/src/metrics/metrics-tracer-factory.js.map +1 -0
- package/build/src/metrics/metrics-tracer.d.ts +19 -6
- package/build/src/metrics/metrics-tracer.js +147 -55
- package/build/src/metrics/metrics-tracer.js.map +1 -0
- package/build/src/metrics/spanner-metrics-exporter.d.ts +49 -1
- package/build/src/metrics/spanner-metrics-exporter.js +207 -4
- package/build/src/metrics/spanner-metrics-exporter.js.map +1 -0
- package/build/src/metrics/transform.d.ts +2 -2
- package/build/src/metrics/transform.js +7 -7
- package/build/src/metrics/transform.js.map +1 -0
- package/build/src/multiplexed-session.d.ts +13 -2
- package/build/src/multiplexed-session.js +20 -4
- package/build/src/multiplexed-session.js.map +1 -0
- package/build/src/partial-result-stream.d.ts +26 -33
- package/build/src/partial-result-stream.js +263 -283
- package/build/src/partial-result-stream.js.map +1 -0
- package/build/src/protos.js.map +1 -0
- package/build/src/request-stream-coordinator.d.ts +88 -0
- package/build/src/request-stream-coordinator.js +229 -0
- package/build/src/request-stream-coordinator.js.map +1 -0
- package/build/src/request_id_header.d.ts +6 -4
- package/build/src/request_id_header.js +24 -24
- package/build/src/request_id_header.js.map +1 -0
- package/build/src/session-factory.d.ts +52 -63
- package/build/src/session-factory.js +41 -92
- package/build/src/session-factory.js.map +1 -0
- package/build/src/session-pool.d.ts +97 -227
- package/build/src/session-pool.js +74 -547
- package/build/src/session-pool.js.map +1 -0
- package/build/src/session.js +1 -1
- package/build/src/session.js.map +1 -0
- package/build/src/table.js.map +1 -0
- package/build/src/transaction-runner.js +1 -12
- package/build/src/transaction-runner.js.map +1 -0
- package/build/src/transaction.d.ts +5 -5
- package/build/src/transaction.js +72 -112
- package/build/src/transaction.js.map +1 -0
- package/build/src/v1/index.js.map +1 -0
- package/package.json +25 -27
|
@@ -17,17 +17,16 @@ import { Database, Session, Transaction } from '.';
|
|
|
17
17
|
import { MultiplexedSessionInterface } from './multiplexed-session';
|
|
18
18
|
import { SessionPoolInterface, SessionPoolOptions } from './session-pool';
|
|
19
19
|
import { SessionPoolConstructor } from './database';
|
|
20
|
+
import { ServiceError } from 'google-gax';
|
|
20
21
|
declare const common: any;
|
|
21
22
|
/**
|
|
22
23
|
* @callback GetSessionCallback
|
|
23
24
|
* @param {?Error} error Request error, if any.
|
|
24
25
|
* @param {Session} [session] The session object.
|
|
25
26
|
* @param {Transaction} [transaction] The transaction object, if applicable.
|
|
26
|
-
* Omitted for read-only multiplexed session acquisitions to prevent throwaway
|
|
27
|
-
* allocations. Provided by getSessionForReadWrite or when using regular session pools.
|
|
28
27
|
*/
|
|
29
28
|
export interface GetSessionCallback {
|
|
30
|
-
(err: Error | null, session?: Session | null, transaction?: Transaction | null): void;
|
|
29
|
+
(err: Error | ServiceError | null, session?: Session | null, transaction?: Transaction | null): void;
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
33
32
|
* Interface for implementing session-factory logic.
|
|
@@ -49,140 +48,130 @@ export interface SessionFactoryInterface {
|
|
|
49
48
|
*/
|
|
50
49
|
getSessionSync(): Session | null;
|
|
51
50
|
/**
|
|
52
|
-
* When called returns a session for
|
|
51
|
+
* When called returns a session for partitioned operations.
|
|
53
52
|
*
|
|
53
|
+
* @deprecated Always delegates to {@link SessionFactoryInterface#getSession}.
|
|
54
54
|
* @name SessionFactoryInterface#getSessionForPartitionedOps
|
|
55
55
|
* @param {GetSessionCallback} callback The callback function.
|
|
56
56
|
*/
|
|
57
|
-
getSessionForPartitionedOps(callback: GetSessionCallback): void;
|
|
57
|
+
getSessionForPartitionedOps?(callback: GetSessionCallback): void;
|
|
58
58
|
/**
|
|
59
|
-
* When called returns a session for read
|
|
59
|
+
* When called returns a session for read/write operations.
|
|
60
60
|
*
|
|
61
|
+
* @deprecated Always delegates to {@link SessionFactoryInterface#getSession}.
|
|
61
62
|
* @name SessionFactoryInterface#getSessionForReadWrite
|
|
62
63
|
* @param {GetSessionCallback} callback The callback function.
|
|
63
64
|
*/
|
|
64
|
-
getSessionForReadWrite(callback: GetSessionCallback): void;
|
|
65
|
+
getSessionForReadWrite?(callback: GetSessionCallback): void;
|
|
65
66
|
/**
|
|
66
67
|
* When called returns the pool object.
|
|
67
68
|
*
|
|
69
|
+
* @deprecated Session pool is deprecated and will be removed in a future release.
|
|
68
70
|
* @name SessionFactoryInterface#getPool
|
|
69
71
|
*/
|
|
70
|
-
getPool(): SessionPoolInterface;
|
|
72
|
+
getPool?(): SessionPoolInterface;
|
|
71
73
|
/**
|
|
72
|
-
*
|
|
74
|
+
* Releases a session back into the pool. No-op for multiplexed sessions.
|
|
73
75
|
*
|
|
76
|
+
* @deprecated Regular session pooling has been removed; this method is a no-op.
|
|
74
77
|
* @name SessionFactoryInterface#release
|
|
75
|
-
* @param {Session} session The session
|
|
78
|
+
* @param {Session} session The session object.
|
|
76
79
|
*/
|
|
77
|
-
release(session: Session): void;
|
|
80
|
+
release?(session: Session): void;
|
|
78
81
|
/**
|
|
79
|
-
*
|
|
82
|
+
* Returns true if multiplexed sessions are enabled.
|
|
80
83
|
*
|
|
84
|
+
* @deprecated Multiplexed sessions are always enabled.
|
|
81
85
|
* @name SessionFactoryInterface#isMultiplexedEnabled
|
|
86
|
+
* @returns {boolean} Always true.
|
|
82
87
|
*/
|
|
83
|
-
isMultiplexedEnabled(): boolean;
|
|
88
|
+
isMultiplexedEnabled?(): boolean;
|
|
84
89
|
/**
|
|
85
|
-
*
|
|
90
|
+
* Returns true if multiplexed sessions are enabled for read/write transactions.
|
|
86
91
|
*
|
|
92
|
+
* @deprecated Multiplexed sessions are always enabled for read/write transactions.
|
|
87
93
|
* @name SessionFactoryInterface#isMultiplexedEnabledForRW
|
|
94
|
+
* @returns {boolean} Always true.
|
|
88
95
|
*/
|
|
89
|
-
isMultiplexedEnabledForRW(): boolean;
|
|
96
|
+
isMultiplexedEnabledForRW?(): boolean;
|
|
97
|
+
/**
|
|
98
|
+
* When called closes the session factory and stops background maintenance.
|
|
99
|
+
*
|
|
100
|
+
* @name SessionFactoryInterface#close
|
|
101
|
+
*/
|
|
102
|
+
close?(): void;
|
|
90
103
|
}
|
|
91
104
|
/**
|
|
92
105
|
* Creates a SessionFactory object to manage the creation of
|
|
93
|
-
*
|
|
106
|
+
* multiplexed session.
|
|
94
107
|
*
|
|
95
108
|
* @class
|
|
96
109
|
*
|
|
97
110
|
* @param {Database} database Database object.
|
|
98
111
|
* @param {String} name Name of the database.
|
|
99
|
-
* @param {SessionPoolOptions|SessionPoolInterface} options Session pool
|
|
100
|
-
* configuration options or custom pool inteface.
|
|
101
112
|
*/
|
|
102
113
|
export declare class SessionFactory extends common.GrpcServiceObject implements SessionFactoryInterface {
|
|
103
|
-
multiplexedSession_: MultiplexedSessionInterface;
|
|
104
114
|
pool_: SessionPoolInterface;
|
|
105
|
-
|
|
106
|
-
isMultiplexedPartitionOps: boolean;
|
|
107
|
-
isMultiplexedRW: boolean;
|
|
115
|
+
multiplexedSession_: MultiplexedSessionInterface;
|
|
108
116
|
constructor(database: Database, name: String, poolOptions?: SessionPoolConstructor | SessionPoolOptions);
|
|
109
117
|
/**
|
|
110
|
-
* Synchronously returns a cached multiplexed session if
|
|
111
|
-
*
|
|
118
|
+
* Synchronously returns a cached multiplexed session if available,
|
|
119
|
+
* otherwise null.
|
|
112
120
|
*
|
|
113
121
|
* @returns {Session|null} The cached multiplexed session or null.
|
|
114
122
|
*/
|
|
115
123
|
getSessionSync(): Session | null;
|
|
116
124
|
/**
|
|
117
|
-
* Retrieves a
|
|
118
|
-
*
|
|
119
|
-
* If the environment variable `GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS` is set to `false`, the method will attempt to
|
|
120
|
-
* retrieve a regular session. Otherwise, it will return a multiplexed session.
|
|
125
|
+
* Retrieves a multiplexed session.
|
|
121
126
|
*
|
|
122
127
|
* @param {GetSessionCallback} callback The callback function.
|
|
123
128
|
*/
|
|
124
129
|
getSession(callback: GetSessionCallback): void;
|
|
125
130
|
/**
|
|
126
|
-
* Retrieves a session for partitioned operations
|
|
127
|
-
* based on whether multiplexed sessions are disabled or not.
|
|
128
|
-
*
|
|
129
|
-
* If multiplexed sessions are disabled for partitioned ops this methods delegates the request to `getSession()`, which returns
|
|
130
|
-
* either a multiplexed session or a regular session based on the env configuration.
|
|
131
|
-
*
|
|
132
|
-
* If the multiplexed sessions are disabled, a session will get retrieved from the regular session pool.
|
|
133
|
-
* Otherwise a multiplexed session will be used.
|
|
131
|
+
* Retrieves a session for partitioned operations.
|
|
134
132
|
*
|
|
133
|
+
* @deprecated Use {@link SessionFactory#getSession} instead.
|
|
135
134
|
* @param {GetSessionCallback} callback The callback function.
|
|
136
135
|
*/
|
|
137
136
|
getSessionForPartitionedOps(callback: GetSessionCallback): void;
|
|
138
137
|
/**
|
|
139
|
-
* Retrieves a session for read
|
|
140
|
-
* based on whether multiplexed sessions are enabled.
|
|
141
|
-
*
|
|
142
|
-
* If multiplexed sessions are disabled for read write this methods delegates the request to `getSession()`, which returns
|
|
143
|
-
* either a multiplexed session or a regular session based on the env configuration.
|
|
144
|
-
*
|
|
145
|
-
* If the multiplexed sessions are disabled, a session will get retrieved from the regular session pool.
|
|
146
|
-
* Otherise a multiplexed session will be used.
|
|
138
|
+
* Retrieves a session for read/write operations.
|
|
147
139
|
*
|
|
140
|
+
* @deprecated Use {@link SessionFactory#getSession} instead.
|
|
148
141
|
* @param {GetSessionCallback} callback The callback function.
|
|
149
142
|
*/
|
|
150
143
|
getSessionForReadWrite(callback: GetSessionCallback): void;
|
|
151
144
|
/**
|
|
152
145
|
* Returns the regular session pool object.
|
|
153
146
|
*
|
|
147
|
+
* @deprecated Session pool is deprecated and will be removed in a future release.
|
|
154
148
|
* @returns {SessionPoolInterface} The session pool used by current instance.
|
|
155
149
|
*/
|
|
156
150
|
getPool(): SessionPoolInterface;
|
|
157
151
|
/**
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* This methods does not release a multiplexed session.
|
|
161
|
-
*
|
|
162
|
-
* It returns a session to the pool after it is no longer needed.
|
|
163
|
-
* It is a no-op for multiplexed sessions.
|
|
152
|
+
* No-op release method retained for backwards compatibility.
|
|
164
153
|
*
|
|
165
|
-
* @
|
|
166
|
-
*
|
|
167
|
-
*
|
|
168
|
-
* @throws {Error} If the session is invalid or cannot be released.
|
|
154
|
+
* @deprecated Multiplexed sessions do not require releasing back to a pool.
|
|
155
|
+
* @param {Session} _session The session object.
|
|
169
156
|
*/
|
|
170
|
-
release(
|
|
157
|
+
release(_session: Session): void;
|
|
171
158
|
/**
|
|
172
|
-
*
|
|
173
|
-
*
|
|
174
|
-
* This method returns true if multiplexed session is enabled, otherwise returns false
|
|
159
|
+
* Checks whether multiplexed session is enabled.
|
|
175
160
|
*
|
|
176
|
-
* @
|
|
161
|
+
* @deprecated Multiplexed sessions are always enabled.
|
|
162
|
+
* @returns {boolean} Always returns `true`.
|
|
177
163
|
*/
|
|
178
164
|
isMultiplexedEnabled(): boolean;
|
|
179
165
|
/**
|
|
180
|
-
*
|
|
181
|
-
*
|
|
182
|
-
* This method returns true if multiplexed session is enabled for read write transactions, otherwise returns false
|
|
166
|
+
* Checks whether multiplexed session is enabled for read/write transactions.
|
|
183
167
|
*
|
|
184
|
-
* @
|
|
168
|
+
* @deprecated Multiplexed sessions are always enabled for read/write transactions.
|
|
169
|
+
* @returns {boolean} Always returns `true`.
|
|
185
170
|
*/
|
|
186
171
|
isMultiplexedEnabledForRW(): boolean;
|
|
172
|
+
/**
|
|
173
|
+
* Closes the session factory and stops background maintenance.
|
|
174
|
+
*/
|
|
175
|
+
close(): void;
|
|
187
176
|
}
|
|
188
177
|
export {};
|
|
@@ -21,21 +21,16 @@ const session_pool_1 = require("./session-pool");
|
|
|
21
21
|
const common = require('./common-grpc/service-object');
|
|
22
22
|
/**
|
|
23
23
|
* Creates a SessionFactory object to manage the creation of
|
|
24
|
-
*
|
|
24
|
+
* multiplexed session.
|
|
25
25
|
*
|
|
26
26
|
* @class
|
|
27
27
|
*
|
|
28
28
|
* @param {Database} database Database object.
|
|
29
29
|
* @param {String} name Name of the database.
|
|
30
|
-
* @param {SessionPoolOptions|SessionPoolInterface} options Session pool
|
|
31
|
-
* configuration options or custom pool inteface.
|
|
32
30
|
*/
|
|
33
31
|
class SessionFactory extends common.GrpcServiceObject {
|
|
34
|
-
multiplexedSession_;
|
|
35
32
|
pool_;
|
|
36
|
-
|
|
37
|
-
isMultiplexedPartitionOps;
|
|
38
|
-
isMultiplexedRW;
|
|
33
|
+
multiplexedSession_;
|
|
39
34
|
constructor(database, name, poolOptions) {
|
|
40
35
|
super({
|
|
41
36
|
parent: database,
|
|
@@ -49,136 +44,90 @@ class SessionFactory extends common.GrpcServiceObject {
|
|
|
49
44
|
// initialize multiplexed session
|
|
50
45
|
this.multiplexedSession_ = new multiplexed_session_1.MultiplexedSession(database);
|
|
51
46
|
this.multiplexedSession_.createSession();
|
|
52
|
-
// set the isMultiplexed property to false if multiplexed session is disabled, otherwise set the property to true
|
|
53
|
-
this.isMultiplexed = !(process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS === 'false');
|
|
54
|
-
// set the isMultiplexedPartitionedOps property to false if multiplexed session is disabled for paritioned ops, otherwise set the property to true
|
|
55
|
-
this.isMultiplexedPartitionOps = !(process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS === 'false' &&
|
|
56
|
-
process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_PARTITIONED_OPS ===
|
|
57
|
-
'false');
|
|
58
|
-
// set the isMultiplexedRW property to false if multiplexed session is disabled for read/write, otherwise set the property to true
|
|
59
|
-
this.isMultiplexedRW = !(process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS === 'false' &&
|
|
60
|
-
process.env.GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS_FOR_RW === 'false');
|
|
61
|
-
// Regular sessions should only be created if mux is disabled.
|
|
62
|
-
if (!this.isMultiplexed) {
|
|
63
|
-
this.pool_.on('error', this.emit.bind(database, 'error'));
|
|
64
|
-
this.pool_.open();
|
|
65
|
-
}
|
|
66
47
|
}
|
|
67
48
|
/**
|
|
68
|
-
* Synchronously returns a cached multiplexed session if
|
|
69
|
-
*
|
|
49
|
+
* Synchronously returns a cached multiplexed session if available,
|
|
50
|
+
* otherwise null.
|
|
70
51
|
*
|
|
71
52
|
* @returns {Session|null} The cached multiplexed session or null.
|
|
72
53
|
*/
|
|
73
54
|
getSessionSync() {
|
|
74
|
-
return this.
|
|
75
|
-
? (this.multiplexedSession_?.getSessionSync?.() ?? null)
|
|
76
|
-
: null;
|
|
55
|
+
return this.multiplexedSession_?.getSessionSync?.() ?? null;
|
|
77
56
|
}
|
|
78
57
|
/**
|
|
79
|
-
* Retrieves a
|
|
80
|
-
*
|
|
81
|
-
* If the environment variable `GOOGLE_CLOUD_SPANNER_MULTIPLEXED_SESSIONS` is set to `false`, the method will attempt to
|
|
82
|
-
* retrieve a regular session. Otherwise, it will return a multiplexed session.
|
|
58
|
+
* Retrieves a multiplexed session.
|
|
83
59
|
*
|
|
84
60
|
* @param {GetSessionCallback} callback The callback function.
|
|
85
61
|
*/
|
|
86
62
|
getSession(callback) {
|
|
87
|
-
|
|
88
|
-
? this.multiplexedSession_
|
|
89
|
-
: this.pool_;
|
|
90
|
-
sessionHandler.getSession(callback);
|
|
63
|
+
this.multiplexedSession_.getSession(callback);
|
|
91
64
|
}
|
|
92
65
|
/**
|
|
93
|
-
* Retrieves a session for partitioned operations
|
|
94
|
-
* based on whether multiplexed sessions are disabled or not.
|
|
95
|
-
*
|
|
96
|
-
* If multiplexed sessions are disabled for partitioned ops this methods delegates the request to `getSession()`, which returns
|
|
97
|
-
* either a multiplexed session or a regular session based on the env configuration.
|
|
98
|
-
*
|
|
99
|
-
* If the multiplexed sessions are disabled, a session will get retrieved from the regular session pool.
|
|
100
|
-
* Otherwise a multiplexed session will be used.
|
|
66
|
+
* Retrieves a session for partitioned operations.
|
|
101
67
|
*
|
|
68
|
+
* @deprecated Use {@link SessionFactory#getSession} instead.
|
|
102
69
|
* @param {GetSessionCallback} callback The callback function.
|
|
103
70
|
*/
|
|
104
71
|
getSessionForPartitionedOps(callback) {
|
|
105
|
-
this.
|
|
106
|
-
? this.getSession(callback)
|
|
107
|
-
: this.pool_.getSession(callback);
|
|
72
|
+
this.getSession(callback);
|
|
108
73
|
}
|
|
109
74
|
/**
|
|
110
|
-
* Retrieves a session for read
|
|
111
|
-
* based on whether multiplexed sessions are enabled.
|
|
112
|
-
*
|
|
113
|
-
* If multiplexed sessions are disabled for read write this methods delegates the request to `getSession()`, which returns
|
|
114
|
-
* either a multiplexed session or a regular session based on the env configuration.
|
|
115
|
-
*
|
|
116
|
-
* If the multiplexed sessions are disabled, a session will get retrieved from the regular session pool.
|
|
117
|
-
* Otherise a multiplexed session will be used.
|
|
75
|
+
* Retrieves a session for read/write operations.
|
|
118
76
|
*
|
|
77
|
+
* @deprecated Use {@link SessionFactory#getSession} instead.
|
|
119
78
|
* @param {GetSessionCallback} callback The callback function.
|
|
120
79
|
*/
|
|
121
80
|
getSessionForReadWrite(callback) {
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
this.pool_.getSession(callback);
|
|
135
|
-
}
|
|
81
|
+
this.getSession((error, session, transaction) => {
|
|
82
|
+
if (error || !session) {
|
|
83
|
+
callback(error ?? new Error('No session found'), null);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
const database = session.parent;
|
|
87
|
+
const activeTransaction = transaction ?? session.transaction(database?.queryOptions_);
|
|
88
|
+
callback(null, session, activeTransaction);
|
|
89
|
+
});
|
|
136
90
|
}
|
|
137
91
|
/**
|
|
138
92
|
* Returns the regular session pool object.
|
|
139
93
|
*
|
|
94
|
+
* @deprecated Session pool is deprecated and will be removed in a future release.
|
|
140
95
|
* @returns {SessionPoolInterface} The session pool used by current instance.
|
|
141
96
|
*/
|
|
142
97
|
getPool() {
|
|
143
98
|
return this.pool_;
|
|
144
99
|
}
|
|
145
100
|
/**
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
* This methods does not release a multiplexed session.
|
|
101
|
+
* No-op release method retained for backwards compatibility.
|
|
149
102
|
*
|
|
150
|
-
*
|
|
151
|
-
*
|
|
152
|
-
*
|
|
153
|
-
* @param {Session} session - The session to be released. This should be an instance of `Session` that was
|
|
154
|
-
* previously acquired from the session pool.
|
|
155
|
-
*
|
|
156
|
-
* @throws {Error} If the session is invalid or cannot be released.
|
|
103
|
+
* @deprecated Multiplexed sessions do not require releasing back to a pool.
|
|
104
|
+
* @param {Session} _session The session object.
|
|
157
105
|
*/
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
this.pool_.release(session);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
106
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
107
|
+
release(_session) { }
|
|
163
108
|
/**
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
* This method returns true if multiplexed session is enabled, otherwise returns false
|
|
109
|
+
* Checks whether multiplexed session is enabled.
|
|
167
110
|
*
|
|
168
|
-
* @
|
|
111
|
+
* @deprecated Multiplexed sessions are always enabled.
|
|
112
|
+
* @returns {boolean} Always returns `true`.
|
|
169
113
|
*/
|
|
170
114
|
isMultiplexedEnabled() {
|
|
171
|
-
return
|
|
115
|
+
return true;
|
|
172
116
|
}
|
|
173
117
|
/**
|
|
174
|
-
*
|
|
118
|
+
* Checks whether multiplexed session is enabled for read/write transactions.
|
|
175
119
|
*
|
|
176
|
-
*
|
|
177
|
-
*
|
|
178
|
-
* @returns {boolean}
|
|
120
|
+
* @deprecated Multiplexed sessions are always enabled for read/write transactions.
|
|
121
|
+
* @returns {boolean} Always returns `true`.
|
|
179
122
|
*/
|
|
180
123
|
isMultiplexedEnabledForRW() {
|
|
181
|
-
return
|
|
124
|
+
return true;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Closes the session factory and stops background maintenance.
|
|
128
|
+
*/
|
|
129
|
+
close() {
|
|
130
|
+
this.multiplexedSession_?.close?.();
|
|
182
131
|
}
|
|
183
132
|
}
|
|
184
133
|
exports.SessionFactory = SessionFactory;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-factory.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