Skip to content
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

feature: allow users to provide custom pool class #236

Closed
callmehiphop opened this issue Jun 21, 2018 · 1 comment
Closed

feature: allow users to provide custom pool class #236

callmehiphop opened this issue Jun 21, 2018 · 1 comment
Assignees
Labels
api: spanner Issues related to the googleapis/nodejs-spanner API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@callmehiphop
Copy link
Contributor

I think no one is a stranger to the fact that we've been seeing a fair amount of chatter around issues with our pooling implementation. Its come to my attention that some teams might want to opt out of certain features of our Pooling class or in some cases just have a finer level of control. I would like to propose accepting a Pool constructor that could be used in place of our Pooling class.

I've reviewed our code and with a light refactor I think the bare minimum could be the following interface

interface PoolInterface extends EventEmitter {
  new (database: Database);
  open();
  close(callback: (err: Error) => void);
  getReadSession(callback: (err: Error, session: Session) => void);
  getwriteSession(callback: (err: Error, session: Session, transaction: Transaction) => void);
  release(session: Session);
}

Integrating would be as simple as

class CustomPool extends EventEmitter {
  // ...
}

const database = instance.database('my-db', CustomPool);

Thoughts?

@callmehiphop
Copy link
Contributor Author

/cc @googleapis/yoshi-nodejs @anup-honey @walshie4

@ghost ghost assigned callmehiphop Jun 25, 2018
@JustinBeckwith JustinBeckwith added type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. and removed type: enhancement labels Jun 25, 2018
@google-cloud-label-sync google-cloud-label-sync bot added the api: spanner Issues related to the googleapis/nodejs-spanner API. label Jan 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: spanner Issues related to the googleapis/nodejs-spanner API. type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

2 participants