Skip to content

Commit ba5f1d6

Browse files
committed
Added the 2 new machines-- still need a few tweaks.
1 parent 410bd31 commit ba5f1d6

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed

SYNTAX_NOTES.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,55 @@ MySQL.destroyConnection({
186186

187187

188188

189+
////////////////////////////////////////////////////////////////////////////////////////
190+
// AN ALTERNATE (SIMPLER) APPROACH
191+
// (a driver-level concept of "manager" would allow us to avoid dealing with various
192+
// different pooling implementations across different dbs)
193+
194+
195+
// This is new:
196+
// It is necessary because state needs to be managed outside of the context of
197+
// one particular connection (e.g. pool or cluster pool, or custom cluster/sharding setup)
198+
MySQL.createManager({
199+
connectionString: 'mysql://...',
200+
meta: {
201+
// << this is where all sorts of stuff relating to
202+
// connection configuration might be passed in (user/pass/host).
203+
// There could be >1 connection strings if this is a cluster deployment
204+
// with replicas and such-- that's up to the driver to implement.
205+
}
206+
}).exec(/*...*/);
207+
208+
209+
// destroyManager is critical because some packages (looking at you `mysql`)
210+
// need to have special logic called in order to make the process exit gracefully.
211+
// This is for use in the adapter's teardown method.
212+
MySQL.destroyManager({
213+
manager: manager,
214+
meta: {}
215+
}).exec(/*...*/);
216+
217+
218+
// Instead of `connectionString`, now `getConnection()` expects a `manager`.
219+
// Note that there is currently no standardized way to force a new connection
220+
// to be opened. Individual drivers may implement this if they so choose using
221+
// the `meta` input. To build additional pools, create more managers using
222+
// `createManager()`. For further customizability, fork this driver.
223+
MySQL.getConnection({
224+
manager: manager,
225+
meta: {}
226+
}).exec(/*...*/);
227+
228+
229+
// This is unchanged. Note that there is currently no standardized way to force a
230+
// connection to be destroyed rather than released. Individual drivers may implement
231+
// this if they so choose using the `meta` input. To forcibly kill a particular pool,
232+
// call `destroyManager()`. For further customizability, fork this driver.
233+
MySQL.releaseConnection({
234+
connection: connection,
235+
meta: {}
236+
}).exec(/*...*/);
237+
189238

190239

191240

@@ -224,7 +273,9 @@ Waterline.transaction({
224273
during: function (T, done) {
225274

226275

276+
}
227277

278+
});
228279

229280

230281
// MOVING ON

0 commit comments

Comments
 (0)