Constructor

SessionPool

new SessionPool(database, options)

Class used to manage connections to Spanner.

You don't need to use this class directly, connections will be handled for you.

Parameter

database

Database

The DB instance.

options

Optional

SessionPoolOptions

Configuration options.

Extends
EventEmitter

Properties

acquireTimeout

read-only

number

available

read-only

number

database

read-only

Database

fail

read-only

boolean

maxIdle

read-only

number

pendingAcquires

read-only

array

pool

read-only

object

writePool

read-only

(object or null)

Methods

clear

clear() returns Promise

Destroys all sessions within the pool.

Returns

Promise 

getSession

getSession(callback)

Retrieve a read session.

Parameter

callback

GetSessionCallback

Callback function.

getWriteSession

getWriteSession(callback)

Retrieve the write session.

Parameter

callback

GetWriteSessionCallback

Callback function.

release

release(session) returns Promise

Release a session back into the pool.

Parameter

session

Session

The session to be released.

Returns

Promise 

request

request(config, callback)

Make an API request, first assuring an active session is used.

Parameter

config

object

callback

function()

requestStream

requestStream(config) returns Stream

Make an API request as a stream, first assuring an active session is used.

Parameter

config

object

Returns

Stream